You are not logged in.

#1 2012-11-15 06:14:26

developej
Member
Registered: 2011-10-02
Posts: 68

[SOLVED, workaround] SABnzbd, how to run at boot as regular user?

Hey,
so I'm trying to set up SABnzbd to run at boot under my regular user. I'm not succeeding smile
I did a:
#systemctl enable sabnzbd.service
but it runs as sabnzbd user, and then I can't, let's say, set NZB watch folder to be /home/'myuser'/Dropbox/NZB

My question is which files I need to edit and how to get it to run at boot under my user?
There is a /usr/lib/systemd/system/sabnzbd.service - here's the cat on it:

[Unit]
Description=SABnzbd binary newsreader
After=network.target

[Service]
EnvironmentFile=/etc/conf.d/sabnzbd_systemd
ExecStart=/bin/sh/ -c "python2 ${SABNZBD_DIR}/SABnzbd.py ${SABNZBD_ARGS} --pid /run/sabnzbd"
ExecStop=/usr/bin/curl -f "${SABNZBD_PROTOCOL}://${SABNZBD_USPW}${SABNZBD_IP}:${SABNZBD_PORT}/sabnzbd/api?mode=shutdown&apikey=${SABNZBD_KEY}"
Type=forking
PIDFile=/run/sabnzbd/sabnzbd-8080.pid
User=sabnzbd
Group=sabnzbd

[Install]
WantedBy=multi-user.target

I tried to edit User and Group to 'myuser' and 'users' but it wouldn't start at all.
There is also a /etc/conf.d/sabnzbd - here's the cat:

# Set the protocol, IP and port
SABNZBD_PROTOCOL="http"
SABNZBD_IP="127.0.0.1"
SABNZBD_PORT="8080"

# Set your default user/group(id), startarguments and your configfile
USE_SYSTEM_IDS="1"
SABNZBD_DIR="/opt/sabnzbd"
#SABNZBD_UID="423"
#SABNZBD_GID="423"
SABNZBD_USER="sabnzbd"
SABNZBD_GROUP="sabnzbd"
#SABNZBD_AGROUP="users"     # separate groups by ,
SABNZBD_CONF="${SABNZBD_DIR}/sabnzbd.ini"
SABNZBD_ARGS="-f ${SABNZBD_CONF} -s ${SABNZBD_IP}:${SABNZBD_PORT} -d"

# Put the session keys from Config > General here
SABNZBD_KEY=""
NZB_KEY=""

# If you use a username and password, change the following variable to
# "user:pass@"
SABNZBD_USPW=""

I changed it here too (SABNZBD_USER and SABNZBD_GROUP), still nothing.
So I need someone to tell me all the lines in these (and maybe some other) files that need to be changed and into what smile

Thanks!

Last edited by developej (2012-11-16 10:02:14)

Offline

#2 2012-11-15 15:37:22

teekay
Member
Registered: 2011-10-26
Posts: 271

Re: [SOLVED, workaround] SABnzbd, how to run at boot as regular user?

Most likely you will also need to change the ownership and/or permissions on the directories that sabnzbd uses. Check your sabnzbd.ini
I once installed it from AUR, so the directories are:

/run/sabnzbd
/var/log/sabnzbd
/var/lib/sabnzbd
/opt/sabnzbd    (at least the .ini file needs to be writable by sabnzbd)

If it can't write there, it won't start.

You will also need to change /usr/lib/tmpfiles.d/sabnzbd.conf after every update, so /run/sabnzbd gets created correctly.


An alternative approach would be to let sabnzbd run as sabnzbd, and add you user to the sabnzbd group.
1) Set the permissions on your nzb watch folder to 775 <username>:sabnzbd.
The .nzb file in the folder is owned by the regular user, but still sabnzbd can remove it (he has write access to the dir, no sticky bit is set, so it can be deleted).

2) In Sabnzbd config set the file mask to 775, so you can move downloaded files elsewhere.

That's what I do. It's a lot easier, safer and a permanent solution.

Last edited by teekay (2012-11-15 16:18:11)

Offline

#3 2012-11-15 18:54:46

developej
Member
Registered: 2011-10-02
Posts: 68

Re: [SOLVED, workaround] SABnzbd, how to run at boot as regular user?

I'm trying the second option, but I have some problems...

1) I set up watched folder like you said (at least I think i did):

drwxrwxr-x  2 developej sabnzbd   4096 Nov 15 19:46 NZB

problem is, when I'm in SABnzbd's config, I can't navigate to select that folder (since it is in home/developej/Dropbox - I can't go into the developej). If I type it manually, it gives an error on save.
edit: also, when I download a nzb, and then put it into ~/Dropbox/NZB, the .nzb's owner is developej:users, not developej:sabnzbd (is that a problem?) edit2: no it's not, you said it would be like that big_smile

2) I can't set custom download folders (incomplete and complete) - I can't have them in ~/downloads/sabnzbd, can I?

Thanks for your help, but I'm gonna need it some more smile

Last edited by developej (2012-11-15 19:17:29)

Offline

#4 2012-11-16 09:27:09

teekay
Member
Registered: 2011-10-26
Posts: 271

Re: [SOLVED, workaround] SABnzbd, how to run at boot as regular user?

developej wrote:

1) I set up watched folder like you said (at least I think i did):

drwxrwxr-x  2 developej sabnzbd   4096 Nov 15 19:46 NZB

Looks good.

problem is, when I'm in SABnzbd's config, I can't navigate to select that folder (since it is in home/developej/Dropbox - I can't go into the developej). If I type it manually, it gives an error on save.
edit: also, when I download a nzb, and then put it into ~/Dropbox/NZB, the .nzb's owner is developej:users, not developej:sabnzbd (is that a problem?) edit2: no it's not, you said it would be like that big_smile

That's because /home/developej has 700 permission, most likely. You can either change permissions in it so sabnzbd can access it, or create a NZB folder somehwere outside your homedir and symlink that to your dropbox folder. Dropbox supports that, and in sabnzbd you specify the outside folder

2) I can't set custom download folders (incomplete and complete) - I can't have them in ~/downloads/sabnzbd, can I?

You can, of course, but again sabnzbd would need to be able to access your homedir

Offline

#5 2012-11-16 10:00:22

developej
Member
Registered: 2011-10-02
Posts: 68

Re: [SOLVED, workaround] SABnzbd, how to run at boot as regular user?

I set up symlink for NZB watch folder and it works fine.
Thanks!

Offline

Board footer

Powered by FluxBB