Tag Archives: Tor

Anonymous SSH over TOR and disconnect without a trace

Surfing through the internet anonymously is one thing, but certain services, e.g. ssh, makes it hard to remain anonymously. Fortunately there is a way to anonymously connect via ssh, or at least partly. Partly, since you still need a user account on the remote host. Kids, just a friendly reminder – don’t do illegal stuff!

Ok, since we’ve clarified this point – lets get back to work. Having my ubuntu, first we need to install for [1] and the connect-proxy service.

apt-get install tor
apt-get install connect-proxy

That was an easy one. Now we move to the home directory of your user with which you would like to connect to the remote host anonymously. Go to the .ssh/ directory. Check if there is a file called “config” existing. If it’s existing add the following lines, if its not existing, you should create a “config” file with the following content:

Host *
CheckHostIP no
Compression yes
Protocol 2
ProxyCommand connect -4 -S localhost:9050 $(tor-resolve %h localhost:9050) %p

Having the tor service running, you should now be able to connect to the remote host via ssh anonymously. One more additional tip – to “close” your session anonymously – not that it is required – you can do as follows.

echo $$
kill -9 `echo $$`

While the first command should show you the process id of your shell, the second one kills your shell without writing the bash_history.

[1] Tor Project

[2] Ubuntu connect-proxy manpage