Keep SSH Sessions Alive¶
In some servers that I access through SSH, I keep having my SSH sessions get dropped after being idle for some time.
A straightforward fix for this is to enable SSH keepalives. You can set this through SSH's
Set keepalive through SSH command line option¶
ssh -o "ServerAliveInterval 60" firstname.lastname@example.org
This command will set the
ServerAliveInterval option to 60 seconds for the SSH session.
Set keepalive for all SSH sessions¶
To set a keepalive value for all your SSH sessions, you can add the following in your system's
/etc/ssh/ssh_config file or your user's
Set keepalive for PuTTY¶
For PuTTY, you can set the following:
- In PuTTY's configuration window, go to the
Seconds between keepalivesto your desired value.
You can check
ssh_config's manual page for more information on other SSH client configuration.