sab overriding setgid & ACL default group for subdirectories

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
thekorn
Newbie
Newbie
Posts: 1
Joined: November 21st, 2016, 11:24 pm

sab overriding setgid & ACL default group for subdirectories

Post by thekorn »

Hello,I'm trying to figure out a way to set group ownership with sabnzbd in ubuntu. (The user sabnzbd runs as *is* a member of the group I'd like to set the ownership to, so that's not a problem.)
  • * I've tried using a post processing script like the one mentioned here (minus the chown). That works (the files wind up with the correct group) except that it does not work on any directories created by sabnzbd. So if categorization creates title/season/file , the group ownership is only applied to the file and not the title nor season directories. Applying setgid to the download (and even sabnzb temp!) directory does not help as sabnzbd overrides the use of the setguid bit when creating sub-directories. i.e. Sabnzbd honors setgid when creating the title directory, and overrides it when creating a season sub-directory and file. (I know, you're probably saying, "whaaaaaa?" See below for example output!)

    * I then tried bringing out the big gun and use ACLs to enforce a default username, group, and permissions. (In retrospect doing permissions was dumb since sab has the ability to set permissions... ha!) While this works for anything you care to do as a regular user, similar to the setgid override sabnzbd actively overrides default user and group ownership.
I guess the question is why is sabnzbd overriding setgid and my ACLs? I'm really confident that it's sab doing it, because if I go into the directory as any user (even the sab user) and make files and directory structures, the correct username and groups are carried all the way through automatically:

Code: Select all

/incoming/nzb_output_here$ touch test
/incoming/nzb_output_here$ mkdir testdir
/incoming/nzb_output_here$ ls -l | grep test
-rw-rw-r--+  1 vince mythtv        0 Nov 22 06:17 test
drwxrwsr-x+  2 vince mythtv        2 Nov 22 06:17 testdir
/incoming/nzb_output_here$ cd testdir
/incoming/nzb_output_here/testdir$ touch test2
/incoming/nzb_output_here/testdir$ mkdir testdir2
/incoming/nzb_output_here/testdir$ ls -l | grep test
-rw-rw-r--+ 1 vince mythtv 0 Nov 22 06:17 test2
drwxrwsr-x+ 2 vince mythtv 2 Nov 22 06:17 testdir2
But when sabnzbd's categorization makes a directory structure in the same directory, it overrides the default user and group ownership after the top level (I disabled the post processing script that changes the end file's group ownership for this download) :

Code: Select all

/incoming/nzb_output_here$ ls -l | grep "The Grand"
/incoming/nzb_output_here$ ###download test nzb par file...
/incoming/nzb_output_here$ ls -l | grep "The Grand"
drwxrwxr--+  3 vince mythtv        3 Nov 22 06:54 The Grand Tour
/incoming/nzb_output_here$ cd The\ Grand\ Tour/
/incoming/nzb_output_here/The Grand Tour$ ls -l
total 56
drwxrwxr--+ 2 vince vince 3 Nov 22 06:54 Season 1
/incoming/nzb_output_here/The Grand Tour$ cd Season\ 1
/incoming/nzb_output_here/The Grand Tour/Season 1$ ls -l
total 23346
-rw-rw-r--+ 1 vince vince 25000000 Nov 22 06:54 The.Grand.Tour.S01E01.720p WEBRip X264 Par 2 Files vol12773 par.001
So... any ideas on how to get the group ownership set right on the files and all directories created by sabnzbd categorization? (Or even better, get sabnzbd categorization to honor default ACLs all the way through and I'll just do it myself? ;D)

Thanks in advance!

Here's my ACL for that directory, just in case I messed something up there:

Code: Select all

/incoming/nzb_output_here$ getfacl .
# file: .
# owner: vince
# group: mythtv
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:mask::rwx
default:other::r-x
User avatar
safihre
Administrator
Administrator
Posts: 5678
Joined: April 30th, 2015, 7:35 am
Contact:

Re: sab overriding setgid & ACL default group for subdirecto

Post by safihre »

From what I understand from the code is that SAB will set the permissions, I can't find anything about changing ownership in the code.
But I assume it will use the same as the user under which SAB is run because after download completes, SAB goes over all the files and sets them to the right permissions, but folders should stay unharmed, I think.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: sab overriding setgid & ACL default group for subdirecto

Post by shypike »

The "permissions" are applied to folders as well.
If not, you still wouldn't be able to see the files in it.
Changing ownership is an uncertain thing, often SABnzbd doesn't have the rights to do it.
If you need that, write a little user script to do it an add it to the categories to which it applies.
Post Reply