Many home routers tend to have default settings that close idle connections after a period of time. Normally this interval is 5 minutes. For general home use, that's fine, but as a web worker with many ssh sessions open, it can be maddening to receive the dreaded
Connection to server closed.
when you were in the middle of editing a file or comparing settings.
One solution is to use the
GNU screen app for all of your work. However, this doesn't solve the problem of dropped connections due to inactivity.
Instead, you can nip the problem in the bud with a couple of tweaks to your
sshd_config. On Red Hat and derivative systems, edit
/etc/ssh/sshd_config and add the following lines:
TCPKeepAlive yes
ClientAliveInterval 60
Save the file, restart sshd, and you'll never want to smash your terminal again.