MacOS – Terminal. SSH with Proxy Socks 4

macosPROXYsocksssh

Gday all,

So i'm trying to use the terminal to SSH into a server using a SOCKS4 proxy.

In putty on windows you can tell it the IP and Port of the server. and then set the proxy in the proxy tab (IP and port)

is there anyway i can do this with the terminal on OSX?
Or is there another program i can use?

Pretty much so i don't have to VM windows and use putty

Cheers

Best Answer

You can use ProxyCommand option to ssh, which does exactly what you want in ssh_config:

Host target # or all
  ProxyCommand /usr/bin/nc -x IP:port %h %p

Or directly on command line:

ssh -o ProxyCommand='nc -x IP:port %h %p' user@host

The OSX netcat might have a bit different switches, but conceptually it works this way.

Credits: SuperUser question