所选用户秘钥未在远程主机上注册
最近配置key登录centos的时候报这个错误,公钥私钥都是对的
第一步查看系统错误日志
tail -f /var/log/secure
结果如下
Dec 26 04:48:45 localhost sshd[82282]: Authentication refused: bad ownership or modes for directory /home/leisiyuan Dec 26 04:48:49 localhost sshd[82282]: error: Received disconnect from 118.116.94.114: 0: [preauth] Dec 26 04:49:10 localhost sshd[82329]: Received disconnect from 223.111.139.247: 11: [preauth]
可以看到错误上面的第一行就是目录权限不对
直接设置目录权限
chmod 755 /home/leisiyuan/
再登录就没有报错,成功登录了