Mac OS X Terminal ssh Connection Keepalive
Don't let ssh kick ya
I was getting unceremoniously booted off ssh connections to Webfaction, in Mac OS X. 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 a Disconnecting ssh?
The fix is simple. You just add some keepalive packet settings to your local ssh’s config file, located in ~/.ssh/config
.
Host *
ServerAliveInterval 30
ServerAliveCountMax 2
After I added this and reconnected, problem solved. Hope this helps someone.