修改 /etc/ssh/sshd_config
添加以下3句
TCPKeepAlive yes
ClientAliveInterval 60
ClientAliveCountMax 3
重启服务
service sshd restart
systemctl reload sshd