Search code examples
sshopenssh

How to disable ProxyCommand for one particular host?


Using OpenSSH, I have set my /etc/ssh/ssh_config to have a ProxyCommand so all SSH connections go through that proxy.

/etc/ssh/ssh_config:

Host *
  ProxyCommand nc -X connect -x localhost:8111 %h %p

But I would like to disable the proxy for one particular SSH host.

I have added the following to my ~/.ssh/config:

Host ssh.example.org
  HostName ssh.example.org
  ProxyCommand ""

What should I put with ProxyCommand so that it doesn't use a proxy for that particular host only, but the default is still to go through the proxy for SSH conncetions?


Solution

  • The solution is to use ProxyCommand none for hosts that should go outside the proxy!

    Host ssh.example.org
      HostName ssh.example.org
      ProxyCommand none