Commands don't have permission when using absolute path

Posted by Markos on Ask Ubuntu See other posts from Ask Ubuntu or by Markos
Published on 2013-10-28T09:38:24Z Indexed on 2013/11/02 16:01 UTC
Read the original article Hit count: 350

Filed under:

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?

© Ask Ubuntu or respective owner

Related posts about permissions