Changing the user of SABnzbd (now: root)

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
norrin
Posts: 20
Joined: Wed Oct 24, 2018 9:42 am

Changing the user of SABnzbd (now: root)

Post by norrin »

Hi.
I am using dietpi trying to replace my synology diskstation and it really runs more and more better.
I installed SABnzbd which runs smooth and i can use and copy the files by samba to my windows-machine. BUT the samba-user dietpi cannot delete or rename files because the files are root/root.
I made chmod/chown but that only worked for the old files because the SABnzbd-user is root.

Is it possible to change that user to dietpi or another user without root-privileges?

Regards
norrin
Odroid N2
(before: Odroid XU4)
User avatar
WarHawk
Posts: 633
Joined: Thu Jul 20, 2017 8:55 am

Re: Changing the user of SABnzbd (now: root)

Post by WarHawk »

You can chown entire directories but be careful

Code: Select all

#chown -R dietpi:dietpi /dir/to/change
Might have config files in /etc to see if it runs as either root or dietpi

found this
https://vorkbaard.nl/install-the-latest ... /#addusers

Here is the main site, this might help you
https://vorkbaard.nl/install-the-latest ... -debian-8/
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: Changing the user of SABnzbd (now: root)

Post by MichaIng »

Interesting, I was sure on current DietPi version, sabnzbd runs as user "dietpi", but indeed we have forgotten it or there is some reason it still runs as root: https://github.com/Fourdee/DietPi/blob/ ... 319-L11329

@Fourdee
Could you have a look, is there some reason or do we need to align it with the other download software titles and can offer an adjusted systemd unit as workaround?

I will open an GitHub issue: https://github.com/Fourdee/DietPi/issues/2172
norrin
Posts: 20
Joined: Wed Oct 24, 2018 9:42 am

Re: Changing the user of SABnzbd (now: root)

Post by norrin »

Ok, i read on the github-issue-thread and it seems you solved it but how can i make the changes? Just updating or do i have to edit sabnzbd.ini?
Odroid N2
(before: Odroid XU4)
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: Changing the user of SABnzbd (now: root)

Post by MichaIng »

Please do the following:

Code: Select all

systemctl stop sabnzbd
useradd -rM sabnzbd -G dietpi -s /usr/sbin/nologin
cat << _EOF_ > /etc/systemd/system/sabnzbd.service
[Unit]
Description=sabnzbd DietPi

[Service]
User=sabnzbd
Group=dietpi
Type=simple
ExecStart=$(which python) /etc/sabnzbd/SABnzbd.py -f /etc/sabnzbd/sabnzbd.ini

[Install]
WantedBy=multi-user.target
_EOF_
mkdir -p /var/log/sabnzbd
chown -R sabnzbd:dietpi /etc/sabnzbd
chown -R sabnzbd:dietpi /var/log/sabnzbd
G_CONFIG_INJECT 'log_dir =' 'log_dir = /var/log/sabnzbd' /etc/sabnzbd/sabnzbd.ini
G_CONFIG_INJECT 'permissions =' 'permissions = "0775"' /etc/sabnzbd/sabnzbd.ini
systemctl daemon-reload
systemctl start sabnzbd
If there are any attached downloads in download directory still owned by root, then please chown sabnzbd:dietpi them as well.

That should be it, please report back if you face an issue.
norrin
Posts: 20
Joined: Wed Oct 24, 2018 9:42 am

Re: Changing the user of SABnzbd (now: root)

Post by norrin »

Hi.
Back to report that it works and saying thank you.

I had to do the changes with a "sudo", used the mc for the edit of sabnzbd.ini and had to chown the complete and incomplete-directories like you wrote.
But now it works.
:)
Odroid N2
(before: Odroid XU4)
Post Reply