MarkMaunder dot com

SSH config for OS X users to keep connections from dropping on MiFi and other mobile hotspots

If you use SSH and are often using your cellphone as a mobile hotspot, or use a MiFi as a hotspot, you probably noticed that if you don’t do anything in your SSH window for a while, the connection drops, usually with a ‘Broken Pipe’ message.

Suffer no more…

Create an ‘.ssh’ directory off your home directory in terminal.

Add a .ssh/config file.

Add the following lines:

TCPKeepAlive no
ServerAliveInterval 1
ServerAliveCountMax 99999999

Then go to lunch, come back and your SSH connection will still be alive and kicking without you having to reconnect. Enjoy.

One Comment

Leave a Comment

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

My name is Mark Maunder. I've been blogging since around 2003 when I started on Movable Type and ended up on WordPress which is what I use to publish today. With my wife Kerry, I'm the co-founder of Wordfence which protects over 5 million WordPress sites from hackers and is run by a talented team of 36 people. I'm an instrument rated pilot and I fly a Cessna 206 along with a 1964 Cessna 172 in the Pacific Northwest and Colorado. I'm originally from Cape Town, South Africa but live in the US these days. I code in a bunch of languages and am quite excited about our emerging AI overlords and how they're going to be putting us to work for them.