Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I sometimes get this error when I try to ssh to a remote host:

mux_client_request_session: read from master failed: Broken pipe

I'm using Macbook Air OS X Lion with this in ~/.ssh/config:

ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

ControlPersist 4h

ForwardAgent yes

Host [ex]
    HostName []
    User [somedude]

The error above happens when I do:

ssh ex

Terminal hangs for ~1 min and then displays:

mux_client_request_session: read from master failed: Broken pipe's password:

I type in my password and it's ok. And if I open another Terminal tab, connection sharing is ok too. How can I fix this? It's not terrible, but it's annoying.

share|improve this question
Can you log into any other remote machines from your macbook air? Can any other machines login to – jessh Dec 16 '13 at 2:47
up vote 9 down vote accepted

You have ControlPersist enabled. My educated guess is that the following happens:

  1. You have connection to
  2. Logout, but because ControlPersist is enabled, session is kept open for future connections.
  3. Something goes wrong with your network connection, and thus, persistent connection breaks.
  4. When you run ssh again, it tries to reuse connection from step 2, and opens a new connection after timeout.

No separate option for this timeout is available, according to man ssh_config. To avoid this, don't use ControlPersist. Additionally, I highly recommend using public key login, if possible. You can still have passphrase for your public key, but public key effectively prevents brute-forcing your password over SSH connection.

Additionally, you should not store control files under /tmp. Those should/must be secured, and for that, for example ~/.ssh/master/ssh_mux_%h_%p_%r is way better location. Of course, if you're the only user of your laptop (?), that's not too big issue.

share|improve this answer
Thank you for an excellent answer! – Will Feb 2 '14 at 18:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.