【阿里云】运维 / 如何卸载阿里云盾 / 安骑士 / Linux / 阿里云服务器

最近新购了阿里云的VPS,发现之前的卸载阿里云监控的方法已经失效

应该是加了守护,没法直接删除相关文件,提示 Operation not permitted

其实安装及卸载方法都在 /usr/local/aegis/aegis_update/install.sh

比较烦,所以查询方案,卸载之~


操作方法如下:

解决方法

方式一
停止服务

systemctl stop aegis // service aegis stop
systemctl disable aegis // chkconfig --del aegis
rm -rf /etc/systemd/system/aegis.service

删除启动项
# 以下路径不一定都存在

rm -f /etc/rc2.d/S80aegis
rm -f /etc/rc3.d/S80aegis
rm -f /etc/rc4.d/S80aegis
rm -f /etc/rc5.d/S80aegis
rm -f /etc/rc.d/rc2.d/S80aegis
rm -f /etc/rc.d/rc3.d/S80aegis
rm -f /etc/rc.d/rc4.d/S80aegis
rm -f /etc/rc.d/rc5.d/S80aegis
rm -f /etc/init.d/aegis

删除目录

rm -rf /usr/local/aegis

方式二
卸载云盾

wget http://update.aegis.aliyun.com/download/uninstall.sh
chmod +x uninstall.sh
./uninstall.sh
wget http://update.aegis.aliyun.com/download/quartz_uninstall.sh
chmod +x quartz_uninstall.sh
./quartz_uninstall.sh

 

删除阿里云盾文件残留

pkill aliyun-service
rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service
rm -rf /usr/local/aegis*

屏蔽阿里云盾IP

iptables -I INPUT -s 140.205.201.0/28 -j DROP
iptables -I INPUT -s 140.205.201.16/29 -j DROP
iptables -I INPUT -s 140.205.201.32/28 -j DROP
iptables -I INPUT -s 140.205.225.192/29 -j DROP
iptables -I INPUT -s 140.205.225.200/30 -j DROP
iptables -I INPUT -s 140.205.225.184/29 -j DROP
iptables -I INPUT -s 140.205.225.183/32 -j DROP
iptables -I INPUT -s 140.205.225.206/32 -j DROP
iptables -I INPUT -s 140.205.225.205/32 -j DROP
iptables -I INPUT -s 140.205.225.195/32 -j DROP
iptables -I INPUT -s 140.205.225.204/32 -j DROP

FAQ
删除文件提示Operation not permitted的处理办法
普通用户有权限,可能进程服务占用了文件或目录,可以执行下面命令

lsof +D [文件路径]
kill -9 [pid]

普通用户且缺乏权限的话,如果要删除该文件夹则要借助su或者sudo命令来删除

如果是root用户,依然报上面的错的话,则该档案很可能被锁定

lsattr [文件]
chattr -i [文件]

注意:i属性chattr命令并不适合所有的目录
————————————————

 

 

【chrome】Chrome已保存的密码突然丢失保存提示密码未保存解决办法

问题

1.已经保存的密码突然在密码管理器里bujianle

2.再次提示保存,却没有保存

解决方法:

查看自己谷歌浏览器文件所在路径,访问地址chrome://version/

删除以下两个文件Login Data,Login Data-journal

 

退出chrome ,再次打开chrome浏览器,查看下密码管理页面,惊喜发现你的密码全都回来了!

【NGINX】nginx请求视频或者静态资源无法播放问题

原因:Nginx缓存导致无法在线播放

node项目在用Nginx反代后,发现直接访问内网地址可以在线播放mp4,但走Nginx后mp4就只能缓冲完毕后播放。

刚开始以为是新装的Nginx没有在编译时带上 –with-http_flv_module –with-http_mp4_module,但后来发现不是,最终发现是宝塔默认开启了proxy_cache cache_one; 将proxy_cache 设为off后问题解决。

