Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using tmux + PuTTY to get all the UNIX goodness I need when using Windows. I have the following settings in my .tmux.conf:

set-option -g lock-command vlock
set-option -g lock-after-time 1800

As expected, after 30 minutes, my screen goes to this:

This TTY is now locked.  
Please press [ENTER] to unlock.

And then it all goes wrong... after awhile PuTTY gives me the follow error: Server unexpectedly closed network connection

enter image description here

Any thoughts on why I'm getting disconnected from SSH?

share|improve this question
How long is "awhile"? Does it happen if you don't use vlock? I'm just guessing that the connection is timing out somehow. Maybe try some of the suggestions here: staff.ask.sydney.edu.au/app/answers/detail/a_id/614/~/… – depquid Apr 2 '13 at 20:41
Good call there @depquid, that seemed to do the trick. Would you like to write up an answer since you pointed me in the right direction? – Jeff Bridgman Apr 5 '13 at 12:58
It'd be better if you wrote up exactly what fixed the problem for you; all I did was 2 minutes of Google and pasted a link. :-) – depquid Apr 5 '13 at 16:43
up vote 1 down vote accepted

As suggested in the link provided by @depquid, changing connection timeout settings in PuTTY did the trick.

PuTTY settings screenshot

  1. Go to the Connection section of PuTTY's configuration screen
  2. Check Enable TCP keepalives (SO_KEEPALIVE option)
  3. In the Sending of null packets to keep session active, change the value for Seconds between keepalives to something other than zero. I had originally tried 1800 (30 minutes), but that ended up being too high. I'm doing 60 seconds now which might be overkill, but it's done the trick for me.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.