In the interests of keeping things manageable I'd like to use the setgid bit to ensure a common group is used for all new directories and files. I've set the "Permissions for completed downloads" setting to "2770", but of course this sets the setgid bit for files as well as for directories, which is undesirable for security reasons. When set to "770" the created directories don't inherit the parent directory's setgid bit since I assume they're actually created in the temporary location without it then moved across, which circumvents the usual behaviour for creating directories in directories with setgid set. I've had a good search for this on the forums but couldn't find anything.
Is there any way to specify permissions for created directories separately from permissions for created files?
Or, is there a way to specify the group for created files and directories?
Or, is there some other way to accomplish this (perhaps some post-completion script or command)?
I'm quite new to sabnzbd so far so please keep it simple Brilliant application so far by the way, well done.
Creating directories with setgid bit - no way to not set it for files though?
Forum rules
Help us help you:
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.
Re: Creating directories with setgid bit - no way to not set it for files though?
In SABnzbd you set the permissions for directories and it will derive the
permissions for files (by removing the X flag).
The assumption is that the permissions are only R, W and X, it doesn't take other flags into account.
The easiest way would be to write your own script.
I'm sure this needs editing, because I can never get find/exec commands right the first time.
permissions for files (by removing the X flag).
The assumption is that the permissions are only R, W and X, it doesn't take other flags into account.
The easiest way would be to write your own script.
Code: Select all
#!/bin/sh
find "$1" -type dir -exec chmod 2770 {} \;
Re: Creating directories with setgid bit - no way to not set it for files though?
I see, to me that's not very intuitive but I guess it simplifies things. Perhaps just a note by the option would help avoid confusion?
I used this script in the end, slightly different syntax and adds the s flag to the existing permissions so the normal setting is still respected:
Thanks for your help!
I used this script in the end, slightly different syntax and adds the s flag to the existing permissions so the normal setting is still respected:
Code: Select all
#!/bin/sh
find "$1" -type d -exec chmod g+s '{}' \;