SOLVED SickRage permissions issue

Status
Not open for further replies.

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
I've got an ruTorrent/rTorrent jail and a SickRage jail that both share the same storage location on my volume. rTorrent downloads the files perfectly fine after picking them up from SickRage, but SR can't unrar them and post-process them until I chmod the rar to 777 manually.

What can I do to fix this?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I've got an ruTorrent/rTorrent jail and a SickRage jail that both share the same storage location on my volume. rTorrent downloads the files perfectly fine after picking them up from SickRage, but SR can't unrar them and post-process them until I chmod the rar to 777 manually.

What can I do to fix this?
Here's some possibilities

With transmission you can set what permission level files are written as; maybe rtorrent has a similar setting?
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
Here's some possibilities

With transmission you can set what permission level files are written as; maybe rtorrent has a similar setting?

First, thanks for all the info. I'm pretty bad with Linux permissions in general, so here are my findings:
the Media user in Sickrage has an /etc/passwd entry of:
Code:
media:*:816:816:Media Plugins Daemon:/nonexistent:/usr/sbin/nologin


The user that runs the rTorrent process in the rTorrent jail is named admin:
Code:
admin:*:1001:1001:admin:/home/admin:/bin/sh


To try to fix the problem, I chmod'ed the shared download directory to 777 (I know, it isn't super secure but I'm just trying to make this work). I followed the rTorrent admin's post here, but that feature doesn't seem to be supported anymore.

If it helps, here's my /etc/group:
Code:
wheel:*:0:
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:uucp
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
bind:*:53:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
_dhcp:*:65:
uucp:*:66:
dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:
nogroup:*:65533:
nobody:*:65534:
avahi:*:200:
messagebus:*:201:
hast:*:845:
ladvd:*:78:
webdav:*:666:
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
First, thanks for all the info. I'm pretty bad with Linux permissions in general, so here are my findings:
the Media user in Sickrage has an /etc/passwd entry of:
Code:
media:*:816:816:Media Plugins Daemon:/nonexistent:/usr/sbin/nologin


The user that runs the rTorrent process in the rTorrent jail is named admin:
Code:
admin:*:1001:1001:admin:/home/admin:/bin/sh


To try to fix the problem, I chmod'ed the shared download directory to 777 (I know, it isn't super secure but I'm just trying to make this work). I followed the rTorrent admin's post here, but that feature doesn't seem to be supported anymore.

If it helps, here's my /etc/group:
Code:
wheel:*:0:
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:uucp
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
bind:*:53:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
_dhcp:*:65:
uucp:*:66:
dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:
nogroup:*:65533:
nobody:*:65534:
avahi:*:200:
messagebus:*:201:
hast:*:845:
ladvd:*:78:
webdav:*:666:
so what you are doing is 'solution 4'.
'chmoding' the files one time might work if rtorrent just uses the same permission levels as the directory it's writing in. if it is hard set to 755 or something similar then this wouldnt work.

I'm not sure if your asking for more help based on your post or if the one time chmod worked for you.
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
Sorry I wasn't clear. Prior to making the OP, I changed the folder to 777 but it didn't help.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Sorry I wasn't clear. Prior to making the OP, I changed the folder to 777 but it didn't help.
can you show the permission levels of the downloaded files? feel free to not show the file names.
ls -l /path/to/files

if those aren't 777 like the folder you set then you need to follow 'solution 1-3' that I posted.
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
They seem to be all across the board. There's a mixing of files that rTorrent has downloaded and I've tried to chmod and files that I've uploaded for rTorrent to seed for me.

Code:
drwxrwxrwx  3 921     wheel            15 Jun  6 16:13 
drwxrwxrwx  3 921     wheel            16 Jun  6 12:23 
drwxrwxrwx  3 1001    nogroup          21 Aug 16 21:32 
-rwxr-xr-x  1 root    nogroup        1272 Aug 16 00:30 
drwxr-xr-x  7 1001    nogroup           7 Aug 15 11:34 
drwxrwxrwx  4 921     wheel            26 Jun  6 00:42 
drwxrwxrwx  3 921     wheel            63 Jun  6 00:21 
drwxrwxrwx  3 921     wheel            26 Jun 11 20:26 
drwxrwxrwx  2 921     wheel            26 Jun  7 22:36 
-rwxrwxrwx  1 1001    nogroup  1401516029 Aug 10 21:16 
-rwxrwxrwx  1 1001    nogroup  1442576025 Aug 11 21:08 
-rwxrwxrwx  1 1001    nogroup  1386259117 Aug 12 08:21 
drwxrwxrwx  3 1001    nogroup          27 Aug 15 02:00 
drwxrwxrwx  3 1001    nogroup          26 Aug 15 10:50 
drwxrwxrwx  3 1001    nogroup          29 Aug 15 10:52 
drwxrwxrwx  3 1001    nogroup          25 Aug 15 12:35 
drwxrwxrwx  2 921     wheel             3 Aug  6 22:43 
drwxrwxrwx  2 1001    nogroup           4 Aug 11 16:49
drwxrwxrwx  5 921     wheel            55 Aug  8 01:47 
drwxrwxrwx  2 921     wheel             3 Jun 14 22:35 
drwxrwxrwx  2 921     wheel            52 Jun  6 20:55 
drwxrwxrwx  2 921     wheel            19 Jun  6 20:05 
drwxrwxrwx  5 921     wheel            55 Aug  8 01:47 
drwxrwxrwx  5 921     wheel            55 Aug  8 01:48 
drwxrwxrwx  2 921     wheel             4 Jun  6 16:56 
drwxrwxrwx  2 921     wheel             4 Jun  6 16:53 
drwxr-xr-x  3 root    nogroup          30 Aug 15 18:19 (directory)
drwxr-xr-x  6 1001    nogroup           6 Aug 16 00:40 (directory)
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
They seem to be all across the board. There's a mixing of files that rTorrent has downloaded and I've tried to chmod and files that I've uploaded for rTorrent to seed for me.

