避免ssh超时断开 Posted on 2017-12-20 Edited on 2025-06-16 用ssh连接服务器经常遇到长时间不操作而被服务器踢出的情况,提示如下 Write failed: Broken pipe 方案一:客户端配置在/etc/ssh/ssh_config中添加配置 1ServerAliveInterval 60 之后,当使用ssh时每隔60s客户端都会向服务端发送一个KeepAlive请求,避免被踢 方案二:服务端配置在/etc/ssh/sshd_config中添加配置 1ClientAliveInterval 60 重启服务器后设置生效注意:这种方式每一个连接服务器的客户端都受到影响,安全性会有一定的下降