How to Keep Alive SSH Sessions (getting rid of the “Write failed: Broken pipe”)
Posted by jpluimers on 2014/01/25
Getting rid of the dreaded “Write failed: Broken pipe”.
Note the difference of ServerAliveInterval/ServerAliveCountMax and ClientAliveInterval/ClientAliveCountMax.
For Mac, Linux and CygWin:
To enable the keep alive system-wide (root access required), edit
/etc/ssh/ssh_config
; to set the settings for just your user, edit~/.ssh/config
(create the file if it doesn’t exist). Insert the following:Host * ServerAliveInterval 300 ServerAliveCountMax 2
You can also make your OpenSSH server keep alive all connections with clients by adding the following to
/etc/ssh/sshd_config
:ClientAliveInterval 300 ClientAliveCountMax 2
–jeroen
Leave a Reply