2 configuration methods to solve SSH connection timeout

Even my own VPS is often disconnected. It feels very annoying after a long time. The following are two solutions.
method one:

1. Set the frequency and time that the server sends to the SSH client connection session

. code show as below:
#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 seconds to disconnect from the ssh client
2. Restart the system SSH service
. code show as below:
#service sshd restart 

 

Method Two:

Use the command to directly modify the configuration file by the user, and set "TMOUT=180", that is, the timeout period is 3 minutes

. code show as below:
#vim /etc/profile Add the following two lines #Set
to 3 minutes
TMOUT=180

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174335&siteId=291194637