connection closed by foreign host

…衆ロ難τιáo~ 提交于 2019-12-05 22:26:19

用 Xshell 连接服务器总是报错 :

Connection closed by foreign host.
Disconnected from remote host...
1
2
原因可能是 SSH 服务器没设置保活时间间隔 , 具体设置如下 :

# vim /etc/ssh/sshd_config
1
添加两行 , 或去掉注释 :

ClientAliveInterval 60
ClientAliveCountMax 3
1
2
重启 SSH 服务 :

# /etc/init.d/ssh restart
# systemctl restart sshd
1
2
ClientAliveInterval 参数数值是秒 , 是指超时时间 , 上面设置的是一分钟 ;
ClientAliveCountMax 设置允许超时的次数 , 上面设置的是允许三次 , 之后就关闭连接 ;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!