Ubuntu 22.04 - Running Sabnzbd with a different group

Support for the Debian/Ubuntu package, created by JCFP.
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
lightenup
Newbie
Newbie
Posts: 1
Joined: December 27th, 2022, 11:53 am

Ubuntu 22.04 - Running Sabnzbd with a different group

Post by lightenup »

I recently moved from nzbget, and found no easy way to have sabnzbd enforce group permissions on new files in the completed folder. Here is a little work around....

Modify the file: /etc/default/sabnzbdplus

Add the GROUP variable, the location does not matter, here is what mine looks like:

Code: Select all

# [required] user or uid of account to run the program as:
USER=sabnzb
GROUP=media
Save and exit.

Next edit /etc/init.d/sabnzbdplus , there is a few changes here so bare with me...

Line 38, add GROUP to the end:

Code: Select all

# these are only accepted from the settings file
unset USER CONFIG HOST PORT EXTRAOPTS GROUP
Line 69, add a new line below like so:

Code: Select all

                [ -n "$EXTRAOPTS" ] && OPTIONS="$OPTIONS $EXTRAOPTS"
                [ -n "$GROUP" ] && CHUID="$USER:$GROUP" || CHUID="$USER"
Finally, on line 80 modify the chuid part like so:

Code: Select all

                log_daemon_msg "Starting $DESC"
                eval start-stop-daemon --start --quiet --chuid "$CHUID" --exec "$DAEMON" -- $OPTIONS
Save and quit

Perform a "systemctl daemon-reload" and finally a "service sabnzbdplus restart"

Hopefully this change can make it into the PPA.

Enjoy!
User avatar
jcfp
Release Testers
Release Testers
Posts: 1004
Joined: February 7th, 2008, 12:45 pm

Re: Ubuntu 22.04 - Running Sabnzbd with a different group

Post by jcfp »

Note that it's possible to use chown syntax (user:group) for the USER setting in /etc/default/sabnzbdplus, which is also why the init.d uses ${USER%:*} if it really wants only the user part. Admittedly, it is kind of an undocumented feature as fiddling with these things tends to get newbies in trouble.
landog
Newbie
Newbie
Posts: 7
Joined: July 7th, 2012, 6:48 pm

Re: Ubuntu 22.04 - Running Sabnzbd with a different group

Post by landog »

Folks Ive just found this thread.. thank you!

I want to change sabnzb from running as root to running as my user 'matt' (to resolve the permission issues in the completed folders).

do i simply edit the sabnzbplus file in /etc/default from root to matt?

Anything else i need to do ?
Post Reply