通过Auth.log来查看VPS服务器是否被扫描和暴力破解

说明:很多人vps可能出现过被扫的情况,有的还被爆破了,这里提供下查看方法查看用密码登陆成功的IP地址及次数grep "Accepted password for root"...

bysem (19)

说明:很多人vps可能出现过被扫的情况,有的还被爆破了,这里提供下查看方法
查看用密码登陆成功的IP地址及次数

grep "Accepted password for root" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr | more

查看用密码登陆失败的IP地址及次数

grep "Failed password for root" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr | more

更改默认端口

sed -i "s/Port .*/Port 你的端口/g" /etc/ssh/sshd_config

更改后重启ssh

/etc/init.d/sshd restart #centos系统
/etc/init.d/ssh restart #debian,ubuntu系统
0 I like it
0 I don't like it

Leave a Reply

Your email address will not be published. Required fields are marked *