ssh無密碼登入認證失敗

guyuanli發表於2016-04-06
在ssh做無密碼的時候出現每次都輸入密碼的問題:
此時百度,發現可以檢視日誌檔案vi /var/log/secure,
發現裡面的如下錯誤:
Apr  6 10:06:49 gslave2 sshd[1770]: Received signal 15; terminating.
Apr  6 10:06:49 gslave2 sshd[12663]: Server listening on 0.0.0.0 port 22.
Apr  6 10:06:49 gslave2 sshd[12663]: Server listening on :: port 22.
Apr  6 10:07:00 gslave2 sshd[12673]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:00 gslave2 sshd[12673]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:00 gslave2 sshd[12673]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:00 gslave2 sshd[12673]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:01 gslave2 sshd[12675]: Connection closed by 192.168.1.251
Apr  6 10:07:09 gslave2 sshd[12676]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:09 gslave2 sshd[12676]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:09 gslave2 sshd[12676]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:09 gslave2 sshd[12676]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:07:24 gslave2 sshd[12678]: Connection closed by 192.168.1.251
Apr  6 10:14:47 gslave2 sshd[12754]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:47 gslave2 sshd[12754]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:47 gslave2 sshd[12754]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:47 gslave2 sshd[12754]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:51 gslave2 sshd[12754]: Accepted password for root from 192.168.1.251 port 33515 ssh2
Apr  6 10:14:51 gslave2 sshd[12754]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  6 10:14:51 gslave2 sshd[12754]: Received disconnect from 192.168.1.251: 11: disconnected by user
Apr  6 10:14:51 gslave2 sshd[12754]: pam_unix(sshd:session): session closed for user root
Apr  6 10:14:53 gslave2 sshd[12771]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:53 gslave2 sshd[12771]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:53 gslave2 sshd[12771]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:53 gslave2 sshd[12771]: Authentication refused: bad ownership or modes for directory /root
Apr  6 10:14:56 gslave2 sshd[12771]: Accepted password for root from 192.168.1.251 port 33516 ssh2
Apr  6 10:14:56 gslave2 sshd[12771]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  6 10:14:56 gslave2 sshd[12771]: Received disconnect from 192.168.1.251: 11: disconnected by user
Apr  6 10:14:56 gslave2 sshd[12771]: pam_unix(sshd:session): session closed for user root


發現root使用者的/root目錄應該是550許可權,否則會引起很多問題,這個問題同樣是由於這個原因
原來在之前修改過/root目錄的許可權
最終,執行chmod 550 root後解決


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7490392/viewspace-2075957/,如需轉載,請註明出處,否則將追究法律責任。

相關文章