Free Computer Help.
Powered by Volunteers.

Keep SSH session alive on Mac OS X

by Oscar Sodani
March 25, 2008

Oscar Sodani is a founder of Help2Go and owner of Help2Go Networks, an IT consulting firm in the Washington D.C. area. Oscar holds the CISSP certification as well as industry certifications from Microsoft, Cisco and Novell.

Sometimes we come across little annoyances that have a quick fix. For me, one such annoyance was that whenever I started an SSH session to my server, in Terminal or iTerm, on Tiger or on Leopard, the SSH session would time out within a few minutes. Drove me crazy!

There is a simple fix to this: you should have a .ssh directory in your home directory. Create a file in there called "config", if it doesn't already exist. In the file, put the following two lines:

ServerAliveInterval 300
ServerAliveCountMax 3

Save the file, and reconnect via SSH to your server or whatever. This time, the session should stay alive for as long as necessary. My sanity was saved.  

Have a question? Need help? Get free, friendly person-to-person help with your computer questions or spyware questions in our help forums!

Creative Commons License

(C) 2008 Help2Go - Contact Us