I’m Not Technically Here
14 years, 6 months ago[ Geek ]
I’m not 100% sure what real life application this has so I’ll leave that to your imagination. I will say that for some reason I’m asked about this a lot. This technique allows you to tunnel all TCP requests through a remote server using a secure connection. This means all requests, not just HTTP.
So what does this do for you? Well you could buy an SSH account on a server located, say in France. Using that SSH connection you could then browse the web while sitting at home in Canada. As far as everyone knows, you’re in France because all your requests are being tunneled through, ie coming from, your SSH server located in France. Again, why would you do this? I have no idea and the answer doesn’t rhyme with sulu or fandora for those in Canada. As well, I’m sure there are much simpler ways of doing this, this is just how I do it.
What you need for this is some SSH skills and a program called tsocks. Everything I’ll show here works on a debian based OS such as ubuntu, using a bash shell.
First login to your ssh account using the -D option, see “man ssh” for more explanation. This option allows you to specify a port. All connections on your machine to that port will then be forwarded over the SSH connection to the remote machine.
ssh -D 8989 username@ssh_server.com
Next you need to install and configure tsocks, it’s in synaptic for ubuntu people. Once installed, edit /etc/tsocks.conf and remove or comment out all lines except:
server = 127.0.0.1
server_port = 8989
Now close all instances of any application that you wish to use for this. Then open them using the tsocks command which forces the program to tunnel all the applications connections through your SSH connection:
tsocks firefox
tsocks ping yahoo.com
Done. Now any site you browse to with firefox thinks you’re sitting at a cafe in France and yahoo thinks you’re pinging it from Toulouse.
A far more thorough explanation.