Logo
My Journal
Blog

Timeline

Blog

Keeping SSH Sessions Alive

I noticed recently that ssh connections from my Dedicated Centos Server to my Fedora server would time out and disconnect if I left the connection idle for a long period of time. This really annoyed me, as you have to login again specially if you have some edited files open and forgot to save the changes you made

I added the following line to /etc/ssh/ssh_config :

ServerAliveInterval 5

That seems to have fixed the problem, and my centos server can now remain connected, though idle, to my server.

What this does, essentially is every 5 seconds, the client sends a small keep-alive packet to the server to make it look like the ssh connection is being actively used.

1 Comments
    • victor gonzalez
      Jun 4, 2011 at 5:31 PM / Reply

      have you tried using sha private keys??
      its beautiful not to type passwords 🙂 and looks so nice to ssh [email protected]; and thats it 🙂

Leave A Comment