Mac OS X Lion Terminal SSH connection sharing error
You have ControlPersist
enabled. My educated guess is that the following happens:
- You have connection to example.com
- Logout, but because
ControlPersist
is enabled, session is kept open for future connections. - Something goes wrong with your network connection, and thus, persistent connection breaks.
- When you run
ssh [email protected]
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.