参考: https://www.cnblogs.com/chloneda/p/ssh-connect.html
server端:
vim /etc/ssh/ssh_config
增加下面2行
ServerAliveInterval 10
ServerAliveCountMax 999
即可。 (10秒钟心跳一次)
sudo service ssh restart
client端:
vim /~/.ssh/config
Host *
ServerAliveInterval 60
ServerAliveCountMax 3