Help with user management with autodl-setup

saroos1

Member
May 25, 2018
718
0
16
Hi, I have installed the autodl-setup script for easy install of rtorrent et rutorrent.

(installed with this guide: http://seedmybox.com/wiki/index.php?title=Install_Rutorrent )

I have also searched for an answer for this question: How I can remove and add user without re-run the script ? With no result.

I have tried to manipulate some files; the autodl_<username> in /etc/init.d/ and password file in apache2, the rtorrent.rc in user directory and the configuration in rtorrent interface in /var/rtorrent . But nothing work.

I'm a beginner with *nix and I want, if possible, a script for add/remove user.

I'm using Debian 6 X64. I can provide more information on demand, thank.
 

lisas4567

Member
May 25, 2018
773
0
16
you can manually add users. Please see this:


http://code.google.com/p/rutorrent/wiki/Config



you need to add the folowing:

a unix user (for rtorrent to run)
the .rtorrent.rc for this user (with unique settings)
Some method of using scgi (i tend to recommend the plugin versions like rpc or httprpc)
a unique rutorrent config (as per wiki)

Then follow the manual options for this:

http://code.google.com/p/rutorrent/wiki/PluginAutodlirssi


You could also pay someone to set it up for you if this is outside of your abilities.
 

saroos1

Member
May 25, 2018
718
0
16
How create a RPC SCGI port on new rtorrent, this is the point I don't find any answer.
And how to link them to WebUi and Apache2 ?
 

simur612

Member
May 25, 2018
879
0
16
it depends on how you have things setup.

Some people use the webserver, in whoch case you'll need to consult the documentation to your webserver, for apache it's something like:

Code:
SCGIMount /RPC2 127.0.0.1:5000

in your apache config.

For lighttpd it is more like:

Code:
rtorrent.rc: scgi_local = /home/user/rtorrent/rpc.socket

lighttpd.conf:
server.modules += ( "mod_scgi" )
scgi.server = (
"/RPC2" =>
( "127.0.0.1" =>
(
"socket" => "/home/user/rtorrent/rpc.socket",
"check-local" => "disable",
"disable-time" => 0, # don't disable scgi if connection fails
)
)
)

if you want to go the eaiser route, just use the httprpc plugin and forgo webserver configuration (it handles it in php and is more secure anyways)


of course you'll need a unique setting in the rutorrent user config for each user
 

saroos1

Member
May 25, 2018
718
0
16
I have created 'autodl_vidangeur' in /etc/init.d
Code:
#!/bin/sh
# chkconfig: 2345 85 15
# description: Start autodl-irssi and rtorrent
### BEGIN INIT INFO
# Provides: autodl_vidangeur
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start autodl-irssi and rtorrent
# Description: Start autodl-irssi and rtorrent
### END INIT INFO

NAME=autodl_vidangeur
USER=vidangeur
SESSIONNAME=autodl

resetPath() {
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
}
resetPath

# Make sure the path is correct, and make sure we're in the home dir.
USER_INIT="umask 022; cd; PATH=\$PATH:$PATH"

# Run user command, ignoring any messages sent to stdout (eg. 'No mail.')
runUserCmd() {
su - $USER -c "$USER_INIT; $1" >/dev/null && return 0
return 1
}

isStarted() {
su - $USER -c "$USER_INIT; screen -ls | grep -qE \"[ ][0-9]+\\.$SESSIONNAME[ ]\"" >/dev/null && return 0
return 1
}

startIt() {
isStarted && return 0

local START_IRSSI=n
local START_RTORRENT=n
which irssi > /dev/null 2>&1 && START_IRSSI=y
which rtorrent > /dev/null 2>&1 && START_RTORRENT=y

case $START_IRSSI$START_RTORRENT in
yy)
runUserCmd "screen -S $SESSIONNAME -d -t rtorrent -m rtorrent"
runUserCmd "screen -d -r $SESSIONNAME -X screen -t irssi irssi"
;;
yn)
runUserCmd "screen -S $SESSIONNAME -d -t irssi -m irssi"
;;
ny)
runUserCmd "screen -S $SESSIONNAME -d -t rtorrent -m rtorrent"
;;
nn)
;;
esac
return 0
}

stopIt() {
isStarted || return 0

runUserCmd "screen -d -r $SESSIONNAME -p irssi -X stuff \"/quit
/quit
\""
runUserCmd "screen -d -r $SESSIONNAME -p rtorrent -X xon"

for i in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4; do
isStarted || break
sleep 1
done

# If it's still not stopped, kill the whole screen session
if isStarted; then
echo -n "Couldn't stop it. Killing screen session..."
runUserCmd "screen -d -r $SESSIONNAME -p rtorrent -X xon"
sleep 2
runUserCmd "screen -d -r $SESSIONNAME -X quit"
echo "Done."
fi

return 0
}

v_restartIt() {
v_stopIt
v_startIt
}

v_showStatus() {
if isStarted; then
echo "$NAME is running."
else
echo "$NAME is stopped."
fi
}

. /lib/lsb/init-functions

