Prevent sleep during ssh session

Chris G cl at isbd.net
Mon Aug 24 13:02:11 UTC 2009


On Mon, Aug 24, 2009 at 01:51:59PM +0100, Chris Jones wrote:
> Hi,
> 
> > Are we sure (OP?) that the OP means that the remote *machine* is going
> > to sleep.  A much more common problem with ssh is that the
> > *connection* dies after inactivity.
> 
> Indeed. I assumed that the OP was correct in that it was the remote 
> machine sleeping and not this, but that was an assumption, and you know 
> what they say about that...
> 
> If it is this then it is easy to fix with by adding the KeepAlive ssh 
> option E.g.
> 
> http://embraceubuntu.com/2006/02/03/keeping-ssh-sessions-alive/
> 
> note that the above suggests editing /etc/ssh/ssh_config on the local 
> machine, which requires sudo rights. However, it is also possible for 
> any user to place the options in their private ~/.ssh/config file.
> 
In my experience this doesn't always work, I used to connect from work
to home and vice versa using ssh and the keep alive option din't keep
those sessions connected.  I ended up with a trivial program running in
the background that sent NUL characters at five minute intervals.

I think in my case it may have been some firewall/router timeout that
was disconnecting the idle connections.

-- 
Chris Green





More information about the ubuntu-users mailing list