When connecting to a remote SSH service, there is often a long disconnect or no response (no keyboard input).
Overall, there are two ways:
1. Rely on the SSH client to send the heartbeat regularly.
Putty, SECURECRT, Xshell have this function, but are not insured.
In addition under Linux:
#打开
sudo vim/etc/ssh/ssh_config
# add
Serveraliveinterval 20
Serveralivecountmax 999
That is, every 20 seconds, a heartbeat is sent to the server. If more than 999 requests are not successfully sent, the connection to the server side is actively disconnected.
2, a more permanent method is: Change the server side, that is, the remote SSH.
# Open
sudo vim/etc/ssh/sshd_config
# add
Clientaliveinterval 30
Clientalivecountmax 6
Clientaliveinterval indicates how many seconds, the server sends the heartbeat to the client, yes, you read it right.
The following clientaliveinterval indicates that the client has been disconnected after the number of heartbeats that are not responding.
Therefore, the total allowable non-response time is 60*3=180 seconds.
Test effective
Solve SSH automatic disconnection problem