情景描述:
開發同事報告使用某普通用戶test沒法遠程登錄一臺,報錯「shell request failed on channel 0」。
解決過程
html
2018/02/26
今天,在作jenkins的時候ssh到另外一臺Linux機器失敗!報錯以下git
[root@Dasoncheng ~]# ssh root@192.168.60.12 root@192.168.60.12's password: ##我已經把公鑰放在服務端了,仍是讓我輸入密碼;我就重啓了一下服務端 結果: [root@Dasoncheng ~]# ssh root@192.168.60.12 ssh_exchange_identification: read: Connection reset by peer ##等待了一會 結果報上面的錯誤。我就百度了
解決方法:shell
[root@Dasoncheng2 var]# cd /var/ [root@Dasoncheng2 var]# chmod -R 755 *
繼續百度,又跑到一個歪果仁的網站上,在一個不起眼論壇的一個不起眼的帖子中一個不起眼的跟帖中,一個哥們很低調的說了句「I know this quesiton is old , but I wanted to share some findings I had,Check if /var/empty/sshd on the server has appropriate ownership and permissions. We had a chef script that was modifile toupdate some directory peimisions,but indavertently updated the diectory below the intended target,chaning ownership of /var to an applicaton user/group and changing the permissons to 755." 去/var下看了看,果真權限很大,都是777,cd 到 empty 目錄,果真有ssh這個文件夾,在cd進去,啥也沒有了。因而直接執行兩條命令: cd /var chmod -R 755 * 而後就再次嘗試了遠程鏈接了下,居然ok了。
原文連接:http://blog.csdn.net/x6_9x/article/details/49983607
一個很是棒的ssh登陸失敗 排錯經驗:https://www.cnblogs.com/starof/p/4709805.htmlbash