In short, I'm trying to create a file server with a directory in which any user in a group has read-write-execute permission on any file placed in that directory. My research suggests that ACL is the right tool for the job, but I've run into an issue where it does not seem to be behaving as expected.
I'm running the latest Ubuntu Server LTS 16.04.1, and I've ensured that ACL is enabled for the drive in question.
For this example, I have 2 users, alex
and usera
, and both users belong to the fileserver
group. I have created a test directory like so:
alex@tstsvr:/$ sudo mkdir -p /srv/fstest/test
alex@tstsvr:/$ sudo chown root:fileserver /srv/fstest/test
alex@tstsvr:/$ sudo chmod 770 /srv/fstest/test
In that directory, alex
creates a simple test file:
alex@tstsvr:/$ cd /srv/fstest/test/
alex@tstsvr:/srv/fstest/test$ echo 123 > test.txt
$ ll
total 12
drwxrwx--- 2 root fileserver 4096 Dec 7 17:09 ./
drwxr-xr-x 4 root root 4096 Dec 7 16:46 ../
-rw-rw-r-- 1 alex alex 4 Dec 7 17:09 test.txt
As we can see, the file belongs to him and is in his group. Next he sets the file permissions to 770
and sets some ACL for the fileserver
group to have rwx
permissions on the file.
alex@tstsvr:/srv/fstest/test$ chmod 770 test.txt
alex@tstsvr:/srv/fstest/test$ setfacl -m g:fileserver:rwx test.txt
alex@tstsvr:/srv/fstest/test$ ll
total 12
drwxrwx--- 2 root fileserver 4096 Dec 7 17:09 ./
drwxr-xr-x 4 root root 4096 Dec 7 16:46 ../
-rwxrwx---+ 1 alex alex 4 Dec 7 17:09 test.txt*
Now for usera
, everything seems to be working perfectly:
usera@tstsvr:/srv/fstest/test$ getfacl test.txt
# file: test.txt
# owner: alex
# group: alex
user::rwx
group::rw-
group:fileserver:rwx
mask::rwx
other::---
usera@tstsvr:/srv/fstest/test$ cat test.txt
123
But, if user alex
changes the permissions to 700
...:
alex@tstsvr:/srv/fstest/test$ chmod 700 test.txt
It seems ACL is not able to override those permissions, and usera
is not longer able to read that file:
usera@tstsvr:/srv/fstest/test$ getfacl test.txt
# file: test.txt
# owner: alex
# group: alex
user::rwx
group::rw- #effective:---
group:fileserver:rwx #effective:---
mask::---
other::---
usera@tstsvr:/srv/fstest/test$ cat test.txt
cat: test.txt: Permission denied
My understanding was that because the file has a named group ACL entry, it would override those file permissions, but this seems to not be the case.
Did I do something wrong, am I misunderstanding, or is this not actually possible?