ssh無法通過信任關係登陸

發現一臺機器雖然建立了信任關係,但是仍然無法通過信任關係登陸,檢查了很多地方。。。。
1、~/.ssh 目錄權限
2、~/.ssh/裏面文件的權限
3、重新在客戶端生成了公鑰,傳到該服務器端,仍無法信任關係登陸
4、檢查了/etc/ssh/sshd_config 文件的內容
5、差點要重啓sshd(怕影響別人,未遂)
6、baidu search
等等都沒有結果
-------------------------------------------華麗的解決-------------------------------------------
突然去看了下 /var/log/secure 日誌,哇,終於找到了原因,原來是用戶的主目錄權限不符合要求,chmod之後OK


/var/log/secure 日誌:

Authentication refused: bad ownership or modes for directory /home/git/.ssh


 想來應該是文件夾讀寫權限的設置問題.在Google之後,找到下面這個web,與所遇問題是類似的:

      SSH Authentication Refused: Bad Ownership or Modes for Directory

      下面轉貼來自其中的一段內容:

SSH doesn’t like it if your home or ~/.ssh directories have group write permissions. Your home directory should be writable only by you, ~/.ssh should be 700, and authorized_keys should be 600


You can also get around this by adding StrictModes off to your ssh_config file, but I’d advise against it - fixing permissions is the way to go.


------------------------------------------- end --------------------------------------------------

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章