Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Most ssh connections I make benefit from the ControlMaster being turned on, for example most of the connections I make over VPN. However, there are a few that don't, such as github. So I've got the following in my ~/.ssh/config file:

Host *
  ControlMaster auto
  ControlPath   ~/.ssh/%r,%h,%p
  ControlPersist 30m

Host github.com
  ControlMaster no
  ControlPath none
  ControlPersist no

(Among other such exceptions)

However, from what I can tell (pgrep -fla mux), the mux process is still being created, and this seems to provide some minor annoyances for the connections that don't benefit from muxing.

Is there some way to specify, on a host-by-host basis, in my config file, not to create the master connection?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The first matching parameter applies. Switch the order of the sections.

Host github.com other-exception.example.com
ControlPath none

Host *
ControlMaster auto
ControlPath   ~/.ssh/%r,%h,%p
ControlPersist 30m

This is mentioned in the ssh_config man page, but not very clearly:

For each parameter, the first obtained value will be used. The configuration files contain sections separated by “Host” specifications, and that section is only applied for hosts that match one of the patterns given in the specification.

share|improve this answer

Your Answer

 
discard

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.