Disable SSH timeout



By default, most SSH servers are configured to forcibly disconnect inactive or idle clients, or actually those with no network activity. This is not good for some people especially if one is setting up a (reverse) tunnel to the server where the tunnel should remain established whenever they need it.

There are 2 methods to overcome this problem, being the first one is not to stay idle or by keeping the network activity busy, and if you have root access to the server, change the SSHd configuration at the server.

How can the network be kept busy while you are not attending the session? The trick is to run any program that keep updating the screen, such as mtr or top. The program should generate some network activity, and keep the session active and connected. Use the program screen to create virtual terminals where one terminal is dedicated to the program mtr or top.

If you have root access to the server, you might want to just change the SSHd configuration file. To do this, edit the file /etc/ssh/sshd_config and change the following options as in the example below;

TCPKeepAlive yes ClientAliveInterval 30 ClientAliveCountMax 99999

Don’t forget to restart the SSH server afterwards with the following command;

# /etc/init.d/sshd restart

 


Posted on 05.11.2008 and categorized under linux

Comment Form


  • ayaz: Thanks for the tip.
  • TrueColorTech: Awesome Tip, I have been wanting that option for a while now!
  • iGadget: If this would work, it'd be really nice. However, when I use the command described in your post, I get the following error (twice): Could not conne
  • Alan: fedora 10 is so cool and i have fedora 10 too!
  • Kyle: Forgot to swing back by here after finding version 5.1.3 available, posted about it here: http://yokohead.com/2009/01/google-gears-in-firefox-x64-for

Categories