修改配置文件
vi /etc/ssh/sshd_config
修改以下两行
PasswordAuthentication no ChallengeResponseAuthentication no
重启ssh服务
CentOS 7
systemctl restart sshd.service
Debain
/etc/init.d/ssh restart
其他
service sshd restart
测试
用一台不带信任key的机器尝试登录,那么会提示如下信息。
Permission denied(publickey,gssapi-keyex,gssapi-with-mic)