Before the company encountered this problem, the use of SSH login to the Linux server, in the background for a period of time, you will find the automatic disconnection, the solution is simple:
Vim/etc/ssh/ssh_config
Add these 2 sentences to
Serveralivecountmax 3
Serveraliveinterval 5
1.ServerAliveCountMax 3 indicates that the client does not respond to a certain number of times after the server makes a request and disconnects automatically. Normally, the client does not respond.
2.SerAliveInterval 0: Specifies the server-side time interval for requesting messages from clients, which is 0 by default, not sent,
and serveraliveinterval 5: indicates that every 5 seconds is sent to the server, which keeps the connection long
3./etc/ssh/directory In addition to Ssh_config, there is a sshd_config, the difference is that the former is for the client configuration file, the latter is for the server side of the file, because we are as clients to remote connection to other servers, so modify Ssh_ Config file is good.
Solve the problem of automatic disconnection of SSH idle for some time under Mac