Solve the Problem of automatic SSH disconnection
When you connect to the remote SSH service, frequent disconnection occurs after a long time, or no response (no keyboard input is allowed ).
In general, there are two methods:
1. periodically send heartbeat requests depending on the ssh client.
Putty, SecureCRT, and XShell all have this function, but they are not safe.
In addition, in Linux:
# Open
Sudo vim/etc/ssh/ssh_config
# Add
ServerAliveInterval 20
ServerAliveCountMax 999
That is, a heartbeat is sent to the server every 20 seconds. If more than 999 requests are not sent successfully, the connection to the server is automatically disconnected.
2. the more permanent way is to change the server end, that is, on the remote end of ssh.
# Open
Sudo vim/etc/ssh/sshd_config
# Add
ClientAliveInterval 30
ClientAliveCountMax 6
ClientAliveInterval indicates the number of seconds each other. The server sends a heartbeat message to the client.
The following ClientAliveInterval indicates the number of Heartbeat requests that have no response, and the Client is considered disconnected.
Therefore, the total time allowed for no response is 60*3 = 180 seconds.
Effective Test
SSH service remote access to Linux Server login is slow
How to Improve the SSH login authentication speed of Ubuntu
Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04
How to add dual authentication for SSH in Linux
Configure the SFTP environment for non-SSH users in Linux
Configure and manage the SSH service on Linux
Basic SSH tutorial
SSH password-free logon details
This article permanently updates the link address: