ssh_exchange_identification: Connection closed by remote host

我从A到B建了个ssh反向隧道,昨天忽然不好用了,一登陆就提示ssh_exchange_identification:Connectionclosedbyremotehost经过测试A上的sshd没有问题,hosts.allow和hosts.deny也没问题。后来无意中发现我在A上用sshlocalhost失败,ssh127.0.0.1可以检查/etc/hosts文件,发现127.0.0.1localhost.localdomainlocalhost这一行被改了添加这一行之后解决了问题。 问题原因是我建隧道的命令是ssh-R<remote_port>:localhost:22<user>@<serverB>vmstat30因为A无法解析localhost,所以隧道建上了,但是连接的时候失败,因为找不到localhost 最好把建隧道的命令中localhost改为127.0.0.1,减少对环境的依赖。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注