rTorrent BitTorrent Client on Arch Linux

rTorrent Arch Linux logo

rTorrent is a fast and efficient command-line based BitTorrent client. It can work many front-end interfaces such as ruTorrent. When used with a web interface it is similar to other clients like uTorrent Server or Deluge.


Install rTorrent

Install from official repositories.

sudo pacman -S rtorrent


Install tmux.

sudo pacman -S tmux

Tmux is only required to run as a daemon with systemd.


Configure rTorrent

Create a system account and group.

sudo useradd -r rtorrent

Tmux requires shell access which means -s or --shell option should not be used to set a fake shell.


Create system directories.

sudo mkdir -p /mnt/downloads/rtorrent/{.session,watched,seeding}


Change the ownership of the download directories.

sudo chown -R rtorrent:rtorrent /mnt/downloads/rtorrent


Change the permissions of the system directories.

sudo chmod -R 771 /mnt/downloads/rtorrent


Copy a sample configuration file to use as a default configuration.

sudo cp /usr/share/doc/rtorrent/rtorrent.rc /etc/rtorrent.conf


Open the configuration file.

sudo nano /etc/rtorrent.conf

Uncomment session = ./ and change the value to the absolute path to the session directory created earlier for example session = /mnt/downloads/rtorrent/.session. Despite the comments and even default values implying otherwise, due to a bug relative paths do not work regardless whether the directory option is set or not. Similarly the directory =  should be changed to the download directory for example session = /mnt/downloads/rtorrent. Other settings can be configured as needed.

One particularly useful option which is not in the default configuration file is the umask option.  It allows default permission modification of the downloaded files. For example system.umask.set = 002 setting will result in all downloaded files to have 775 permissions.

Incoming listening port range can be set with port_range. It’s recommended to set the range limited to a single port higher than port 49152 such as 49164-49164. Disable port_random by setting it to no to prevent blocked ports from being used. Enable encryption by setting encryption option to allow_incoming,enable_retry,prefer_plaintext.

Allow the use of UDP trackers by setting use_udp_trackers to yes. Enable DHT by setting dht to on to turn it on at start up or auto to start it only when needed. Set peer_exchange to yes to enable the PEX protocol.

Global maximum download and upload rates can be limited by download_rate and upload_rate respectively.


Start rtorrent manually.

sudo -u rtorrent rtorrent -n -o import=/etc/rtorrent.conf

By default the configuration file is loaded from ~/.rtorrent.rc. This behaviour can be disabled with -n option. An alternative settings file is specified with -o option.


Create the systemd script.

sudo nano /etc/systemd/system/rtorrent.service


Copy the script and save.

Description=rTorrent Daemon
After = mnt-downloads.mount

ExecStartPre=/usr/bin/bash -c "if test -e /mnt/downloads/rtorrent/.session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f /mnt/downloads/rtorrent/.session/rtorrent.lock; fi"
ExecStart=/usr/bin/tmux new-session -c /mnt/downloads/rtorrent -s rtorrent -n rtorrent -d 'rtorrent -n -o import=/etc/rtorrent.conf'
ExecStop=/usr/bin/bash -c "/usr/bin/tmux rt send-keys -t rtorrent C-q && while pidof rtorrent > /dev/null; do sleep 0.5; done"



Configure FirewallD

Create firewalld rule for rTorrent.

sudo bash -c 'cat > /usr/lib/firewalld/services/rtorrent.xml << EOF
<?xml version="1.0" encoding="utf-8"?>
  <description>rTorrent Service</description>
  <port protocol="tcp" port="49164"/>

The rule will allow rTorrent to work over port 49164.


Create firewalld rule for DHT.

sudo bash -c 'cat > /usr/lib/firewalld/services/dht.xml << EOF
<?xml version="1.0" encoding="utf-8"?>
  <description>DHT Service</description>
  <port protocol="udp" port="6881"/>

The rule will allow DHT to work over port 6881.


Reload the configuration for the new service to be detected immediately.

sudo firewall-cmd --reload


Add the rules permanently.

sudo firewall-cmd --permanent --add-service=rtorrent
sudo firewall-cmd --permanent --add-service=dht


Reload the configuration for the changes to apply immedietely.

sudo firewall-cmd --reload


Backup rTorrent

Copy the download directory to the backup location.

sudo cp /mnt/downloads/rtorrent/ /mnt/backup/rtorrent


Backup configuration file.

sudo cp /etc/rtorrent.conf /mnt/backup/rtorrent


Restore rTorrent

Stop the systemd service.

sudo systemctl stop rtorrent.service


Remove the current data directory if it exists.

sudo rm -Rd /mnt/downloads/rtorrent


Move the backup to the download directory.

sudo mv /mnt/backup/rtorrent /mnt/downloads/


Set the ownership on the new directory.

sudo chown -R rtorrent:rtorrent /mnt/downloads/rtorrent


Move the backup configuration file.

sudo mv /mnt/backup/rtorrent.conf /etc/


Run rTorrent

Start the systemd service.

sudo systemctl start rtorrent.service


Enable the service to run on boot.

sudo systemctl enable rtorrent.service


Use rTorrent

rTorrent is accessed via Command Line however this can be tedious to use as a primary means of access. A good option is to install ruTorrent or another web interface.