Page 1 of 1

Trouble with Sabnzbd Permissions [Ubuntu]

Posted: September 12th, 2013, 7:41 am
by sabguy2500
Hello friends,

Version: 0.7.16
OS: Ubuntu 13.04
Install-type: Ubuntu repository (apt-get install sabnzbd)
Firewall Software: ufw
Are you using IPV6? no
Is the issue reproducible? yes

I've been working on getting Sabnzbd running, and on this install, I'm trying to be a bit more strict about permissions than I have been in the past. Unfortunately, Sab doesn't seem to be playing nice with my setup, and I'm encountering two issues.

Issue 1: Config File Can't be Saved from Within Sabnzbd:
The sabnzbd daemon is started when the system boots by my /etc/init.d/sabnzbd file. It runs under its own user account, with the name sabnzbd.

Code: Select all

jfritz@THE-GIBSON:/$ sudo service sabnzbdplus status
 * SABnzbd+ binary newsgrabber: running (pid 2380)
 
jfritz@THE-GIBSON:/$ ps aux | grep 2380
sabnzbd   2380  0.3  1.1 1510764 47536 ?       Sl   07:51   0:02 /usr/bin/python -OO /usr/bin/sabnzbdplus --daemon --server 0.0.0.0:5001
The config file is saved in the user's home directory, at /home/sabnzbd/.sabnzbd/sabnzbd.ini. We can see that the user sabnzbd has permission to read and write to this file:

Code: Select all

jfritz@THE-GIBSON:/home/sabnzbd/.sabnzbd$ ls -la
total 24
drwxr-xr-x 4 sabnzbd sabnzbd 4096 Sep  7 17:12 .
drwxr-xr-x 5 sabnzbd sabnzbd 4096 Sep  9 08:47 ..
drwxr-xr-x 3 sabnzbd sabnzbd 4096 Sep 12 07:51 admin
drwxr-xr-x 2 sabnzbd sabnzbd 4096 Sep 11 20:08 logs
-rw-rw-r-- 1 sabnzbd sabnzbd 3799 Sep 12 07:51 sabnzbd.ini
-rw-rw-r-- 1 sabnzbd sabnzbd 3799 Sep 12 07:51 sabnzbd.ini.bak
However, whenever I change a value in the web interface and hit save, despite no error message being shown, the file is not updated, and the settings don't stick. If I edit the file manually and then restart sabnzbd, my changes are reflected in the web interface.

Issue 2: Sabnzbd Fails to Change Temporary Download Folder Permissions on Startup
As mentioned above, I can manually edit the sabnzbd.ini file to change settings. I did this, changing the Temporary Downloads Folder to /mnt/raid/Incomplete and the Completed Downloads Folder to /mnt/raid/Downloads. Now, whenever I start the sabnzbd daemon, I'm getting an error in the logs that looks like this:

Code: Select all

2013-09-12 07:51:29,552::INFO::[sabnzbdplus:1272] Read INI file /home/sabnzbd/.sabnzbd/sabnzbd.ini
2013-09-12 07:51:29,553::ERROR::[misc:1353] Cannot change permissions of /mnt/raid/Incomplete
2013-09-12 07:51:29,553::INFO::[misc:1354] Traceback: 
Traceback (most recent call last):
  File "/usr/share/sabnzbdplus/sabnzbd/misc.py", line 1349, in set_chmod
    os.chmod(path, permissions)
OSError: [Errno 1] Operation not permitted: '/mnt/raid/Incomplete'
Now I have no idea why sabnzbd is attempting to change the permissions on Temporary Downloads Folder on startup. A quick look at the code on github seems to suggest that it's attempting to set the permissions on the folder to match the misc/permissions value in the config file, but this seems unecessary so long as the service can write to the folder. In my case, it should be able to.

Code: Select all

jfritz@THE-GIBSON:/mnt/raid$ ls -la
total 15287948
drwxr-sr-x   19 jfritz users             4096 Sep  8 14:19 .
drwxr-xr-x    3 root   root              4096 Sep  1 12:58 ..
drwxrws---   55 jfritz jdownloads       20480 Sep  1 20:12 Downloads
drwxrws---    2 jfritz jdownloads       32768 Sep  1 13:08 Incomplete

jfritz@THE-GIBSON:/mnt/raid$ members jdownloads
jfritz sabnzbd sickbeard
As you can see, the /mnt/raid/Incomplete folder is owned by jfritz and the group jdownloads, of which sabnzbd is a member. Both owner and group have full permissions on the folder, so what gives?

Thanks in advance for your help.

Re: Trouble with Sabnzbd Permissions [Ubuntu]

Posted: September 13th, 2013, 4:21 pm
by jcfp
sabguy2500 wrote:Issue 1: Config File Can't be Saved from Within Sabnzbd:

However, whenever I change a value in the web interface and hit save, despite no error message being shown, the file is not updated, and the settings don't stick. If I edit the file manually and then restart sabnzbd, my changes are reflected in the web interface.
Each and every setting or just stuff related to your other issue? Both permissions and file timing in that directory listing strongly suggest nothing is wrong.
sabguy2500 wrote:Issue 2: Sabnzbd Fails to Change Temporary Download Folder Permissions on StartupAs you can see, the /mnt/raid/Incomplete folder is owned by jfritz and the group jdownloads, of which sabnzbd is a member. Both owner and group have full permissions on the folder, so what gives?
Does this error actually come with any real life consequences? What do these permissions end up as if you make sab the owner of incomplete? Sab is probably just trying to make the incomplete dir as private as possible, since it contains only data for jobs still 'in progress'.