Code:
drwxrwxrwx  3 921     wheel            15 Jun  6 16:13
drwxrwxrwx  3 921     wheel            16 Jun  6 12:23
drwxrwxrwx  3 1001    nogroup          21 Aug 16 21:32
-rwxr-xr-x  1 root    nogroup        1272 Aug 16 00:30
drwxr-xr-x  7 1001    nogroup           7 Aug 15 11:34
drwxrwxrwx  4 921     wheel            26 Jun  6 00:42
drwxrwxrwx  3 921     wheel            63 Jun  6 00:21
drwxrwxrwx  3 921     wheel            26 Jun 11 20:26
drwxrwxrwx  2 921     wheel            26 Jun  7 22:36
-rwxrwxrwx  1 1001    nogroup  1401516029 Aug 10 21:16
-rwxrwxrwx  1 1001    nogroup  1442576025 Aug 11 21:08
-rwxrwxrwx  1 1001    nogroup  1386259117 Aug 12 08:21
drwxrwxrwx  3 1001    nogroup          27 Aug 15 02:00
drwxrwxrwx  3 1001    nogroup          26 Aug 15 10:50
drwxrwxrwx  3 1001    nogroup          29 Aug 15 10:52
drwxrwxrwx  3 1001    nogroup          25 Aug 15 12:35
drwxrwxrwx  2 921     wheel             3 Aug  6 22:43
drwxrwxrwx  2 1001    nogroup           4 Aug 11 16:49
drwxrwxrwx  5 921     wheel            55 Aug  8 01:47
drwxrwxrwx  2 921     wheel             3 Jun 14 22:35
drwxrwxrwx  2 921     wheel            52 Jun  6 20:55
drwxrwxrwx  2 921     wheel            19 Jun  6 20:05
drwxrwxrwx  5 921     wheel            55 Aug  8 01:47
drwxrwxrwx  5 921     wheel            55 Aug  8 01:48
drwxrwxrwx  2 921     wheel             4 Jun  6 16:56
drwxrwxrwx  2 921     wheel             4 Jun  6 16:53
drwxr-xr-x  3 root    nogroup          30 Aug 15 18:19 (directory)
drwxr-xr-x  6 1001    nogroup           6 Aug 16 00:40 (directory)
What I'm trying to see if what permissions rtorrent downloads files as. Please post the permission level of a file rtorrent downloaded that you haven't changed.

Also, please confirm which 'Solution' from the thread I keep mentioning you are trying to implement. At first it seemed like you were going to try to use 'groups', but then when I point you to 'Solution 3' which is exactly what you need to do, you seemed to start opting for using 'other' permissions.
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
What I'm trying to see if what permissions rtorrent downloads files as. Please post the permission level of a file rtorrent downloaded that you haven't changed.

Also, please confirm which 'Solution' from the thread I keep mentioning you are trying to implement. At first it seemed like you were going to try to use 'groups', but then when I point you to 'Solution 3' which is exactly what you need to do, you seemed to start opting for using 'other' permissions.

I downloaded a show and didn't touch it. The directory looks like this:
Code:
drwxr-xr-x   2 1001    nogroup          20 Aug 16 22:19 

and the files in that directory look like this:
Code:
-rw-r--r--   1 1001  nogroup  50000000 Aug 16 22:13


Solution #3 is the one I'm struggling with. The top-level folder that I'm trying to give both jails permissions to is "downloads" which looks like this:
Code:
drwxrwxrwx   4 root    nogroup   4 Aug 16 22:19 downloads/


In the instructions in your post, you say to match the GID of the group owning the folder, but it looks like it belongs to nobody?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ok, so it looks like rtorrent did what I expected and copied the directory permissions, while removing the 'execute' bit which means something different for directories.
So if you want 'chmod -R 777 /path/to/files' should work, but that's solution 4.

For solution 3, you should be adding the 'media' user to the 'nogroup' group in the the sickrage jail.
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
Ok, so it looks like rtorrent did what I expected and copied the directory permissions, while removing the 'execute' bit which means something different for directories.
So if you want 'chmod -R 777 /path/to/files' should work, but that's solution 4.

For solution 3, you should be adding the 'media' user to the 'nogroup' group in the the sickrage jail.

