Stop ssh Terminal Sessions Hanging
On some Linuxen, when you ssh to another server, after a timeout it drops the connection. That terminal session is now frozen. There are at least three solutions to this: When your terminal freezes, you can get out of it by typing, one by one: [Enter] then [ ~ ] then [ . ] . This will bring you back to the terminal session where you executed the initial ssh . Create or open ~/.ssh/config . For the host(s) your dealing with, in their sections, add a line ServerAliveInterval 240 indented by two spaces (or inline with the othe entries) something like: Host remotehost HostName remotehost.com ServerAliveInterval 240 or, if you wish this to apply to all hosts: Host * ServerAliveInterval 240 If it's not the default, make sure ~/.ssh/config is readable by all by doing $ chmod a+r ~/.ssh/config Instead of trying to keep the connection alive you can use terminal multiplexors, like screen (or tmux ) that keep the session alive in the background e...