I am facing this problem. I am running a samba server for some windows clients. I have 100 users in this samba share and all of them are belong to the primary group "smbusers". Now, I created an excel file in this samba server and i want to be read-write-execute only by 3 users, and the rest of 97 to be able only to read the excel file. I mentioned, that all this 100 users are part of many groups.Any help will be very appreciated. Best regards.
1 Answer
Create a new group 'rwnewfile' with groupadd.
Add your three special users:
usermod -Ga rwnewfile user1
usermod -Ga rwnewfile user2
usermod -Ga rwnewfile user3
I will assume you're using ext4 which supports acl by default. I also assume your group 'smbusers' already has r-x access.
$ getfacl /opt/example/file.xls
# file: /opt/example/file.xls
# owner: root
# group: smbusers
user::rwx
group::r-x
mask::rwx
other::r-x
Now we add your new group:
sudo setfacl -m g:rwnewfile:rwx /opt/example/file.xls