SSH Tricks #2: SSH as a proxy

We talked about port forwarding recently. This helps you get access to single resources but it requires a lot of planning and configuration. It would be pretty awesome if SSH had a proxy feature.

Lucky for us all there is the -D option for the ssh command. This option turns the ssh connection in to a SOCKS proxy on the remote server. The potential uses for this are huge. I often use this feature to gain quick access to my whole network.

Setting it up

superbox$ ssh -D 31337 someserver

Using it

Firefox SOCKS Proxy is set to localhost port 31337

To use this you will need to configure your applications to connect through the SOCKS proxy. Firefox is pretty easy to configure. The settings for the proxy live in the Preferences under the Advanced section in the Network tab. Click the Settings… button to bring up a dialog similar to the one on the right. Set the SOCKS host to localhost and the port to the one you chose when connecting.

Now that the proxy is setup you can test out that you’re proxy is working by visiting http://whatismyipaddress.com/ to check to see if it looks like you are accessing the site from a new IP address.

In the next installment of SSH Tricks we’ll talk about using ssh config files to save time and energy.

Leave a Comment

Name

E-mail

Website (optional)

Comment