xshell-ssh连接服务器意外中断(Disconnected from remote host)

还是第一次出现这个问题。

使用last命令

root     pts/3        112.41.50.242    Mon Jan 15 08:22   still logged in
root     pts/2        112.41.50.242    Mon Jan 15 08:16   still logged in
root     pts/1        112.41.50.242    Mon Jan 15 08:14   still logged in
root     pts/3        112.41.50.209    Sat Jan 13 23:43 - 00:45 (1+01:02)
root     pts/2        112.41.50.209    Sat Jan 13 23:41 - 00:45 (1+01:04)
root     pts/1        112.41.50.209    Sat Jan 13 23:39 - 00:45 (1+01:06)

有可能是网络ip地址变化导致xshell自动断开连接,修改本机ip为固定地址即可。

还可能是本机网络dns变化导致xshell自动断开连接,修改ssh配置文件将其中“UseDNS yes”去掉注释并改成no即可,过程如下。

vim /etc/ssh/sshd_config
...
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
...

重启系统即可。

参考

http://blog.csdn.net/iamoldpan/article/details/77595624

http://blog.csdn.net/baidu_19473529/article/details/52870244

 

posted @ 2018-01-15 11:18  深圳地铁Princess  阅读(8662)  评论(0)    收藏  举报