Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Nov 03, 2009 2:18 pm 
Offline
Senior Newbie

Joined: Tue Apr 28, 2009 7:13 pm
Posts: 7
Hi,

I use Ubuntu 9.10 vmware images locally, and Ubuntu 9.10 images on Linode.

Opening a putty ssh session to my local machine will stay alive indefinately.

However, my putty connection to my Linode will die after a certain (short) period of inactivity.

This is *really* annoying.

I've checked 'TCPKeepAlive yes' in sshd_config is set on my Linode and it is.

Is there a different setting thats causing this to happen?

Or is it a Linode firewall thing?


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 4:08 pm 
Offline
Senior Member

Joined: Wed Feb 13, 2008 2:40 pm
Posts: 126
It's probably your client. Enable keep alives in your client as well.


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 4:10 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Adding the ClientAliveInterval option to /etc/ssh/sshd_config (and restarting sshd) may help, e.g.
Code:
ClientAliveInterval 60


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 4:37 pm 
Offline
Senior Newbie

Joined: Tue Apr 28, 2009 7:13 pm
Posts: 7
mjrich wrote:
Adding the ClientAliveInterval option to /etc/ssh/sshd_config (and restarting sshd) may help, e.g.
Code:
ClientAliveInterval 60


Hey, thanks. I'm trying that now.

ClientAliveInterval 60 is not set in my local sshd_config file, and connection to that one is working fine.

Client is Putty.

Local server is Ubuntu 9.10 (connections stay valid forever)
Linode server is Ubuntu 9.10 (drops after ~2 mins of inactivity)


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 4:51 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Some NATs/firewalls/etc. drop external connections that haven't responded within a set timeframe, either to conserve resources or as a security measure. Setting either ClientAliveInterval or ServerAliveInterval (depending on how many servers you have) can help.

http://dan.hersam.com/2007/03/05/how-to-avoid-ssh-timeouts/


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 5:45 pm 
Offline
Senior Member

Joined: Thu Dec 04, 2008 10:55 am
Posts: 57
Location: New Jersey
Is your linode SSH port listening on something other than 22? That could also be why. I had that problem a while back.


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 5:52 pm 
Offline
Senior Newbie

Joined: Tue Apr 28, 2009 7:13 pm
Posts: 7
Thanks @spearson and especially @mjrich.

Initially I tried ClientAliveInterval 60, but that still wasn't working.

So I set ClientAliveInterval 30 on the server. Very low I know. But it works.

Now it's consistently holding the connection open for ~20 mins. Havn't tried any longer.

Important point is that now I don't have to press "enter" every minute into my terminal while Im working LOL.

Thanks!


Top
   
 Post subject:
PostPosted: Tue Nov 03, 2009 5:55 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Great to hear :)


Top
   
 Post subject:
PostPosted: Wed Nov 04, 2009 1:08 pm 
Offline
Junior Member

Joined: Fri Dec 12, 2008 1:24 pm
Posts: 23
@fireflytech:

In Putty, under "Connection", "Seconds between keepalives (0 to turn off)", change that to "300" or so.

That will keep your session alive indefinitely without having to press "enter" or anything.


Top
   
 Post subject:
PostPosted: Wed Nov 04, 2009 9:27 pm 
Offline
Senior Newbie

Joined: Mon Oct 12, 2009 3:30 am
Posts: 15
use tunnelier instead of putty..lots of features including auto-reconnect


Top
   
 Post subject:
PostPosted: Wed Nov 04, 2009 9:33 pm 
Offline
Senior Member

Joined: Sun Aug 02, 2009 1:32 pm
Posts: 222
Website: https://www.barkerjr.net
Location: Connecticut, USA
I solved the problem by upgrading from my old Linksys router to a new Dlink router.


Top
   
 Post subject:
PostPosted: Wed Nov 04, 2009 10:25 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
BarkerJr wrote:
I solved the problem by upgrading from my old Linksys router to a new Dlink router.

Which linksys? Some of them can be updated with new (free) firmware; I use "tomato" on my wrt54g and set the timeout to 5 days. If an ssh session is _that_ idle then it deserves to be disconnected :-)

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group