Tunneling SSH Connections Through Tor

One good reason to tunnel SSH connections through Tor can be firewalls that block your traffic to the respective SSH destination port. As Tor is perfectly fine with only having port 80 and 443 available, and is locally running a SOCKS version 5 server by default, it can easily be used for transparently and securely traversing a firewall.

In order to tunnel your SSH connection through Tor, you have to make sure that Tor is installed on your computer (duh!). You can check the Tor website for the latest version, or alternatively, (if you don't care too much about having the latest version), you might as well be able to install it with your system's package manager. Furthermore, you have to make sure that the torsocks executable is installed, which comes usually along with a full-blown Tor installation, but is not included with the Tor Browser, for instance. In case you prefer to use the Tor browser (e.g., as it can be installed more easily), you can likely (depending on your system) install torsocks with your system's package manager as well.

When you have both Tor running and torsocks installed, you can now tunnel your SSH connection by prefixing the usual SSH command with torsocks, i.e., for instance torsocks ssh user@example.com.