v_startIt() {
log_begin_msg "Starting $NAME..."
startIt
log_end_msg $?
}

v_stopIt() {
log_begin_msg "Stopping $NAME..."
stopIt
log_end_msg $?
}

resetPath # Some include files may have reset it
LOCKFILE=
updateLock() {
[ -z "$LOCKFILE" ] && return
if isStarted; then
touch $LOCKFILE
else
rm -f $LOCKFILE
fi
}

RETVAL=0
case $1 in
start)
v_startIt
;;
stop)
v_stopIt
;;
force-reload|restart)
v_restartIt
;;
try-restart)
isStarted && v_restartIt
;;
status)
v_showStatus
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
RETVAL=1
;;
esac

updateLock
exit $RETVAL
This is a copy of other user, I have edited the first 3 parameters.

After I haved added user in /etc/apache2/rutorrent_passwd

And I have edited the file in /etc/apache2/sites-available/rutorrent
I have added lines for 'vidangeur'

Code:
ServerName localhost

<VirtualHost *:80>

ServerAdmin admin@rutorrent
ServerName ***hidden for security***
DocumentRoot /var/rutorrent

<Directory />
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Location />
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require valid-user
Order allow,deny
Allow from all
</Location>
<Location ~ "^/rutorrent/(conf|share)">
Order deny,allow
Deny from all
</Location>
<Location ~ "/\\.svn">
Order deny,allow
Deny from all
</Location>
<Location "/RPC00001">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user levelkro
</Location>
<Location "/RPC00002">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user macgyver
</Location>
<Location "/RPC00003">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user ggmagla
</Location>
<Location "/RPC00004">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user vidangeur
</Location>
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/rutorrent.pem
ServerAdmin admin@rutorrent
ServerName ***hidden for security***
DocumentRoot /var/rutorrent

<Directory />
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Location />
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require valid-user
Order allow,deny
Allow from all
</Location>
<Location ~ "^/rutorrent/(conf|share)">
Order deny,allow
Deny from all
</Location>
<Location ~ "/\\.svn">
Order deny,allow
Deny from all
</Location>
<Location "/RPC00001">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user levelkro
</Location>
<Location "/RPC00002">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user macgyver
</Location>
<Location "/RPC00003">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user ggmagla
</Location>
<Location "/RPC00004">
AuthType Basic
AuthName "My ruTorrent web site"
AuthUserFile "/etc/apache2/rutorrent_passwd"
Require user vidangeur
</Location>
</VirtualHost>
#SCGIMount /RPC00001 127.0.0.1:23876
#SCGIMount /RPC00002 127.0.0.1:23879
#SCGIMount /RPC00003 127.0.0.1:23885
#SCGIMount /RPC00004 127.0.0.1:23890

For the user directory;
/home/vidangeur/downloads
/home/vidangeur/rtorrent
/home/vidangeur/rtorrent/watch
/home/vidangeur/rtorrent/session
And the config file for rtorrent, rtorrent.rc look like;
Code:
scgi_port = 127.0.0.1:23890
encoding_list = UTF-8
system.umask.set = 022
port_range = 23895-23895
port_random = no
check_hash = no
directory = /home/vidangeur/downloads
session = /home/vidangeur/rtorrent/session
encryption = allow_incoming, try_outgoing, enable_retry
schedule = watch_directory,1,1,"load_start=/home/vidangeur/rtorrent/watch/*.torrent"
#schedule = untied_directory,5,5,"stop_untied=/home/vidangeur/rtorrent/watch/*.torrent"
trackers.enable = 1
#min_peers = 40
#max_peers = 100
#min_peers_seed = 10
#max_peers_seed = 50
#max_uploads = 15
#download_rate = 0
#upload_rate = 0
use_udp_trackers = yes
dht = auto
dht_port = 6881
peer_exchange = yes
#hash_read_ahead = 10
#hash_interval = 100
#hash_max_tries = 10
execute = {sh,-c,/usr/bin/php /var/rutorrent/rutorrent/php/initplugins.php vidangeur &}

And for finish, I have created files for WebUi rutorrent;
added directory 'vidangeur' for user in /var/rutorrent/rutorrent/conf/users
config.php look like;
Code:
<?php
$scgi_port = 23890;
$scgi_host = "127.0.0.1";
$XMLRPCMountPoint = "/RPC00004";
?>
All other users created by the setup of 'autodl-setup' work fine. (levelkro, ggmagla and macgyver)
Apache is restarted
'autodl_vidangeur' was started, the process rtorrent exists for user 'vidangeur'
All files and code is copied from user 'macgyver'

I'm running Debian 6 X64 with Apache 2 and Webmin is installed.
 

saroos1

Member
May 25, 2018
718
0
16
What is wrong ?

APACHE LOGIN : OK
RUTORRENT CONFIG : OK - SCGI link don't work, because rTorrent is not started
RTORRENT : Don't start
 

lisas4567

Member
May 25, 2018
773
0
16
you need start it try the following

ssh
login as root
type chmod 777 /var/run/screen

login as each user and type

screen rtorrent