情景描述:
开发同事报告使用某普通用户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