For work, I often develop on a remote Linux box that I SSH into. Now, as a web developer, one of the big advantages of interpreted languages is that there are no big compile steps to wait for.

One of the big disadvantages is that nothing exciting is happening when you take a break (no sword fights, for example). The screen is just sitting there. Unfortunately, OpenSSH servers in their default settings take this silence as a perfect excuse to cut the cord after 5 minutes.

If that happens a lot during the day, this can be pretty annoying! But fear not, dear reader. On a Redhat-like system, you want to edit /etc/ssh/sshd_config and add the following line (note: only the second line is needed, read below):

TCPKeepAlive yes ClientAliveInterval 60

Restart the SSH server, and it shall henceforth not punish you for prolonged periods of silence anymore. :)

Update: Two of my readers pointed out interesting things. First, Sancus mentioned that TCPKeepAlive is different from ClientAliveInterval and serves a different purpose. To avoid your connection dropping, the latter is likely to be the better option.

Jeff says, if you set this in the ~/.ssh/config file on your client, you'll achieve the same effect without the need to modify the server settings:

Host * ServerAliveInterval 300

This is obviously a highly charming alternative because more often than not, you are won't have (write) access to your server's sshd_config.

Was this helpful? Buy me a coffee with Bitcoin! (What is this?)

Reddit's Fail-Alien (or "Fail-ien?")

Reddit's mascot stands by its side, in sickness and in health.Time for a new member of the [fail pet](/tag/failpet/) family! It's been a ...… Continue reading

SQlite error: Unable to Open Database File

Published on November 29, 2014