修改服务器端参数
修改服务器端的ssh设置:找到
1 | cd /etc/ssh |
添加如下设置:
1 | ClientAliveInterval 60 |
该设置意为服务器会每60秒向client发送一次保持连接的信号。如果还要定时断开连接:
1 | ClientAliveCountMax 60 |
修改客户端参数
与修改服务器参数类似,只不过需要修改的文件为ssh_config
。
使用ssh登陆前用参数配置
1 | ssh -o ServerAliveInterval=30 root@192.168.1.1 |