Keep ssh alive

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

Due to our load-balancing router being a little “harsh” on closing connections that appear to be unused, ssh often sits and hangs.

Using a standard ssh config option though we can set a server keep-alive (on the ssh client, which also keeps sshfs alive)

In the “~/.ssh/config” file, simply adding the following keeps the connection sending a small packet every 30 seconds :- ServerAliveInterval=30

I’m sure windows clients like puTTY also have a similar option, and on a mac, it should be the same file as Linux.

Tags: ubuntulinuxproblemserverbash