0

I usually leave my PuTTY terminal window open during the day and lock the screen when I go to lunch or leave to go offsite. Lately though when I come back, my ssh session had died. Even though I use the keep alive from within PuTTY and have the keep alive in the sshd_config, it still occurs.

ClientAliveInterval 30
TCPKeepAlive yes
ClientAliveCountMax 99999

And in the auth log I saw:

Jun 18 15:31:52 blarg sshd[6830]: pam_unix(sshd:session): session closed for user jonathan

I don't have a TMOUT value set in /etc/profile

Any advice is appreciated.

4
  • 1
    Do you administer the destination site? or the firewall and routers? Perhaps there is an idle timeout in that chain. I'd try contacting your site administrator.
    – mdpc
    Jun 19, 2014 at 18:44
  • Did you mean ServerAliveInterval and ServerAliveCountMax ?
    – Andrew
    Jun 19, 2014 at 18:51
  • @Andrew - I should think not. Those go in the ssh_config or the .ssh/config of the client, not the server. He's using PuTTY though so they don't apply. Jun 19, 2014 at 19:41
  • I am root on the server. The server is hosted on a virtual dedicated host. Its a mail/webserver. Jun 19, 2014 at 20:43

1 Answer 1

1

Since you're using putty there are some things you can actually do right there in the client.

Open putty and in the options panel load the session definition that you're using for that saved connection.

Under connection change the fiend "Sending null packets to keep sessions active" from 0 to something else (this is in seconds, so 1800 is 30 minutes)

Check "Enable TCP keepalives" (this isn't in old versions of putty, update if you don't have it) Save your session.

5
  • Keep alive was set to 30 seconds but the TCP wasn't ticked. I will try that now instead. Jun 19, 2014 at 20:45
  • Nope, connection was aborted. So, since it isn't PuTTY, and not the sshd_config, you think it is the firewall? I left it idle in two spots and both connections died out after some time. Jun 20, 2014 at 13:03
  • Yep, there's going to be a connection time out on the firewall. Jun 20, 2014 at 16:02
  • I don't know what happened, but it works now, thanks. Jun 24, 2014 at 13:02
  • Way after the fact (sorry!)... but I started having a similar issue just recently: my ssh session from previous evening forcibly closed. This despite formerly-working: "keep alive" measures on client-side, plus TCPKeepAlive et al host-side. ... Turns out someone had changed my Power / Energy Saver settings and my computer was now sleeping (vs. previous power-down of just display, disks). If there's no CPU/NIC active to send idle/null packets, your firewall will indeed kill your TCP session. I know, seems stupid, but sometimes it's the stupidest things... ;-) Sep 13, 2015 at 6:46

You must log in to answer this question.

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