OpenSSH with "resumable" functionality

Chris Wilson chris at
Mon Apr 19 22:30:23 EST 2010

Hi Misha,

On Mon, 19 Apr 2010, Misha Koshelev wrote:
> Chris Wilson wrote:
>> 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).
>> 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
> Not sure this will work with my intended application (NoMachine NX). 
> Will have to think about it...

You need to stop the NX server, clients and intermediate TCP connections 
from dying.

If you have such an unreliable network, NX may not be the best choice. VNC 
allows you to keep the server running even with no clients connected, and 
clients can connect and resume sessions at any time. It's therefore a much 
better choice over highly unreliable networks in my view.

If you must use NX, I'd suggest running it over a VPN (perhaps over SSH) 
so that clients are not killed when the session goes down. However they 
will suffer packet loss and need time to recover from it, and they will 
probably eventually time out anyway if the network goes down for long.

> Also right now get..
> Must be connected to a terminal.
> Any ideas?

Sorry, I don't have any idea what that means.

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