Skip to content


ssh攻击的发现以及预防

“HACKER” 利用 ssh攻击的目的是想暴力破解服务器的密码,然后控制你的服务器。通常可以从以下两种方式发现:
1. 假如你的服务器突然间一直ssh连接失败,但多次尝试,偶尔还能连接上.
2. 系统日志里面有大量的验证失败的ssh连接请求.
ubuntu系统是在/var/logs/auth.log里面.

如何进行简单预防:
1.禁用root帐号访问ssh
做法:只要在/etc/ssh/sshd_config : PermitRootLogin no
2.RSA公钥认证:
做法:只要在/etc/ssh/sshd_config : PasswordAuthentication no

3.修改默认端口:
一般的攻击都只针对默认22端口.你只要修改到其它端口上就ok.
做法:只要在/etc/ssh/sshd_config :P ort 9922
注意:别让自己的防火墙把自己的ssh请求给阻挡在外(我就吃过这个亏)

4.一般以上三个方案就ok了,为了安全还可以安装denyhosts。denyhosts可以检查系统日志,检查来访失败的ip,然后把ip列入黑名单。具体请看官方文档

Posted in linux, shell, 技术.

Tagged with , .


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. 老时 says

    没人攻击我

  2. iHao says

    默认22端口的话确实很多暴力日志。。一般我只做下第3个方案,改下默认端口,这样日志就很清爽了。



Some HTML is OK

or, reply to this post via trackback.