On a samba share on Linux, I want to have a directory that can be written to by different users (members of a group called ‘users’). Subdirectories those users create also have to be writeable by every user in group ‘users’.
As a member of ‘users’ I make the directory and set the group, permissions, the setgid
bit and the ACL:
mkdir testdirectory
chgrp users testdirectory
chmod 775 testdirectory
chmod g+s testdirectory
setfacl -d -m g::rwx testdirectory
The permissions of the directory are now drwxrwsr-x+
, the group is ‘users’.
Result of getfacl testdirectory
:
# owner: me
# group: users
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
Test:
Another member of group ‘users’ connects via SMB, and creates a file in ‘testdirectory’.
The file’s permissions are -rwxr--r--
, the group is ‘users’.
Other group members are not allowed to change it.
A directory created by the same user in ‘testdirectory’ gets the permissions drwxr-sr-x+
, group is ‘users’, and again other group members are not allowed to write to it.
I would have expected that every file and subdirectory inherits the permissions of ‘testdirectory’, but obviously I’m missing something.
How can I achieve the expected result?