为了安全性,启用密钥登录之后,最好关闭服务器的密码登录。
对于 OpenSSH,具体方法就是打开服务器 sshd 的配置文件/etc/ssh/sshd_config,将PasswordAuthentication这一项设为no。
/etc/ssh/sshd_config
PasswordAuthentication
no
PasswordAuthentication no
修改配置文件以后,不要忘了重新启动 sshd,否则不会生效。
← ssh-add命令 SSH 服务器→