解决Linux SSH终端自动断开的烦恼。
操作起来
很简单,就是客户端在/etc/ssh/ssh_config中配置如下属性:
# 顶格写
ServerAliveInterval 30
ServerAliveCountMax 3
客户端会在终端无操作之后 ServerAliveInterval 秒时请求服务器要求服务器响应,如果服务器在 ServerAliveCountMax 次之后都没有响应,则断开连接并退出。
还可以在连接服务器是加入参数实现同样的效果,如:
ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3 user@host