還是第一次出現這個問題。
使用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