vim /etc/ssh/sshd_config
Find the following two lines:
#ClientAliveInterval 0
#ClientAliveCountMax 3
Remove the comment and change to:
ClientAliveInterval 30
ClientAliveCountMax 1800
These two lines mean:
1. How many seconds does the client send a heartbeat data to the service
? 2. How many seconds the client does not respond, the server automatically disconnects the connection
Restart the SSHD service
service sshd restart