I have gotten tired of my SSH connections timing out when connecting to my servers, so I found out how to fix it. Edit this file /etc/ssh/ssh_config in the computer you are using as a client. Then add these lines at the end:
1
2
ServerAliveInterval 15
ServerAliveCountMax 3
ServerAliveInterval – The number of seconds the client(your computer) will wait before it sends a null package to the server. Sending a null package to the server will keep the connection alive.
ServerAliveCountMax – How many times the client will try to send a message to the server if it doesn’t respond.
With the configuration above, the client will send a null package every 15 seconds. If the server doesn’t respond to one of those packages then after 15 seconds the clients will try again and then one more time. After three failures the client will disconnect.
linux
]