Use a remote server as SOCKS proxy for browser and command line commands

With SSH create a SOCKS proxy it’s really easy, just log into your account on the remote server, and leave it open

ssh -D [PORT:9000]

Then change the proxy configuration for your browser, or even better, your operative system, to use SOCKS and the port that you previously used, make sure to put on the host field localhost, it’s not your remote host, that’s the whole idea of it, it will pass the traffic to your localhost and then it will use the ssh process running to transfer it to your remote server.

At that point you will be able to browse as if you were on the remote server, but, when you run a command from the terminal it will “ignore” this proxy, at least on ubuntu, don’t know why, in order to “fix” this you need to export this configurations

export http_proxy=http://localhost:[PORT:9000]/
export https_proxy=http://localhost:[PORT:9000]/

Notice that the port has to be the same as the one when you run the SSH command.

And that’s all.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s