生成秘钥:
ssh-keygen
发送到需要免密登录的机器:
ssh-copy-id node2
登录:
ssh node2
执行登录命令,总是需要输入密码。
查看日志发现,标有sshd的日志记录。
#cat /var/log/secure
Sep 10 11:09:09 localhost sshd[22432]: Authentication refused: bad ownership or modes for directory /root
解决方案:
chmod 0750 /root -R
参考:
https://blog.csdn.net/weixin_34124939/article/details/89827019