Permissions issue on new install

Get help, report and discuss bugs.
Post Reply
fryfrog
Posts: 10
Joined: 03 Sep 2014, 23:16

Permissions issue on new install

Post by fryfrog » 03 Sep 2014, 23:27

I'm trying to get NZBGet working to replace SABnzbd, but am having what seems to be an obvious permissions issue. But for the life of me, I can't figure out why. The daemon runs as the user 'nzbget' with a group of 'nzbget' but is also in the group 'users'. The users home directory is 755 and this is also where the nzbget specific MainDir files reside like tmp and queue. They're also 755. The NzbDir is /data/downloads/nzb and is 775. If I 'sudo su - nzbget' and then 'touch ~/nzbget/tmp/fake ; cp ~/nzbget/tmp/fake /data/downloads/nzb/fake' it all works fine.

According to Scanner.cpp, I think there should actually be more to this error message. I'm sure this is something simple I'm overlooking... but I can't figure out what.

Porton of my config I think matters.

Code: Select all

MainDir=~/nzbget
DestDir=/data/ftp/upload
InterDir=/data/ftp/upload/incomplete-nzbget
NzbDir=/data/downloads/nzb
QueueDir=${MainDir}/queue
TempDir=${MainDir}/tmp
WebDir=/usr/local/share/nzbget/webui
ScriptDir=/usr/local/share/nzbget/scripts
LockFile=${MainDir}/nzbget.lock
LogFile=/var/log/nzbget.log
ConfigTemplate=/usr/local/share/nzbget/nzbget.conf
An 'ls -alh' for the nzbget processing directory

Code: Select all

fryfrog@apollo:/home/nzbget$ ls -alh */*
nzbget/queue:
total 8.0K
drwxr-xr-x 2 nzbget nzbget 4.0K Sep  3 14:53 .
drwxr-xr-x 4 nzbget nzbget 4.0K Sep  3 14:53 ..

nzbget/tmp:
total 8.0K
drwxr-xr-x 2 nzbget nzbget 4.0K Sep  3 16:15 .
drwxr-xr-x 4 nzbget nzbget 4.0K Sep  3 14:53 ..
An 'ls -alh' of the nzb directory.

Code: Select all

fryfrog@apollo:/home/nzbget$ ls -alh /data/downloads/nzb/
total 443K
drwxrwxrwx  2 nzbget  users   2 Sep  3 15:38 .
drwxrwxr-x 58 fryfrog users 971 Sep  3 15:49 ..
The error log spew.

Code: Select all

Wed Sep  3 16:12:21 2014        ERROR   Could not move file /home/nzbget/nzbget/tmp/nzb-1.tmp to /data/downloads/nzb/Totally.Just.Ubuntu.nzb:
An strace of the process when the issue happens, open to other 'trace=' suggestions.

Code: Select all

$ sudo strace -f -p 23290 -e trace=file
Process 3330 attached
[pid  3330] stat("/home/nzbget/nzbget/tmp/nzb-1.tmp", 0x7f17359ec580) = -1 ENOENT (No such file or directory)
[pid  3330] open("/home/nzbget/nzbget/tmp/nzb-1.tmp", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 6
[pid  3330] stat("/data/downloads/nzb/Totally.Just.Ubuntu.nzb", 0x7f17359ec580) = -1 ENOENT (No such file or directory)
[pid  3330] rename("/home/nzbget/nzbget/tmp/nzb-1.tmp", "/data/downloads/nzb/Totally.Just.Ubuntu.nzb") = -1 EXDEV (Invalid cross-device link)
[pid  3330] open("/home/nzbget/nzbget/tmp/nzb-1.tmp", O_RDONLY) = -1 EACCES (Permission denied)
[pid  3330] open("/var/log/nzbget.log", O_RDWR|O_CREAT|O_APPEND, 0666) = 6
[pid  3330] unlink("/home/nzbget/nzbget/tmp/nzb-1.tmp") = 0
[pid  3330] +++ exited with 0 +++

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: Permissions issue on new install

Post by hugbug » 04 Sep 2014, 10:21

As a test try to set TempDir to data-drive (for example "/data/downloads/tmp").

fryfrog
Posts: 10
Joined: 03 Sep 2014, 23:16

Re: Permissions issue on new install

Post by fryfrog » 04 Sep 2014, 17:31

I also gave 14 testing a shot, pretty sure it wasn't going to help and it didn't. I double checked ps output to confirm it was running as nzbget user and it was.

The power is off at my house where the system is, but once it comes back up I'll give that a test. Should I just go ahead and locate the whole nzbget running directories there? My /data is ZFS while the rest of / is whatever Ubuntu picked, probably ext4 or xfs. And even further, /data/downloads and /data/ftp are different zfs mounts.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: Permissions issue on new install

Post by hugbug » 04 Sep 2014, 21:29

From the posted strike it looks like the created file (nzb-1.tmp) could not be read. What are the permissions of the file?

fryfrog
Posts: 10
Joined: 03 Sep 2014, 23:16

Re: Permissions issue on new install

Post by fryfrog » 05 Sep 2014, 05:52

I *think* the problem might have been my UMask maybe? I think I had it at 775 and tried 0775, when I noticed some files that were just --------w. So I set it back to the default of 1000. I suspect the tmp file was getting these permissions, but the cleanup erased it and I never actually saw one in the wild. But I also re-worked my directory structure and got everything into the /data zfs volume. A bit of the strace stood out, nzbget isn't using some tricky hardlinking to do the move is it?

Edit: It has to have been umask. My goal of 0755 should have been 002, I failed to realize it was umask despite the fact it was called umask :p

Code: Select all

(Invalid cross-device link)

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests