1

I use a windows laptop and ssh via Cygwin into an ubuntu desktop to do some work. However, if I leave my Cygwin session on and my laptop goes to sleep overnight, it gets disconnected with the following message:

client_loop: send disconnect: Connection reset by peer

I've tried setting both the server and client side's ServerAliveInterval/ClientAliveInterval/etc parameters but none of that seems to work. Is there a way for my ssh to stay alive while my laptop sleeps or is that an oxymoron?

1 Answer 1

2

When your computer is asleep, nothing runs on it, so your SSH client can’t do anything to keep the connection alive.

You could try to configure it so that it doesn’t notice when the TCP connection disappears, but that would ultimately be counter-productive since the TCP connection would drop anyway. You might find Mosh interesting: it will transparently reconnect when your laptop wakes up.

If you don’t mind having to reconnect manually, but care specifically about finding your server session as you left it, you could use a multiplexer such as screen or tmux too. When the connection drops, you can then connect to the server again, reconnect your screen/tmux session, and continue as if nothing had happened.

1
  • Or perhaps looking into tools like screen on the remote machine could be a good idea, as that makes the reconnection painless in that you can continue working in the original remote session.
    – TooTea
    Dec 11, 2020 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .