vim /etc/ssh/sshd_config
Locate the following two lines:
#ClientAliveInterval 0
#ClientAliveCountMax 3
Remove comment, read:
ClientAliveInterval 30
ClientAliveCountMax 1800
These two lines of meaning are as follows:
1, the client sends a heartbeat every how many seconds the data to the service
2, how many seconds do not have the client, the server automatically cut off the connection
Restart SSHD service
service sshd restart