Persistent SSH sessions
Mukund Sivaraman
muks at banu.com
Tue Aug 3 02:33:36 EST 2010
Hi all
I have an ADSL modem which reboots when there is a power cut and the
inverter (UPS) kicks in. Internet access is down for a duration of 1
to 2 minutes while the modem boots.
I have many SSH tunnels and shells active. Due to the default
"TCPKeepAlive On" setting, these sessions are terminated almost
immediately.
I tried the following configuration:
sshd_config on server:
TCPKeepAlive no
ClientAliveInterval 90
ClientAliveCountMax 6
~/.ssh/config:
Host *
Protocol 2
Compression yes
TCPKeepAlive no
ServerAliveInterval 90
ServerAliveCountMax 6
But I guess the ssh client doesn't try to re-establish the session for
the ServerAlive messages to work. The shells remain blocked after the
modem reboots, and after approximately 90*6 seconds, ssh aborts
complaining of timeout with the remote server.
I want to know if there is any way I can get ssh to try to renegotiate
the active sessions to remote servers, without disconnecting them.
Note: Please don't bother suggesting workarounds such as the use of
screen, autossh, etc. I am looking for a specific answer about how to
keep a session alive, or the impossibility of doing that. For example,
autossh restarts ssh. I want existing sessions to continue as if
nothing happened, as long as net access is not down for longer than
some timeout.
FWIW, I'm using OpenSSH_5.4p1, OpenSSL 1.0.0a-fips 1 Jun 2010.
Mukund
More information about the openssh-unix-dev
mailing list