This guide explains how to run multiple independent rTorrent and ruTorrent instances under a single service account.
Each instance has its own configuration, download directory, session data and WebUI. This is useful if you want to separate different workloads or provide independent access to multiple users.
Throughout this guide, rutorrent1 is used as the example instance name. You can replace it with any name you prefer, such as rutorrent2, movies or private. Simply use the same name consistently in all commands.
Before you begin, log in to your service via SSH.
Step 1 – Create the Required Directories
Create a separate downloads directory and session directory for the new instance:
mkdir -p ~/downloads/rutorrent1/watch ~/.config/.rutorrent1/.session
Step 2 – Create a Separate rTorrent Configuration
Copy your existing rTorrent configuration:
cp ~/.rtorrent.rc ~/.rutorrent1.rc
Step 3 – Update the New Configuration
The new configuration needs to use its own download directory, session directory, SCGI port and ruTorrent instance.
Instead of editing the file manually, run the following commands:
sed -i "s:^directory.*:directory = ~/downloads/rutorrent1:" ~/.rutorrent1.rc
sed -i "s:/downloads/watch/rtorrent:/downloads/rutorrent1/watch:" ~/.rutorrent1.rc
sed -i "s:.config/:.config/.rutorrent1/:" ~/.rutorrent1.rc
sed -i "s:scgi_.*:scgi_port = localhost\:$(shuf -i 13000-13500 -n 1):" ~/.rutorrent1.rc
sed -i "s:php $(whoami):php rutorrent1:" ~/.rutorrent1.rc
The new rTorrent configuration is now ready.
Step 4 – Create a Separate ruTorrent Directory
Create a directory for the new ruTorrent WebUI:
mkdir -p ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/
Copy the existing ruTorrent installation into the new directory:
cp -fr ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent/* ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/
Step 5 – Remove Existing User Data
The copied ruTorrent directory contains your current user configuration, including torrent history, traffic statistics and other cached data.
Remove it so the new instance starts with a clean configuration:
rm -rf ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/share/users/$(whoami)
Step 6 – Remove the autodl-irssi Plugin (Optional)
If you use the autodl-irssi plugin, remove it from the new instance before the first start:
rm -rf ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/plugins/autodl*
If you do not use autodl-irssi, you can skip this step.
Step 7 – Configure the New ruTorrent Instance
Update the ruTorrent configuration so it uses the new SCGI port, RPC endpoint and download directory:
sed -i "s:\$scgi_port.*:\$scgi_port = \"$(
grep scgi .rutorrent1.rc \
| awk -F ':' '{print $2}'
)\";:" \
~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/conf/config.php
sed -i \
"s:\$XMLRPCMountPoint.*:\$XMLRPCMountPoint = \"$(whoami)/rutorrent1/RPC1\";:" \
~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/conf/config.php
sed -i \
"s:\$topDirectory.*:\$topDirectory = \'$HOME/downloads/rutorrent1\';:" \
~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/conf/config.php
sed -i \
"s:rutorrent/error:rutorrent1/error:" \
~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/conf/config.php
The new WebUI is now configured to communicate only with the new rTorrent instance.
Step 8 – Configure Authentication
Create the Apache configuration required for the new RPC endpoint and WebUI authentication:
echo -e "\
SCGIMount /$(whoami)/rutorrent1/RPC1 127.0.0.1:$(
grep scgi .rutorrent1.rc \
| awk -F ':' '{print $2}'
)\n\
\n" \
> ~/.apache2/conf.d/rutorrent1.conf
echo -e "\
<Location /$(whoami)/rutorrent1/RPC1>\n\
AuthName 'rutorrent1'\n\
AuthType Basic\n\
AuthBasicProvider file\n\
AuthUserFile '$HOME/.apache2/rutorrent1_auth'\n\
Require valid-user\n\
</Location>" \
>> ~/.apache2/conf.d/rutorrent1.conf
echo -e "\
AuthName 'Private'\n\
AuthType Basic\n\
AuthBasicProvider file\n\
AuthUserFile '$HOME/.apache2/rutorrent1_auth'\n\
Require valid-user" \
> ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1/.htaccess
Create the authentication file:
htpasswd -cb ~/.apache2/rutorrent1'_auth' rutorrent1 password
Replace password with the password you would like to use for the new ruTorrent instance.
Remember the username and password you configure here. They will be required when logging in to the new ruTorrent WebUI.
Step 9 – Reload Apache
Reload Apache so the new ruTorrent configuration becomes active:
/usr/sbin/apache2ctl -k graceful
Step 10 – Start the New rTorrent Instance
Start the new instance inside a detached screen session:
screen -dm -S rutorrent1 rtorrent -n -o import=~/.rutorrent1.rc
The instance will continue running in the background after you disconnect from SSH.
Step 11 – Create an Automatic Restart Cron Job
Create a cron job that checks every 5 minutes whether the new rTorrent instance is running. If it has stopped unexpectedly, it will be started automatically.
(
crontab -l
echo -e "*/5\t*\t*\t*\t*\t\
ps x | grep rutorrent1 | grep -v grep || \
screen -dm -S rutorrent1 rtorrent -n -o import=~/.rutorrent1.rc && \
screen -wipe"
) | crontab -u $(whoami) -
Step 12 – Configure FTP Access (Optional)
Your new rTorrent instance is now operational.
If you want another user to access only this instance's download directory, install the ProFTPD server from your Client Area and configure an additional FTP account with access limited to:
~/downloads/rutorrent1
Detailed instructions are available in the following article:
You can create as many additional rTorrent/ruTorrent instances as you need. Simply replace every occurrence of rutorrent1 throughout this guide with another unique name, such as rutorrent2, movies or private.
Removing an Instance
If you no longer need the additional instance, follow the steps below to remove it completely.
1. Remove the Cron Job
crontab -l | sed -e "/rutorrent1/d" | crontab -u $(whoami) -
2. Stop the rTorrent Instance
kill -9 $( pgrep -f rutorrent1)
3. Remove All Instance Files
rm -rf ~/www/$(whoami).$(hostname)/$(whoami)/rutorrent1
rm -f ~/.apache2/rutorrent1*
rm -f ~/.apache2/conf.d/rutorrent1*
rm -rf ~/downloads/rutorrent1
4. Reload Apache
/usr/sbin/apache2ctl -k graceful
The additional rTorrent/ruTorrent instance has now been completely removed.