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.

One thought on “Keeping SSH Sessions Alive

Leave a Reply

Your email address will not be published. Required fields are marked *