10

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?

Pierre
  • 580
  • 3
  • 19

2 Answers2

12

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
Pierre
  • 580
  • 3
  • 19
0

Adding the lines below in: ~/.ssh/config works for me on Ubuntu. Note that there is also ability to exclude multiple hosts/ips from the proxy setting and also the HostName is not needed:

Host localhost 192.168.1.10 192.168.1.11
  ProxyCommand none

Host *
  ProxyCommand /usr/bin/nc -X 5 -x localhost:8111 %h %p
  
Marinos An
  • 9,481
  • 6
  • 63
  • 96