一旦你已经测试并且验证了你的公钥可以登录,就可以取消密码登录,这样你的远程服务器就不会被暴国密码攻击。如下设置你的远程服务器的/etc/sshd_config文件:
[[email protected]86 .ssh]# grep PasswordAuthentication /etc/ssh/sshd_config #PasswordAuthentication yes PasswordAuthentication no
然后重启一下sshd服务:
[[email protected]86 .ssh]# /etc/init.d/sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ]
验证主机无法用密码登录:
[[email protected] ~]# ssh -p22022 124.97.36.27 Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
时间: 2024-10-08 10:19:15