connection closed by foreign host

用 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 设置允许超时的次数 , 上面设置的是允许三次 , 之后就关闭连接 ;

posted @ 2019-11-28 11:08  男神之路  阅读(9675)  评论(0)    收藏  举报
Live2D