vps安全相关
sudo grep "Failed password for root" /var/log/secure | awk '{print $11}' | sort | uniq -c | sort -nr修改ssh端口
不要使用简单密码
禁止使用密码登陆,使用RSA私钥登陆
# vi /etc/ssh/sshd_config
RSAAuthentication yes #RSA认证
PubkeyAuthentication yes #开启公钥验证
AuthorizedKeysFile .ssh/authorized_keys #验证文件路径
PasswordAuthentication no #禁止密码认证
PermitEmptyPasswords no #禁止空密码
# 最后保存,重启
/etc/init.d/sshd restart禁止root用户登录
使用denyhosts
在CentOs7安装denyhosts
修改安装配置
启动Denyhosts
设置开机自启
修改配置项
解除已禁止的主机ip
Last updated