Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

If you ever used ssh shared connection you may also encounter the:

Shared connection to <hostname> closed.

Now, my question is if there is a way that would allow you to benefit from the speedup of using shared ssh connections that would not close your connection when the first ssh session is closed.

share|improve this question
up vote 4 down vote accepted

Yes. Use ControlPersist. For example, my ~/.ssh/config looks like this:

Host *
  ControlMaster auto
  ControlPath ~/.ssh/control/%r@%h:%p
  ControlPersist 3600

(if you use this, you'll need to create the directory ~/.ssh/control)

Using this, shared connections stay open and get reused.

share|improve this answer

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.