plugins can copy but not remove folders after download

Status
Not open for further replies.

nfdevil

Dabbler
Joined
May 5, 2014
Messages
15
Hi,

I've finally figured out how to set the Unix permissions so that my plugins (couchpotato, sonarr, headphones) can send a download request to my transmission plugin, it downloads and the plugins copy the data to my media/movies, media/series, ...

However, the plugins seem to be unable to remove the folder after it is copied, while in all the settings of them I selected to remove the folder after download.

I have:

<groupname>:<users in group>
media: media,couchpotato,sonarr,headphones
downloader: media,couchpotato,sonarr,headphones,transmission

On the jails (jexec <id>) the same users and groups exist (by using pw addgroup, modgroup, adduser ...)

plugin users
couchpotato runs on user couchpotato (with sysrc "couchpotato_user=couchpotato"
sonarr on user sonarr
headphones on user media (something failed here trying to use user headphones, but it doesnt matter)
transmission on user transmission


The folders that have to be deleted have the permissions: drwxrwxr-x transmission:downloader

Any idea what could be wrong here?

Thanks for the help!

Nils
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi,

I've finally figured out how to set the Unix permissions so that my plugins (couchpotato, sonarr, headphones) can send a download request to my transmission plugin, it downloads and the plugins copy the data to my media/movies, media/series, ...

However, the plugins seem to be unable to remove the folder after it is copied, while in all the settings of them I selected to remove the folder after download.

I have:

<groupname>:<users in group>
media: media,couchpotato,sonarr,headphones
downloader: media,couchpotato,sonarr,headphones,transmission

On the jails (jexec <id>) the same users and groups exist (by using pw addgroup, modgroup, adduser ...)

plugin users
couchpotato runs on user couchpotato (with sysrc "couchpotato_user=couchpotato"
sonarr on user sonarr
headphones on user media (something failed here trying to use user headphones, but it doesnt matter)
transmission on user transmission


The folders that have to be deleted have the permissions: drwxrwxr-x transmission:downloader

Any idea what could be wrong here?

Thanks for the help!

Nils
I don't know who user "couchpotato" or "sonarr" is. What UIDs are those mapped to?

If you pick and execute an alternative from this post, your problem will be solved
https://forums.freenas.org/index.ph...plugins-write-permissions-to-your-data.27273/
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Another important thing is who owns the parent directory? if you don't have write permissions on the parent you can't delete things from inside that directory.
 

nfdevil

Dabbler
Joined
May 5, 2014
Messages
15
I don't know who user "couchpotato" or "sonarr" is. What UIDs are those mapped to?

If you pick and execute an alternative from this post, your problem will be solved
https://forums.freenas.org/index.ph...plugins-write-permissions-to-your-data.27273/
Hi Joshua, thanks for the reaction. I've based current solution on your post indeed, it helped me soo much!
That is why I'm surprised it doens't work with the removal.

So, to answer the questions
the users on FreeNAS itself (using awk '{print $1}' /etc/passwd):
Code:
couchpotato:*:1002:1002:Couchpotato
sonarr:*:1003:1002:Sonarr
headphones:*:1004:1002:Headphones
transmission:*:921:1003:Transmission
plex:*:972:1002:Plex
xbmc:*:1007:1002:XBMC
guest:*:1008:65533:Guest
ipad:*:1009:1004:Ipad
subsonic:*:1010:1002:Subsonic
media:*:816:1002:Media


the groups on FreeNAS (using awk '{print $1}' /etc/group):
Code:
admin:*:1001:root
media:*:1002:root,devil
downloader:*:1003:sonarr,couchpotato,headphones,root,xbmc,devil,subsonic,media,plex
photos:*:1004:xbmc,devil,media,plex


for example, the groups in plugin Headphones:
Code:
media:*:1002:media
downloader:*:1003:headphones,media


users in plugin Headphones:
Code:
media:*:816:1002:Media
headphones:*:1004:1002:User


groups in plugin Couchpotato:
Code:
media:*:816:couchpotato
couchpotato:*:1002:
downloader:*:1003:couchpotato


users in plugin Couchpotato:
Code:
media:*:816:816:Media
couchpotato:*:1002:1002:User


Another important thing is who owns the parent directory? if you don't have write permissions on the parent you can't delete things from inside that directory.

The permissions on the root folders:
Code:
drwxrwxr-x   36 root   downloader   36 May 30 15:39 downloads/
drwxrwxr-x   49 root   media        49 May 23 11:11 movies/
drwxrwxr-x  608 root   media       608 May 30 16:41 music/
drwxrwxr-x    4 root   media        34 May 17 17:38 photos/
drwxrwxr-x  103 root   media       103 May 19 18:18 series/
drwxrwxr-x    7 root   downloader    7 Apr 14 18:33 torrents/
drwxrwxr-x    2 root   media         2 Mar 30 20:09 tutorials/


Hope this helps you out to find the problem :)

Thanks in advance for the fast reactions, both of you!

Regards,
Nils
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi Joshua, thanks for the reaction. I've based current solution on your post indeed, it helped me soo much!
That is why I'm surprised it doens't work with the removal.

So, to answer the questions
the users on FreeNAS itself (using awk '{print $1}' /etc/passwd):
Code:
couchpotato:*:1002:1002:Couchpotato
sonarr:*:1003:1002:Sonarr
headphones:*:1004:1002:Headphones
transmission:*:921:1003:Transmission
plex:*:972:1002:Plex
xbmc:*:1007:1002:XBMC
guest:*:1008:65533:Guest
ipad:*:1009:1004:Ipad
subsonic:*:1010:1002:Subsonic
media:*:816:1002:Media


the groups on FreeNAS (using awk '{print $1}' /etc/group):
Code:
admin:*:1001:root
media:*:1002:root,devil
downloader:*:1003:sonarr,couchpotato,headphones,root,xbmc,devil,subsonic,media,plex
photos:*:1004:xbmc,devil,media,plex


for example, the groups in plugin Headphones:
Code:
media:*:1002:media
downloader:*:1003:headphones,media


users in plugin Headphones:
Code:
media:*:816:1002:Media
headphones:*:1004:1002:User


groups in plugin Couchpotato:
Code:
media:*:816:couchpotato
couchpotato:*:1002:
downloader:*:1003:couchpotato


users in plugin Couchpotato:
Code:
media:*:816:816:Media
couchpotato:*:1002:1002:User




The permissions on the root folders:
Code:
drwxrwxr-x   36 root   downloader   36 May 30 15:39 downloads/
drwxrwxr-x   49 root   media        49 May 23 11:11 movies/
drwxrwxr-x  608 root   media       608 May 30 16:41 music/
drwxrwxr-x    4 root   media        34 May 17 17:38 photos/
drwxrwxr-x  103 root   media       103 May 19 18:18 series/
drwxrwxr-x    7 root   downloader    7 Apr 14 18:33 torrents/
drwxrwxr-x    2 root   media         2 Mar 30 20:09 tutorials/


Hope this helps you out to find the problem :)

Thanks in advance for the fast reactions, both of you!

Regards,
Nils
What solution from my permission guide are you trying to execute? You're doing alot of user/group creating that is irrelevant to actually solving your issue. All your specific plugin users and non-matching UIDs=/=GIDs makes your setup super complicated, lol.

####

I'll assume Solution 3 because your mention groups. Since those files are 775 (group writable) only users in a matching group (which is determined by GID) can write to them. Do note the statement I say in my permission guide
  • "Jails and the FreeNAS host do not share user/group databases. They only associate UIDs/GIDs to users/groups if that mapping exists in it's particular user/group database."
It looks like most of those files are mostly owned by the 'media' group on the host, GID=1002. Any plugin that needs to write to those folders needs to be in a group with GID=1002, in its jail. So lets work through the couchpotato plugin...
In its jail, GID=1002 is the couchpotato group. You either need couchpotato to run as the couchpotato user (see the second part of Solution 2), or in the couchpotato jail you need to add the 'media' user to the couchpotato group.​

####

Honestly your setup is pretty complicated and I would do it completely differently. But, it's totally up to you how to set it up =P
 
Status
Not open for further replies.
Top