SSH加固
文章目录
修改/etc/pam.d/common-auth文件,加上
1 | auth required pam_tally2.so deny=3 unlock_time=60 even_deny_root root_unlock_time=60 |
重启ssh
或者,注意是或者,上面的方法感觉很容易把ssh弄的崩掉
配置私钥(用户home目录下)
1 | ssh-keygen |
编辑 /etc/ssh/sshd_config 文件
1 | RSAAuthentication yes |
另外,留意 root 用户能否通过 SSH 登录
1 | PermitRootLogin yes |
密钥登录成功之后,再禁掉密码登录
1 | PasswordAuthentication no |
最后重启ssh