Okay, I added 'media' to 'nogroup' and also the 'wheel' group because the folder in the sickrage jail that 'downloads' is mounted into looks like this:
Code:
drwxrwxrwx  10 root  wheel    10 Aug 16 17:40 TV
drwxrwxrwx  50 root  nogroup  73 Aug 17 16:48 seeds 


What's supposed to happen is this:
-rTorrent downloads the show into the 'seeds' folder
-SickRage unrar's the download if there is one
-SickRage copies the file into the TV folder and gives it a pretty name

But the problem still persists.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Okay, I added 'media' to 'nogroup' and also the 'wheel' group because the folder in the sickrage jail that 'downloads' is mounted into looks like this:
Code:
drwxrwxrwx  10 root  wheel    10 Aug 16 17:40 TV
drwxrwxrwx  50 root  nogroup  73 Aug 17 16:48 seeds 


What's supposed to happen is this:
-rTorrent downloads the show into the 'seeds' folder
-SickRage unrar's the download if there is one
-SickRage copies the file into the TV folder and gives it a pretty name

But the problem still persists.
based on what you have there SickRage, should have no problem writing/deleting files because the folder is writable by all users.

can you should the permissions of the file SR needs to process, and the folder it needs to write to from the SickRage jail's perspective.
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
based on what you have there SickRage, should have no problem writing/deleting files because the folder is writable by all users.

can you should the permissions of the file SR needs to process, and the folder it needs to write to from the SickRage jail's perspective.
I changed the group of the TV directory (destination of the post-processing) to nogroup from wheel to see if it would help but it didn't.
Code:
drwxrwxrwx  10 root  nogroup  10 Aug 16 17:40 TV
drwxrwxrwx  51 root  nogroup  74 Aug 17 23:11 seeds


Inside of the seeds directory, here's one I haven't manually chmod'd:
Code:
drwxr-xr-x   3 1001    nogroup          18 Aug 17 23:11 

And the files inside that episode's directory:
Code:
-rw-r--r--   1 1001  nogroup  50000000 Aug 17 23:09 episode.rar


I'm not sure if it makes a difference, but my /etc/group in FreeNAS has no 'media' or 'rtorrent' user in it.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I changed the group of the TV directory (destination of the post-processing) to nogroup from wheel to see if it would help but it didn't.
Code:
drwxrwxrwx  10 root  nogroup  10 Aug 16 17:40 TV
drwxrwxrwx  51 root  nogroup  74 Aug 17 23:11 seeds


Inside of the seeds directory, here's one I haven't manually chmod'd:
Code:
drwxr-xr-x   3 1001    nogroup          18 Aug 17 23:11 

And the files inside that episode's directory:
Code:
-rw-r--r--   1 1001  nogroup  50000000 Aug 17 23:09 episode.rar


I'm not sure if it makes a difference, but my /etc/group in FreeNAS has no 'media' or 'rtorrent' user in it.
OK I see the issue. it looks like rtorrent is creating files with 644 permissions regardless of the folder above it. only the owner can modify them.

so you either need to...
* find a way to change the permission level rtorrent writes files as (which you looked into, not sure if there was a conclusion)
* SickRage and rtorrent need to use users with a matching UID (Solution 2 from the thread I linked)
 

Fish

Contributor
Joined
Jun 4, 2015
Messages
108
OK I see the issue. it looks like rtorrent is creating files with 644 permissions regardless of the folder above it. only the owner can modify them.

so you either need to...
* find a way to change the permission level rtorrent writes files as (which you looked into, not sure if there was a conclusion)
* SickRage and rtorrent need to use users with a matching UID (Solution 2 from the thread I linked)

Thank you so much for helping me this far. Everything is working flawlessly now.

For those who may be having the same issue, here's what I had to do:
I initially followed this guide to set the 2 jails up
- Create a new user in the rTorrent jail with UID 816 (same as media user in SR jail, I named it 'rtuser'. Old rTorrent user was 'admin') and match the old user's group memberships (wheel,nogroup for me)
- Create rtuser's home directory (/home/rtuser)
- CP /home/admin /home/rtuser
- su rtuser
- chown ~
- Edit /home/rtuser/.rtorrent.rc to make sure it points the .session directory to this user's home directory
- After firing up rTorrent for the first time, I got this message:
autotools: Plugin will not work. rTorrent user can't access external program (php).
[14.10.2012 11:59:02] trafic: Plugin will not work. rTorrent user can't access external program (php).
[14.10.2012 11:59:03] DataDir plugin: rTorrent user can't access php interpreter. Plugin will not work.
This can be fixed by switching to the new user and chown'ing /usr/local/www/rutorrent

-Also, I usually started rtorrent by issuing the following:
Code:
su admin
screen -dmS rscreen rtorrent

but when I tried this with the new user, it gave me this error:
Error opening terminal: screen
This can be fixed by starting rTorrent like this:
Code:
su rtuser
screen
export TERM=xterm
rtorrent
(Ctrl+A, D)


Again, thanks so much for the help.

If anyone wants to give me a hand trying to script that so rTorrent starts on boot, that would be awesome. Otherwise, the initial problem is completely resolved.
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
good job working all through all that!
 
Status
Not open for further replies.
Top