1.连接主机修改sshd配置文件去掉注释
vim /etc/ssh/sshd_config
ClientAliveInterval 30 #122行 多少秒检测 ClientAliveCountMax 45435 #123行 多少秒超时
重启
[root@localhost ~]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service
2.被连接主机也同样修改
vim /etc/ssh/sshd_config
ClientAliveInterval 30 #122行 多少秒检测 ClientAliveCountMax 45435 #123行 多少秒超时
重启
[root@localhost ~]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service