Mac OS X Terminal Ssh Connection Keepalive

I was getting unceremoniously booted off ssh connections to Webfaction. Here’s what I did to fix it.

If you do any system admin work at all, you’ll know this problem: the host you connected to via ssh has disconnected you with a “broken pipe” message. It could be that you left the session open, or that you moved from one network to another, messing with the NAT connection, restarted your system, or various other reasons.

So How Do You Fix It?

The fix is simple. You just add some keepalive packet settings to your local ssh’s config file, located in ~/.ssh/config.

1
2
3
Host *
    ServerAliveInterval 30
    ServerAliveCountMax 2

After I added this and reconnected, problem solved. Hope this helps someone.

Comments?

Join the discussion at my Google+ post.

—by Rick Cogley