[SOLVED] rutorrent only works when rtorrent is root

lisas4567

Member
May 25, 2018
773
0
16
Hi, I'm a gentoo user.

My installed packages are:-

net-p2p/rtorrent-0.8.9 USE="daemon ipv6 xmlrpc -color -debug -test"
dev-libs/xmlrpc-c-1.28.03 USE="cgi curl cxx libxml2 -abyss -libwww -static-libs -threads -tools"
www-apps/rutorrent-3.3 USE="-vhosts"
www-servers/apache-2.2.21-r1
www-apache/mod_scgi-1.14

I have all of the above working together with rtorrent running as a daemon but only if rtorrent is running as root. If I set USER="rtorrent" in /etc/conf.d/rtorrentd then rtorrent starts ok and can be accessed through screen and works fine but when I try and access through a browser the rutorrent page loads ok but without any data from rtorrent.

"Bad link to rTorrent. Check if it is really running. Check $scgi_port and $scgi_host settings in config.php and scgi_port in rTorrent configuration file." is the error message in the Logger Tab of the web page. With rtorrent running as root the page is fully populated.

I thought the problem might be fixed by settings in 20_mod_scgi.conf which is the config file for the apache scgi module. But anything I've tried in there hasn't helped.

I guess that error means rtorrent doesn't have access rights to the apache scgi port or a file somewhere. But I can't figure it and it doesn't seem to be a problem others are having. Anyone seen this problem or know the solution. It doesn't seem like a good idea to run rtorrent as root.
 

lisas4567

Member
May 25, 2018
773
0
16
OK. It's sorted. I should have realised what was happening sooner than I did.

I have always run rtorrent on Gentoo as a psuedo daemon on a 24hr on server using the screen programme. I had set up a dedicated user called rtorrent with no home directory and I had a centrally located config at /etc/rtorrent.conf. The user and location of the config are set in /etc/conf.d/rtorrentd. And rtorrent ran great like that. Windows users on this home network could simply drop .torrent files into the rtorrent watch directory which was also a samba share and rtorrent would do the rest.

So when I installed rutorrent I added the necessary "scgi_port = " to /etc/rtorrent.conf. rtorrent ran ok as before and rutorrent came up in the browser but no connection between the two. See error in first post. So in trying to sort the problem which looked to my inexperienced eye like an scgi problem I ran rtorrent interactively as root. In order to do this I copied /etc/rtorrent.conf to /root/.rtorrent.rc so rtorrent would know the scgi_port details. That worked. So then I tried running the daemon as root and that worked. So that's what gave me the impression the problem was related to running the daemon as an unprivileged user.

But what I was slow to realise was that root having a .rtorrent.rc was the real issue. So to cut a long story short, I have now created a home directory for my rtorrent user and moved the centrally located config file to /home/rtorrent/.rtorrent.rc and that works. So I guess rutorrent must access the config file of rtorrent directly. The error message in my first post must be a bit of a catch all.

And just watch that since screen and rtorrent are often used together, the config file for rtorrent is .rtorrent.rc and for screen is .screenrc. Not .screen.rc as I was trying to use for a brief period and scratching my head why some screen tweaks weren't working.