location /
{
    proxy_pass http://127.0.0.1:3030;
    proxy_set_header Host 127.0.0.1;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;
    # proxy_hide_header Upgrade;
    proxy_cache off;
    add_header X-Cache $upstream_cache_status;

    #Set Nginx Cache
    
    
    
    set $static_file31ND2yGy 0;
    if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
    {
    	set $static_file31ND2yGy 1;
    	expires 1m;
        }
    if ( $static_file31ND2yGy = 0 )
    {
    add_header Cache-Control no-cache;
    }
}

 

 

另:proxy_buffers也建议关闭。
———————————–
Nginx缓存导致无法在线播放

 

【Java】配置文件Referenced file contains errors 解决方法

在Spring加载时,一些xml配置文件经常会出现Referenced file contains errors 的错误,下面介绍常用的一个解决方法。

出现这种错误可能是因为之前使用的spring的版本和现在的不同,对于eclipse编译器来说会有个缓存,解决方法是Preferences -> General -> Network Connections -> Cache 删除里面的缓存,然后在出现错误的配置文件中随便改个换行或者是加个空格保存,eclipse自动更新下就好啦!

 

 

 

【CSS】CSS点击input输入框后提示文字上移并缩小(可直接套用)

css实现一下点击input输入框后提示文字上移并缩小,这种表单美化挺常见的,效果如图:



代码如下:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"content="width=device-width, initial-scale=1">
    <title></title>

    <style>
    .box{
        width: 500px;
        position: relative;
        margin-top: 50px;
    }
    .box input{
        outline: none;
        border: none;
        width: 100%;
        padding: 10px 0;
        color: #000;
        font-size: 16px;
        border-bottom: 1px solid red;
        background: none;
    }
    .box label{
        position: absolute;
        top: 0;
        left: 0;
        color: #000;
        font-size: 16px;
        pointer-events: none;
        transition: all 0.5s;
        line-height: 38px;
    }
    .box input:focus + label,
    .box input:valid + label{
        font-size: 12px;
        top: -20px;
        color: red;
    }
    </style>
</head>
    <body>
    <div class="box">
        <input type=""name=""id=""value=""required="required"/>
        <label>name</label>
    </div>
</body>
</html>

 

【git】git拉取问题There is no tracking information for the current branch.

有时候新创建的分支执行
git pull
会出现:

$ git pull 

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> b

直接执行:
git branch --set-upstream-to=origin/远程分支的名字

例子:
假如当前在本地分支c
要和远程分支a建立跟踪信息;
执行:
git branch --set-upstream-to=origin/a

【Tomcat】Tomcat无法登陆,在服务端Manager App无法打开报403错误

Manager App无法打开或登陆,主要有2个原因

1. 在tomcat安装目录下的/conf/tomcat-users.xml里面要做如下配置如:

 <role rolename="manager-gui"/>
 <role rolename="admin-gui"/>
 <user username="test" password="123456" roles="manager-gui,admin-gui"/>

2. 在tomcat安装目录下的/webapps/manager/META-INF/context.xml
配置有问题,因为只允许本机访问所以其他人无法访问,只需加入本机ip即可或注释掉就行

下面为了方便就直接屏蔽了第一行的Value标签就行:

<Context antiResourceLocking="false" privileged="true" >
 <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />  -->
  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>

 

【maven】Eclipse或idea报错 No compiler is provided in this environment. Perhaps you are running on a JRE

这是在用外部命令打包的时候出现的问题,期间尝试了去改jdk版本,依旧不管用,这是重点是问题,那就是用的jdk,和运行环境要统一,这里指的是安装的时候jdk的时候可能会安装一个jre,但是那个运行环境与所安装的jdk在maven这里也不认为是相同的.

*所以要用的运行环境就是与bin所在同一目录下的jre.

这个要怎么设置到maven中呢?

看到图中的目录了吗?
就是maven安装目录下的bin中的mvn.cmd文件中在第一行加一行代码就可以了

set JAVA_HOME=D:\Java\jdk1.8.0_201