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):
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:
This is obviously a highly charming alternative because more often than not, you are won’t have (write) access to your server’s