I am transition from Windows to OS X: Can one configure the Safari browser with a socks to tunnel through a SSH tunnel (Putty in MS-Windows). Can a SSH tunnel be configured from the command line and command the Safari browser to direct request / responses through the tunnel? If yes, an example is appreciated.
1 Answer
Hi Gator it's pretty straight forward. Start by opening terminal the default application for CLI. You can find it in Applications>Terminal or Applications>Utilities>Terminal depending on your version of Mac OS (X). Once that's open, type:
ssh -D 8080 -C -N username@IpAddress
note to understand all options for ssh simply type man ssh
in a new terminal window. The options used above -D
binds the port to the IP, -C
compresses the data, -N
will not execute commands in the tunnel which is very useful for forwarding other application data through the tunnel.
Next open safari and click on "safari" in the top left menu bar to open the drop down menu and then click on preferences. You can do the same thing by pressing CMD+,
. Click on the advanced tab and find "Proxies", click "Change Settings". System Preferences should open and you can now select "SOCKS Proxy". You should be setup and if you check google for your IP it should be masked by the address that you're SSH'd into. Note this is system wide and will cover all network communications. You can turn this off by unselecting the SOCKS Proxy.
-
Companion link to on/of proxy switch: apple.stackexchange.com/questions/89214/… Mar 19 at 14:23