Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I have a added a local proxy for all my hosts in my .ssh config, however I want to shell into my local vm without the proxy command. Output of my ssh attempt:

debug1: /Users/bbarbour/.ssh/config line 1: Applying options for local.dev
debug1: /Users/bbarbour/.ssh/config line 65: Applying options for *

Given the following ssh config how do I prevent the ProxyCommand from being applied to the local.dev entry?

Host local.dev
    HostName dev.myserver.com
    User developer
Host *
    ProxyCommand /usr/local/bin/corkscrew 8840 %h %p
share|improve this question
up vote 7 down vote accepted

You can exclude local.dev from ProxyCommand, using ! before it:

Host * !local.dev
    ProxyCommand /usr/local/bin/corkscrew 8840 %h %p

From ssh_config documentation:

A pattern entry may be negated by prefixing it with an exclamation mark (`!'). If a negated entry is matched, then the Host entry is ignored, regardless of whether any other patterns on the line match. Negated matches are therefore useful to provide exceptions for wildcard matches.

The documentation also said:

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. The matched host name is the one given on the command line.

So, you can also disable ProxyCommand for local.dev by override value that you have defined in Host *:

Host local.dev
    HostName dev.myserver.com
    User developer
    ProxyCommand none
share|improve this answer

An option in the config file is applied the first time it matches. Since you don't have any ProxyCommand in the host entry, the one in your * entry will be used.

There are two ways to get around this:

  • For the hosts where you don't want to use the proxy command, simply add the line
    ProxyCommand none
  • For the * entry, note specifically that the entry should not apply to the host local.dev by negating it with a !
    Host !local.dev,*
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.