Command line torrent server using rTorrent
A text-based BitTorrent client that - combined with tmux - makes a cool lightweight torrent server.
ssh into my home server, start a tmux session and create multiple windows, run rTorrent in a window to start seeding a Linux
iso, detach from session and server, and return later to find everything in place and the
sudo apt install rtorrent mkdir -p ~/rtorrent/config.d
1. Start and config
Create an rTorrent executable startup script
~/rtorrent/start with the details provided in the rTorrent cookbook.
Download and save the default configuration template to
~/.rtorrentrc. Open the file and comment out (deactivate) the dht and watch directory settings …
[...] #dht.mode.set = disable #protocol.pex.set = no #trackers.use_udp.set = no [...] #schedule2 = watch_start, 10, 10, ((load.start, (cat, (cfg.watch), "start/*.torrent"))) #schedule2 = watch_load, 11, 10, ((load.normal, (cat, (cfg.watch), "load/*.torrent")))
Remember to configure port forwarding on the home router firewall for ports
dht.port.set (configured below).
2. Config fragments
Customize the config by creating some drop in config fragments in
~/rtorrent/config.d. For my setup I create fragments to establish bandwidth quotas, enable dht and require encrypted traffic, and set a directory that rTorrent watches for new torrent files …
print="Global bandwidth .: download_rate = 100 / upload_rate = 20" throttle.global_down.max_rate.set_kb = 100 throttle.global_up.max_rate.set_kb = 20
print="DHT support = auto" dht.mode.set = auto dht.port.set = 6881 protocol.pex.set = yes trackers.use_udp.set = yes
print="Encryption = required" encryption = require,require_RC4,allow_incoming,try_outgoing
print="Watch directory enabled." schedule2 = watch_directory,5,5, ((load.start, (cat, (cfg.watch), "*.torrent"))) schedule2 = untied_directory,5,5,stop_untied= schedule2 = tied_directory,5,5,start_tied=
~/rtorrent/start and a basic rTorrent setup is now up and running. Check out the cheatsheet for navigating around the interface and the rTorrent docs and the torrent client’s entry on the Arch Wiki for details and ideas for more advanced configs.
🐧 Part of the Linux Home Server project.