ACL is not working properly

I have a two drives:

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   2,7T  0 disk 
└─sda1        8:1    0   2,7T  0 part /mnt/DataDisk
nvme0n1     259:0    0 931,5G  0 disk 
├─nvme0n1p1 259:1    0  1000M  0 part /efi
└─nvme0n1p2 259:2    0 930,5G  0 part /var/log
                                      /var/cache
                                      /home
                                      /

I’ve mounted sda1 which is gonna be used as a shared partition by other users, users belonging to all group can modify files created by other group users, I’m using ACL for that purpose but it’s not working as I thought.

My steps

I created all group:

$ sudo groupadd all

I added two users

$ sudo usermod -aG all lucas
$ sudo usermod -aG all root

I mounted DataDisk by using Dolphin (KDE), and changed attributes for all its content:

$ sudo chmod -R 664 /run/media/lucas/DataDisk
$ sudo chmod -R a+X /run/media/lucas/DataDisk
$ sudo chown -R root:all /run/media/lucas/DataDisk

I created a directory for mount point:

$ mkdir /mnt/DataDisk
$ sudo chown -R root:all /mnt/DataDisk
$ sudo chmod -R 775 /mnt/DataDisk

I modified /etc/fstab adding this line:

UUID=41f0de58-67d2-43f0-9b23-b614426f2003 /mnt/DataDisk  ext4    defaults 0 0

After rebooting my OS I checked if ACL is enabled:

$ sudo tune2fs -l /dev/sda1 | grep "Default mount options:"
Default mount options:    user_xattr acl

I set these permissions:

$ cd /mnt
$ sudo setfacl -PRdm "u:root:rwx,g:all:rwx,o::r-x" DataDisk
$ getfacl DataDisk
# file: DataDisk
# owner: root
# group: all
user::rwx
group::rwx
other::r-x
default:user::rwx
default:user:root:rwx
default:group::rwx
default:group:all:rwx
default:mask::rwx
default:other::r-x

When listing DataDisk I’ve noted that

drwxrwxr-x+  16 root all   4096 Sep 10  2022  Pictures
-rw-rw-r--    1 root all 187701 Aug 26  2022  Preferidos.m3u8
drwxrwxr-x+  13 root all   4096 Sep 10  2022  eBooks
-rw-rw-r--    1 root all   5538 Jun  4 15:09  info.txt

only directories are added with a + sign at the end of their attributes (see 4.1 of ACL), what happened with files?

After rebooting my OS again, I created a file to verify if ACL is working properly:

$ cd /mnt/DataDisk
$ touch demodemo.txt
$ ll demodemo.txt
-rw-rw-r--+   1 lucas lucas      0 Jun  5 17:34  demodemo.txt

Should it not be root:all or lucas:all instead of lucas:lucas? Am I missing something?

To enable ACL, the filesystem must be mounted with the acl option. You can use fstab entries to make it permanent on your system. So should it be:

UUID=41f0de58-67d2-43f0-9b23-b614426f2003 /mnt/DataDisk ext4 defaults,acl 0 0

??
(disclaimer - I know nothing!).

See top 3.2 in acl:

To allow all newly created files or directories to inherit entries from the parent directory (this will not affect files which will be copied into the directory):

Acl only works on newly created files.
info.txt is older than your directory. That’s why the + is missing, i guess.

if you do getfacl on demodemo.txt you will see more permissions for that file. I guess the additional permissions are root and all.

There several things to fix:

$ sudo useradd -M shared -s /usr/bin/nologin
$ sudo passwd shared
$ sudo usermod -aG shared lucas
$ cd /mnt
$ sudo setfacl -bR DataDisk
$ sudo chmod -R 664 DataDisk
$ sudo chmod -R a+X DataDisk
$ sudo chown -R shared:shared DataDisk
$ sudo chown root DataDisk
$ sudo setfacl -PRdm "u:shared:rwx,g:shared:rwx,o::r--" DataDisk
$ sudo chmod g+s DataDisk

and now it is working as desired or something like that.

Indeed ACL is not needed, so we can omit it.