If you are experiencing ssh connection timeout to your VPS if there’s no input after a few minutes, the following tips will help you keep your connection alive.
Method 1 (from client)
This method is the way to go if you have no administrator access to the server you are connecting to.
Edit file ‘
/etc/ssh/ssh_config‘ and set ‘
ServerAliveInterval‘ option to the following:
Just create the file ‘
~/.ssh/config‘ and add the following:
Host * ServerAliveInterval 120
This option is to tell your SSH client to automatically send the keep alive message every 100 seconds to the SSH server.
Method 2 (from server)
If you have administrator access to the server, you can edit file ‘
/etc/ssh/sshd_config‘ and set following options like so:
ClientAliveInterval 30 TCPKeepAlive yes ClientAliveCountMax 99999
Restart the SSH server for the changes to take effect.
service sshd restart