阿里云常见问题汇总
nginx 老是自动停止
nginx 在通过 Certbot 安装 证书后 发现每隔一段时间 nginx 都会自动停止
找了我 n 久 ,一开始以为是 shell 的问题 ,以为 shell 端口服务就停,试了几回发现不是
查看定时任务 cat /etc/crontab
0 1 * * * root sh /etc/newinit.sh >/dev/null 2>&1
💢 /etc/newinit.sh 是 TMD 什么脚本 在百度上一查居然是挖矿脚本攻击!!!!
原文连接:阿里云服务器糟挖矿程序攻击
脚本中有段这个
netstat -anp | grep :443 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
netstat -anp | grep :23 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
netstat -anp | grep :443 | awk '{print $7}' | awk -F'[/]' '{print $1}' | grep -v "-" | xargs -I % kill -9 %
居然 把我 443 端口对应的进程 kill 掉了 ,我*** !!!!💢
解决:一定要把脚本干掉 rm -rf /etc/newinit.sh 同时去除/etc/crontab 的定时任务 再次 netstat -tnlp ,世界清净了
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      396237/nginx: worke
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      423/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      545/sshd: /usr/sbin
tcp        0      0 127.0.0.1:33305         0.0.0.0:*               LISTEN      665587/node
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      396237/nginx: worke
tcp6       0      0 :::3000                 :::*                    LISTEN      2300247/node /root/
tcp6       0      0 :::3001                 :::*                    LISTEN      2365081/node /root/
找了 我好长时间!!!一定要记录一下