I've been having problems with my GNOME terminal hanging when on an extended SSH connection. Finally realized today there's probably a keepalive configuration somewhere.
There is.
Go into your ~/.ssh/config file and add this stanza under your Host config:
ServerAliveInterval 240
(note the two spaces to make it a sub-property of Host)
If you want every SSH connection to stay alive, add the rule for every host
Host *
ServerAliveInterval 240
FAQ
- Why isn't this the default?
Really? You're using a Linux environment and you're asking why the default isn't "Don't just break?"😉