I’ve noticed that when I keep ssh sessions that I opened before untouched for some period of time (like 30 minutes) they become frozen and as a result I have to close ssh terminal and start a new connection. To prevent such situation I found several tips:

1) Start some utility updating the screen before leaving ssh session untouched. I usually use watch -n 1 ‘date’ that shows current date every second. Other simple way is to send icmp requests to some host, e.g. ping google.com.

2) Increase ssh session idle time by

echo “7200” > /proc/sys/net/ipv4/tcp_keepalive_time

I’ve checked these tips with Fedora Core, CentOS, Debian and Ubuntu but I’m completely sure that it applicable also for other Linux distributions. First tip (ping) can be used in Unix also.

You may also be interested in:
Secure shell (ssh) connection without password
Keep ssh session saved (Unix “screen” utility)
Moving Linux to remote server (over ssh via third server)




  1. September 24, 2007  2:44 am by P.E. Reply

    I've been trying to deal with the freezing of ssh sessions on a debian etch box (kernel:2.6.18-5-686) for a while and have not had much luck.

    Sessions freeze after just a few minutes of inactivity - even if I am sitting in pine.

    echo "7200" > /proc/sys/net/ipv4/tcp_keepalive_time

    did not make any difference. Actually, 7200 was already stored in that file.

    This is a new problem which I did not have before upgrading from Mandrake 10 to Debian.

    Under Mandrake, idle sessions would get logged off (as opposed to frozen) after a reasonable interval.

    Can you suggest other things that I could try?



  2. September 24, 2007  8:07 am by artiomix Reply

    Hi P.E.,

    Here are some directives of SSH server's sshd_config that are related to session timeouts:




    Here are some directives of client's ssh_config:



    sshd_config and ssh_config are usually located at /etc/ssh directory of server and client.

    These directives are are widely described by <code>man sshd_config</code> and <code>man ssh_config</code> but default settings may be different from distro to distro.

    P.S. As for me, I found first tip of current post the most useful as it works brilliantly at every *nix machines I was working with via ssh (just make <code>ping</code> when you're going to leave ssh terminal untouched for some time).

    P.P.S. Another nice workaround is to use <code>screen</code> utility. In case you use it you can be sure that you won't loose any output of commands you've started. Here is little notice how to use it.

    Good luck!

  3. January 24, 2010  8:59 pm by Karl Blessing Reply

    What I did was create a script called away and placed it in my /opt/bin path , making sure it was executable. Course you can place it in whatever path is in your PATH directive.

    watch -n 1 'date'

    so that no matter where you are on the console, just type away

  4. January 25, 2011  5:18 pm by Jenae Hoose Reply

    I do concur with quite a few others; each of our kids will need more organization in their schooling And need to perform harder. This can happen only when WE don't take anything less from them; then, they will expect it of themselves.

  5. April 16, 2011  12:45 am by Kursy zarabiania w sieci Reply

    by Facebook and Twitter. Malcolm Gladwell’s protests to the contrary, the recent upswelling in

  6. April 20, 2011  3:59 pm by debt management Reply

    Hi there. I discovered your website by way of Google at the same time as searching for a comparable subject, your website got here up. It appears to be great. I have bookmarked it in my google bookmarks to come back later.

  7. April 25, 2011  10:40 am by Coches de ocasion Reply

    Howdy. Very cool blog!! Man .. Beautiful .. Wonderful .. I'll bookmark your blog and take the feeds also...I am glad to find numerous useful information here in the article. Thanks for sharing...

  8. April 26, 2011  1:00 pm by foreclosure greenville sc Reply

    Hey there. I discovered your site via Bing while looking for a related topic, your web site got here up. It appears great. I've bookmarked it in my google bookmarks to visit later.

  9. April 26, 2011  1:58 pm by descalcificadores de agua Reply

    Thanks for sharing superb information. Your site is so cool. I am impressed by the details that you have on this site. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for more articles.

  10. April 28, 2011  4:14 pm by low brokerage trading account Reply

    Hi there. Very nice website!! Man .. Beautiful .. Amazing .. I'll bookmark your site and take the feeds additionally...I am satisfied to find a lot of useful information right here in the post. Thanks for sharing.

  11. April 29, 2011  2:40 pm by terra nova tv Reply

    Good site! I truly love how it is easy on my eyes it is. I am wondering how I could be notified when a new post has been made. I have subscribed to your RSS feed which may do the trick? Have a nice day!

  12. April 30, 2011  8:50 pm by austin motorcycle repair Reply

    I have recently started a site, and the information you offer on this site has helped me greatly. Thanx for all of your time & work.

  13. May 3, 2011  10:48 pm by perfumes valencia Reply

    Great post. I am a regular visitor of your website and appreciate you taking the time to maintain the nice site. I'll be a regular visitor for a long time.

  14. March 20, 2012  5:54 am by Kredyt hipoteczny Reply

    You really make it appear really easy with your presentation but I in finding this matter to be actually one thing that I think I would never understand. It sort of feels too complex and extremely large for me. I'm taking a look forward for your subsequent put up, I'll try to get the cling of it!

  15. Pingback : ssh | Bernhard Hensler

Leave a reply


Your email address will not be published.