From ArchWiki
Revision as of 23:11, 4 January 2009 by Timetrap (talk | contribs) (Use RTorrent with Screen)
Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n links end


RTorrent is a very simple, elegant and ultra-light bittorent client. It is written in C++ and uses ncurses, so it is completely text based and runs entirely in a console. RTorrent is ideal for low-end systems and with the addition of GNU Screen and openssh it is convenient as a remote bittorrent client.


pacman -S rtorrent


Before running RTorrent, the first step is to copy the default configuration file which is available at the RTorrent project page and save the file as .rtorrent.rc into your home directory.

Once the file has been saved, open it with your preferred text editor and make any necessary changes. Simply uncomment the options you wish to enable/utilize. For more detailed information on the options available, visit RTorrent Common Tasks

Recommended Configuration

These values in the following are subjective and dependent upon your own system and Internet connection speed. To find the optimal settings for you to use, visit the following website and follow the instructions: Optimize Your BitTorrent Download Speed

# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
max_peers = 52

# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
max_peers_seed = 52

# Maximum number of simultanious uploads per torrent.
max_uploads = 8

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 200
upload_rate = 28

This option below will determine where your torrents data will be saved. Change the default save directory to whatever you wish to use. Be sure to enter the absolute path; there is an odd bug with RTorrent sometimes does not respect relative paths (i.e. ~/torrents):

# Default directory to save the downloaded torrents.
directory = /home/[user]/torrents/

This option will allow RTorrent to save the progess of your torrents. Be sure to create a directory called .session (simply run as normal user:mkdir ~/.session):

# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/[user]/.session/

The following option will have RTorrent "watch" a particular directory for new .torrent files. Using your browser, when you find a .torrent file you would like to download, just save the file into this directory and RTorrent will automatically start the torrent. Be sure to create the directory that will be watched (simply run as normal user:mkdir ~/watch):

# Watch a directory for new torrents, and stop those that have been
# deleted.
#schedule = watch_directory,5,5,load_start=./watch/*.torrent
#schedule = untied_directory,5,5,stop_untied=
schedule = watch_directory,5,5,load_start=/home/[user]/watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
schedule = tied_directory,5,5,start_tied=

This option below will stop RTorrent from downloading any further when disk space is low. This is particuarly useful with a Seedbox where disk space is quite limited. Change the value as you like:

# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M

This option will set what port to use for listening. It is recommended to use a port that is higher than 49152. RTorrent allows the use of a single port rather than a range; a single port rather than an actual range is recommended.

# Port range to use for listening.
port_range = 49164-49164

The following option allow for a hash check whenever a torrent is complete or whenever RTorrent is restarted. This will make sure there are no errors with your acquired/seeding files.

# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
check_hash = yes

The following option allows for the enabling of encryption. This is very important to enable, if not for yourself, but for others in the torrent swarm; people might need to obscure their bandwidth usage from their ISP. Does not hurt you to enable even if you do not need such protection. More information: Bittorrent Protocol Encryption

# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
# encryption = allow_incoming,enable_retry,prefer_plaintext
encryption = allow_incoming,try_outgoing,enable_retry

The following is for DHT support. If you use public trackers, you'll want to enable DHT to acquire more peers. If you use only private trackers, do not enable DHT as this will reduce your speeds and can create a privacy risk. Some private trackers will even warn you if you use DHT.

# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
# dht = auto

# UDP port to use for DHT. 
# dht_port = 6881

# Enable peer exchange (for torrents not marked private)
# peer_exchange = yes

Be sure to forward the proper port(s) with your router if you use one. A decent guide per router make/model can be found here.


RTorrent relies exclusively on keyboard shortcuts for user input. A complete guide is available on the main site: RTorrent User Guide

Here are the basics for quick reference:

  • Control-q : closes RTorrent, done twice makes the program shutdown without waiting to send stopping information to the trackers.
  • Left arrow : returns to the previous screen.
  • Right arrow : goes to the next screen.
  • a|s|d : increase global upload throttle about 1|5|50 KB/s
  • A|S|D : increase global download throttle about 1|5|50 KB/s
  • z|x|c : decrease global upload throttle about 1|5|50 KB/s
  • Z|X|C : decrease global download throttle about 1|5|50 KB/s
  • Control-S : starts download
  • Control-D : stops an active download, removes a stopped download.
  • + or - : changes the download priority of selected torrent.
  • Backspace : adds the specified .torrent. After pressing this button write full path or URL of .torrent file. You can use Tab and other tricks from bash.

Use RTorrent with Screen

Screen is a program that will allow CLI applications to be run in the background and without X running.

To install:

pacman -S screen

and then copy screenrc to your home directory as normal user:

cp /etc/screenrc ~/.screenrc

To have RTorrent always start with screen, add the following to your .screenrc file:

screen -t rtorrent rtorrent 

To start screen + RTorrent, simply run screen from a terminal. Control-a followed by d will detach screen, and running screen -r will open screen again.

On a remote machine

Most setups of rTorrent on a remote machine involve using Screen. Supposing you have a detached Screen session with rtorrent on the remote machine (and the option to SSH into it), you can gain access to it using:

/usr/bin/ssh -t -p <ssh port on remote machine> <user>@<remote machine> screen -RD

If you want immediate access on startup, you will need to upload a key from your machine to remote host (so you will not be prompted for a password) and setup a terminal to run the command above. An inittab example using rungetty on virtual console 4:

sam:45:respawn:/sbin/rungetty tty4 -u <local user> -- /usr/bin/ssh -t -p <ssh port on remote machine> <remote user>@<remote machine> screen -RD

rtorrent Daemon with screen

I use this on my home server to run rtorrent w/ screen as a daemon. With the username rtorrent Just create an rtorrent file in your /etc/rc.d/ and add the following code.


. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
    stat_busy "Starting rtorrent"
    su rtorrent -c 'screen -d -m rtorrent' &> /dev/null
    if [ $? -gt 0 ]; then
      add_daemon rtorrent
    stat_busy "Stopping rtorrent"
    killall -s 2 rtorrent &> /dev/null
    if [ $? -gt 0 ]; then
      rm_daemon rtorrent
    $0 stop
    sleep 1
    $0 start
    echo "usage: $0 {start|stop|restart}"
exit 0

On a remote computer I use the following script to connect to the server's daemon process:

ssh -t rtorrent@ 'screen -r'

Additional Tips

  • To use RTorrent with a tracker that uses https, do the following as root:
cd /etc/ssl/certs
wget --no-check-certificate https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer
mv Equifax_Secure_Global_eBusiness_CA-1.cer Equifax_Secure_Global_eBusiness_CA-1.pem

And from now on run RTorrent with:

rtorrent -o http_capath=/etc/ssl/certs

Be sure to change .screenrc to reflect this change if you use screen:

screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs


Rtorrent is a most excellent bittorrent client. Its stellar performance, low requirements and excellent configurability separate it from the competition.

See Also

Screen Tips

A Detailed Intro to Bittorrent including definition of terms terms