BitTorrent over SSH

(This guide is for users of Mac OS X, although it may extend to other UNIX-like environments such as Ubuntu. For Windows instructions, look into TorrentFreak’s article on the subject.)

I found this guide over at Whalesalad explaining how to get Azureus to tunnel over SSH, but I couldn’t get it to work. Then I found this one, which worked a little better but kept giving the errors mentioned in this hint.

To combine all three of the above into something that seems to work, then:

One

On your server, edit sshd_config (probably in /etc/ssh or /private/etc) to add these lines to the bottom:

GatewayPorts yes
AllowTcpForwarding yes

You then must reboot the sshd process (i.e. sudo killall -HUP sshd). It will relaunch automatically, but if you do so over SSH you will obviously need to reconnect.

Two

On your local machine, run sudo ssh -2 -R 7654:localhost:7654 -A -D 1080 user@host.net

In the above command, 7654 is the port that peers will see, and 1080 is the port that will open locally to serve as your SOCKS proxy. You may choose other port numbers between 1024 and 65536.

As long as the shell (i.e. Terminal window) remains open, the tunnel will persist.

Three

In Azureus, set the incoming TCP listen port to 7654 in Options > Connection.

To proxy incoming connections, switch to Options > Connection > Proxy Options. Check “Check “Enable proxying of tracker communications” and “I have a SOCKS proxy.” The proxy host is 127.0.0.1 and the port is 1080. The username and password are your username and password on the remote server; note that they are stored in plain text and are thus insecure.

If you need to proxy outgoing connections too, check “Enable proxying of peer communications” and “Inform tracker of limitation.” The SOCKS version is V5. Also check “Use the same proxy settings for tracker and peer communications proxy.”

Finally, switch to Options > Transfer and check “Allow multiple connections from the same IP.”

Click “Save” in the bottom-left corner.

Four

Restart Azureus to have your proxy configuration changes applied.

One Response to “BitTorrent over SSH”

  1. James Schend Says:

    But why would you want to?

Leave a Reply