取消密码登录

一旦你已经测试并且验证了你的公钥可以登录,就可以取消密码登录,这样你的远程服务器就不会被暴国密码攻击。如下设置你的远程服务器的/etc/sshd_config文件:

[root@86 .ssh]# grep PasswordAuthentication /etc/ssh/sshd_config
#PasswordAuthentication yes
PasswordAuthentication no

然后重启一下sshd服务:

[root@86 .ssh]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

验证主机无法用密码登录:

[root@ok ~]# ssh -p22022 124.97.36.27
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
原文地址:https://www.cnblogs.com/bass6/p/6358083.html