Making ssh use tor
Quite often I want to ssh to a server of mine on the road from a questionable network. While I know ssh is encrypted, the address I am connecting to is not. Usually this isn’t an issue, but maybe it is to you. If so give this a shot.
First you need to have tor and privoxy installed. This isn’t hard, and there are guides on how to do this all over the internet. Next, run the following command
apt-get install proxychains
Proxychains is a nifty command line program that allows you to run your console programs through a proxy, even if they don’t support it.
Your next step is to configure proxychains, so open up /etc/proxychains.conf in your favourite editor and scroll down towards the bottom. Replace all the lines under [ProxyList] with the following
socks5 127.0.0.1 9050 http localhost 8118
Then give ssh a shot with the command (We use the server IP address to avoid DNS leaks)
proxychains ssh <server ip>
You’ll eventually get output like the following:
ProxyChains-2.1 (http://proxychains.sf.net) dynamic chain:....127.0.0.1:9050....<server ip>:22..OK
Which means proxychains has successfully connected to the tor proxy. From there tor takes over the request, and very slowly connects to your ssh server. You can then run the command ‘w’ to see what your exit-nodes IP is, if your interested.



