OpenSSH with "resumable" functionality

Chris Wilson chris at
Mon Apr 19 17:35:33 EST 2010

Hi Misha,

On Sun, 18 Apr 2010, Misha Koshelev wrote:

> I was wondering if it might at all be possible to have the following functionality in OpenSSH:
> (i) upon "timeout" of connection (say 2-5 seconds) disconnect
> (ii) keep trying to reconnect
> (iii) upon reconnection, resume session exactly where started
> However, I am confused as to (i).

It might reduce the confusion (yours and ours) if you defined exactly what 
you mean by "timeout"?

If you mean "packet sent with no response from the remote side", you can 
do that (or something similar) with the TCPKeepAlive or 
ServerAliveInterval options to the client.

You can do (ii) by wrapping the ssh command in a shell loop:

while ! ssh user at host -o 'ServerAliveInterval 5' screen -d -RR;
do true; done

Cheers, Chris.
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |

More information about the openssh-unix-dev mailing list