1

I have folders set up this way:

/srv/samba/video

getfacl /srv/samba/video

# file: srv/samba/video
# owner: root
# group: nogroup
user::rwx
group::---
group:sambaclients:rwx
group:deluge:rwx
mask::rwx
other::---
default:user::rwx
default:group::---
default:group:sambaclients:rwx
default:group:deluge:rwx
default:mask::rwx
default:other::---

That means, user deluge has rwx to folder /srv/samba/video.

However, when running command as user deluge, I am getting weird permission errors.

When in folder /srv/samba/video:

sudo -u deluge mkdir foo

works flawlessly.

But when using absolute path:

sudo -u deluge mkdir /srv/samba/video/foo

I am getting permission denied.

When running sudo -u deluge id, I get output

uid=113(deluge) gid=124(deluge) skupiny=124(deluge)

which shows that user deluge is indeed in group deluge. Also, the behavior was the same when I gave the permissions also to user deluge not just group deluge. When executing as non-system user, it does work.

The reason that I want to use absolute paths is that I am using automatically triggered post-download script which extracts some files into the folder.

I have spent way too many hours to solve this problem myself. mkdir isn't the only command that fails, touch is doing the same thing, so I suspect that it's not mkdir's fault.

If you need more info, I will try to put it in here, just ask. Thanx in advance.

Edit:

It seems that the root of the problem is acl set on perent folder /srv/samba, which indeed does not grant permissions to deluge (but neither denies it).

getfacl /srv/samba
# file: srv/samba
# owner: root
# group: nogroup
user::rwx
group::---
group:sambaclients:rwx
mask::rwx
other::---
default:user::rwx
default:group::---
default:group:sambaclients:rwx
default:mask::rwx
default:other::---

If I grant the permission also to this folder, it suddenly starts to work so I believe that the acl on /srv/samba is somehow denying the permissions to deluge.

So the question is: how do I set acl to both /srv/samba and /srv/samba/video so that sambaclients have access to whole /srv/samba and subdirectories and deluge has access only to /srv/samba/video and subdirectories?

1
  • Try it with the SGID bit (see chmod command). This bit will give rights to the group and not the user. This might be a bit better to handle.
    – s1mmel
    Sep 12, 2018 at 15:00

1 Answer 1

1

User deluge must be able to see contents of the parent directory /srv/samba. Thus applying executable bit to it: chmod o+x /srv/samba resolved the issue.

The reason why it worked with relative path is that when sudoing the command, we already were in directory /srv/samba/video and thus no permission checks were applied.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .