修改配置文件
vi /etc/ssh/sshd_config
增加
ClientAliveInterval 60 #every 60s send requirement message to client,wait response
ClientAliveCountMax 10 #auto disconnect when client dont response more than ten times
然后重启ssh服务
root@MDaliyun ~ # systemctl restart sshd
root@MDaliyun ~ # systemctl status sshd