Two configuration methods to resolve the SSH connection timeout

  • 2020-05-07 20:50:20
  • OfStack

I often disconnect my VPS, which is annoying after a long time. Here are two solutions.
Method 1:

1. Set the frequency and time for the server to send to the SSH client connection session

#vi /etc/ssh/sshd_config , add the following two lines 
ClientAliveInterval 60
ClientAliveCountMax 86400

Note:
The ClientAliveInterval option defines how many seconds to send a signal to the SSH client.
The ClientAliveCountMax option defines how many more seconds to disconnect from the ssh client
2. Restart system SSH service
#service sshd restart  

Method 2:

Use the command to direct the user to modify the configuration file by setting "TMOUT=180", i.e. the timeout time is 3 minutes

#vim /etc/profile  Add the next two lines 
# Set to 3 minutes 
TMOUT=180


Related articles: