生成秘鑰:
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
https://blog.csdn.net/lisongjia123/article/details/78513244