How to set up rutorrent 3.0 with multi-user support

lisas4567

Member
May 25, 2018
773
0
16
NOTE: I will be re-writing this in the next day or so. Also be on the lookout for os specific guides.


This will explain the basic concepts behind rutorrent multi-user support.

It's important to note that this multiple user support STILL requires multiple rtorrent clients (one for each user) running on multiple scgi mounts. The only thing this new feature does is somewhat simplify setting up multiple users and allow you to run with a single domain.

It's also important to note that some form of authentication in your webserver is an integral part of this new multiple user setup and without authentication, this mod doesn't work. If you want multiple users without authentication then you need to user mutliple rutorrent directories as per the old method.


First, you need to create mutliple unix users. Each unix is different in this respect, and most have multiple methods of doing this, so seek out your specific documentation for how to do this.

once you have multiple users, you'll want to create a .rtorrent.rc for each user. you can use relative paths for stuff making the download directory and session directory easier to set up, but how you do this is really up to you. What is important here is that the FOLLOWING things are different in your .rtorrent.rc:

port for rtorrent (or range if you use a range, though you can get away with a single port in rtorrent for each user by doing something like this:
Code:
port_range = 51000-51000
scgi port
Code:
scgi_port = 127.0.0.1:5001
and if you use a dht port, this should be different as well. If you wish to make other settings you can, like i said, this is mainly up to you and i'd refer to rtorrent documentation for this.

once you have this, you'll want to set up multiple scgi mounts in your webserver...if you've installed rutorrent before then you know how to do this, it is different for ALL webservers, but what is important is that you have one mount for EACH user. The port should match whatever you set in the users .rtorrent.rc

you should also be sure to set up basic authentication. Your best bet is to put this on the web root which rutorrent will be run from. Set one username/password for each user. Again, this will varry from server to server so seek out your documentation.


now, you just need to get the rutorrent files. currently, the only method of downloading the rutorrent files for 3.0 is via svn so install subversion on your system and use the following command:
Code:
svn checkout http://rutorrent.googlecode.com/svn/branches/3.0/
this will download all the rutorrent 3.0 files AND all the rutorrent 3.0 plugins. Then, what you need to do is remove the rpc plugin, remove darkpal if you think it's as ugly as i do, and any other plugin you don't wish to use. This would look like this provided you JUST finished downloading via svn:
Code:
cd 3.0
rm -r plugins/rpc plugins/darkpal rutorrent/plugins
mv plugins/ rutorrent/
now you need to change some permissions or ownership. lets assume your webserver is owned by user www, you could do the following:
Code:
cd rutorrent/
chown -R www:www share/
if you don't know your webuser's name, just use chmod 777 instead like this:
Code:
cd rutorrent/
chmod -r 777 share/
now, you need to add a directory for each user in the conf/users/ directory and copy the config files for each into that dir, then edit each accordingly.
We're going to pretend you set up 4 users
user1 = wonslung and his SCGI mount is on /RPC1 and port 5001 (he's the coolest user you have)
user2 = jeff and his SCGI mount is on /RPC2 and port 5002
user3 = snott and his SCGI mount is on /RPC3 and port 5003
user4 = booger and his SCGI mount is on /RPC3 and port 5004

get the idea?
ok
so you're probabaly still in the rutorrent directory, this is good....we want to change to the conf dir and make some user directories
Code:
cd conf/
mkdir users/wonslung
mkdir users/jeff
mkdir users/snott
mkdir users/booger
now, if you do a ls you'll notice 3 files here:

Code:
wonslung@debian-pvm:/var/www/rutorrent/conf$ ls
access.ini config.php plugins.ini users

you need to copy these files into each user directory like so:
Code:
cp access.ini config.php plugins.ini users/wonslung
cp access.ini config.php plugins.ini users/jeff
cp access.ini config.php plugins.ini users/snott
cp access.ini config.php plugins.ini users/booger

now, it's important to know what these files do and what to change.
the most IMPORTANT file is config.php because it has the connection info. by default it looks like this:
Code:
<?php
// configuration parameters

@define(&#39;HTTP_USER_AGENT&#39;, &#39;Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0&#39;, true);
@define(&#39;HTTP_TIME_OUT&#39;, 30, true); // in seconds
@define(&#39;HTTP_USE_GZIP&#39;, true, true);
@define(&#39;RPC_TIME_OUT&#39;, 15, true); // in seconds
@define(&#39;LOG_RPC_CALLS&#39;, false, true);
@define(&#39;LOG_RPC_FAULTS&#39;, true, true);

$do_diagnostic = true;
$log_file = &#39;/tmp/errors.log&#39;; // path to log file (comment or make empty to disable logging)
$saveUploadedTorrents = true;

$scgi_port = 5000;
$scgi_host = "127.0.0.1";
$XMLRPCMountPoint = "/RPC2";

$pathToPHP = &#39;&#39;; // Something like /bin/php. If empty, will be founded in PATH.
$pathToCurl = &#39;&#39;; // Something like /bin/curl. If empty, will be founded in PATH.

// For web->rtorrent link through unix domain socket
// (scgi_local in rtorrent conf file), change variables
// above to something like this:
//
// $scgi_port = 0;
// $scgi_host = "unix:///tmp/rpc.socket";

?>


The parts you really need to pay attention to are these lines:

Code:
$scgi_port = 5000;
$scgi_host = "127.0.0.1";
$XMLRPCMountPoint = "/RPC2";

you need to edit the port and scgi mount for your user to match what you've previously set.

when you are setting a multiple user setup the files in the default conf/ dir can be left as default, it's only the files in the conf/users/USERNAME file which you copied which need to be editted.

Also, another thing which i'd like to note. A lot of people like to change the directory settings in this file. Don't unless you know what you are doing. These directories ARE NOT the same as your torrent directory or you download directory. They MUST be relative paths and they are only for internal rtorrent use.

anyways, if you did everything right, when you go to your page you should be ask to put in a username and password

depending on what you pick, you'll get a different user.

The other files which you copied are mainly to allow or disallow config options. If you wish to limit your users you can edit both access.ini and plugin.ini accordingly for each user.

good luck
 
Last edited:

peshua19

Member
May 25, 2018
897
0
16
Then, what you need to do is remove the rpc plugin, remove darkpal if you think it's as ugly as i do, and any other plugin you don't wish to use.​

You can simple disable it's in conf/plugins.ini. Or in conf/users/username/plugins.ini.

now you need to change some permissions or ownership. lets assume your webserver is owned by user www, you could do the following​

rTorrent user also must has access for this directory for read (and for write\execute for some subdirs like rss\cache)

now, if you do a ls you'll notice 3 files here:
Code:
wonslung@debian-pvm:/var/www/rutorrent/conf$ ls
access.ini config.php plugins.ini users
you need to copy these files into each user directory like so:​

1) You need to copy only one file (config.php) in common case. If you want have separate plugins/access for each user - you must copy (and edit) files access.ini and plugins.ini too.
2) File conf/users/username/config.php may contents only lines different from lines in conf/config.php - *both* files will be included (of course, conf/users/username/config.php will be included if it exists only)
3) Also, all plugins can has separate config files for each user too. Its is placed in conf/users/{user name in lower case}/plugins/{plugin name}. For example, conf/users/username/plugins/create/config.php.

Also, another thing which i'd like to note. A lot of people like to change the directory settings in this file. Don't unless you know what you are doing. These directories ARE NOT the same as your torrent directory or you download directory. They MUST be relative paths and they are only for internal rtorrent use.​

This file doesn't contains any directory settings now.
 

lisas4567

Member
May 25, 2018
773
0
16
Thanks for the updates , i was just guessing at a lot of it. I'll update the guide with this info.
 

randac56

Member
May 25, 2018
915
0
16
I'm thinking about doing this, but have one question.

Is there a way to set a global speed setting? What i mean is can you set the max upload speed for ALL users combined at say 65KB?

Even better would be being able to still use the scheduler plugin but have one users settings be the default maximum combined for all users.

Since you're basically running multiple instances of rtorrent, I don't think this would be possible, but I figured I'd ask in case someone has managed to work around this.
 

lisas4567

Member
May 25, 2018
773
0
16
yes, in 3.0 you can set global speed settings via the lower menu bar, i'll post screen shots. It's wonderful
 

lisas4567

Member
May 25, 2018
773
0
16
i just reread your question. To set a global limit for ALL users would fall to your firewall. This is very much outside the scope of rutorrent and in my opinion shouldn't be added.


As always, you can limit users via .rtorrent.rc to a max speed per user and then amke it where they can't change this.

I misunderstood what you were asking.

If you need something like what you are wanting, you should read up on pf and altq

(this of course is limited to FreeBSD, for linux i'm not sure what traffic shaping software you'd use, maybe one of the linux people can comment on that)
 

simur612

Member
May 25, 2018
879
0
16
For limiting traffic per network interface in Linux the simplest solution is a simple script named "wondershaper". For limiting per application basis, one can use trickle.
 

lisas4567

Member
May 25, 2018
773
0
16
another thing you should know which may help. rtorrent will run happily with a single port. I've run 400 torrents using just one port. This can help TREMENDOUSLY when trying to shape traffic. Most shapers will let you shape via port, ip, or even protocol.
 

saroos1

Member
May 25, 2018
718
0
16
Hello again lisa,

I am being a real n00b here, but can you point me to a decent guide how to add mount point in lighttpd on debian/centos. I have tried to no avail....
Any help would be great.............

Thanks,
 

simur612

Member
May 25, 2018
879
0
16
sure.

if i know what you are asking.....

when you say a mount point....that could be a number of things.

Do you mean a name based vhost?

do you mean a subdirectory?

do you mean an ip based vhost?

do you mean an alias (similar to a subdirectory)
 

peshua19

Member
May 25, 2018
897
0
16
Hi guys, sorry for the late reply, but i perservered, and got multiusers
. Thank you for the links


Stubs
 

lisas4567

Member
May 25, 2018
773
0
16
I'm glad. It's great isn't it?

I finally got all my stuff working on solaris thanks to novice. It runs amazingly well on solaris believe it or not.
 

saroos1

Member
May 25, 2018
718
0
16
this is a good guide on how to setup rutorrent for multi-users but don't you think you should explain how to start up every users rtorrent after the server has been rebooted? or if rtorrent crashes?

here's how to do it:

Quote
What I did is the following in crontab .

1. login with the user that runs rtorrent
2. type crontab -e , and put below in it and save :

@reboot /usr/local/bin/chkrtorrent >/dev/null 2>&1
@reboot /usr/bin/screen -D -m /usr/local/bin/rtorrent
*/5 * * * * /usr/local/bin/chkrtorrent >/dev/null 2>&1

Than put attached script in /usr/local/bin
chmod the file to 777

Above crontabs & script will make sure that rtorrent starts @boot , and will check every 5 minutes if it is still running, and if not , will restart it.​


all credit for this goes to [email protected]

edit: i see this has been posted here: http://forums.rutorrent.org/index.php?topic=121 why not integrate it here?
 

simur612

Member
May 25, 2018
879
0
16
lol, that's my script too


The reason i don't explain it, is because different people use different methods. I use crontab but a lot of people use a multi-user init.d script.



also, i intend to re-write this guide. It was originally written the DAY 3.0 beta showed up in the svn repos.
 

peshua19

Member
May 25, 2018
897
0
16
which version of the script do you have? The latest versions have the lockfile removal and disk space checking
 

simur612

Member
May 25, 2018
879
0
16
It's really cool feature! But how to logout from current session?
I want to place logout button near help button. How can i do this?