It happens that my SSH connections die after a period of inactivity. Sometimes after very long time, but sometimes quite quickly. I do not know if it has to do with routers, proxies, TCP/IP or the SSH server configuration, but I have found a remedy.
ssh -o ServerAliveInterval=10 ...your normal options
Note, this does not recover a connection lost due to network problems – it just makes sure the connection stays alive, even if you dont use it for a while. There are other tools (Autossh, I think) to make ssh reconnect.
This option is especially useful in combination with the -D flag; that is, when you use SSH as a SOCKS proxy. Then you typically do not use the remote console itself, just the tunnel that comes with it.
0 Comments.