ssh無法遠程登錄怎麼解決?問題現象:serverA機器已經生産rsa密鑰,下面我們就來聊聊關于ssh無法遠程登錄怎麼解決?接下來我們就一起去了解一下吧!
問題現象:
serverA機器已經生産rsa密鑰
且已經将public key添加到serverB機器/root/.ssh/authorized_keys
但是ssh [email protected]機器時仍然需要輸入密碼,即無密碼認證失敗
分析與處理:
用ssh -v debug訪問,日志如下,但是從日志看不到失敗原因,隻知道在用publickey認證時,對端沒有reply;
此時百度時,有文章提到可以查看/var/log/secure日志
通過查看serverB機器/var/log/secure,發現報錯如下
Jan 8 13:31:34 wng-141 sshd[32366]: Authentication refused: bad ownership or modes for directory /root
Jan 8 13:31:34 wng-141 sshd[32367]: Connection closed by 135.251.218.231
由此日志,可以是/root目錄的權限不對,再百度搜索"Authentication refused: bad ownership or modes for directory /root"
發現所有用戶的HOME目錄應該是700權限,否則會引起很多問題,這個問題同樣是由于這個原因
最終,執行chmod 700 root後解決
[root@wng-231 ~]# /usr/bin/ssh -vvv -i /opt/aware/Central/.sshkey/id_rsa -oConnectTimeout=1 -o StrictHostKeyChecking=no -o PasswordAuthentication=no [email protected]
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 135.251.208.141 [135.251.208.141] port 22.
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!