Note: to clarify the question, I am assuming an empty directory to start; I realize if it was non-empty I could use the -R
option to setfacl
.
Here's what I tried (wanting to give access of /tmp/badDir
to user me
, when it was created and owned by otheruser
):
$ sudo -u otheruser mkdir /tmp/badDir
$ sudo setfacl -dm "user:me:rwX" /tmp/badDir
$ sudo -u otheruser touch /tmp/badDir/baz
$ touch /tmp/badDir/baz
So at first glance this looks good.
But then if I try certain other operations that I need, it isn't what I expect:
$ touch /tmp/badDir
touch: setting times of '/tmp/badDir': Permission denied
$ touch /tmp/badDir/foo
touch: cannot touch '/tmp/badDir/foo': Permission denied
So it looks like I can't modify the directory metadata or create files
within the directory, though I can modify files within the directory
created by the user otheruser
.
Output of ls
and getfacl
is:
$ ls -last /tmp/badDir
total 0
0 drwxrwxrwt 1 root root 1794 Jun 22 09:22 ..
0 -rw-rw-r--+ 1 otheruser otheruser 0 Jun 22 09:22 baz
0 drwxr-xr-x+ 1 otheruser otheruser 6 Jun 22 09:22 .
$ getfacl /tmp/badDir
getfacl: Removing leading '/' from absolute path names
# file: tmp/badDir
# owner: otheruser
# group: otheruser
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:me:rwx
default:group::r-x
default:mask::rwx
default:other::r-x
$ getfacl /tmp/badDir/baz
getfacl: Removing leading '/' from absolute path names
# file: tmp/badDir/baz
# owner: otheruser
# group: otheruser
user::rw-
user:me:rwx #effective:rw-
group::r-x #effective:r--
mask::rw-
other::r--
Update 1
Just to confirm, I do have acls enabled:
$ sudo tune2fs -l /dev/disk/by-uuid/8d6bba7d-63c1-4406-855a-f56987dea98e | grep acl
Default mount options: user_xattr acl
setfacl -dm "d:user:me:rwX" /tmp/badDir
. Note thed:
prefix$ sudo setfacl -dm "d:user:me:rwX" /tmp/badDir
returningsetfacl: Option -m: Invalid argument near character 1