SSH connection to Linux without disconnection for a long time

Modify the /etc/ssh/sshd_config file, find ClientAliveInterval 0 and ClientAliveCountMax 3 and remove the comment symbol ("#"),
change the 0 corresponding to ClientAliveInterval to 60,
ClientAliveInterval specifies the time interval for the server to request messages from the client, the default If it is 0, do not send.
ClientAliveInterval 60 means send once every minute, and then the client responds, so the connection is maintained.
ClientAliveCountMax, the default value of 3 can be used. ClientAliveCountMax means that the number of times the client does not respond after the server sends a request reaches a certain value , it will automatically disconnect. Under normal circumstances, the client will not fail to respond.

Restart the sshd service:

service sshd restart

Guess you like

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