setfacl -d -m group:GROUPNAME:rwx /path/to/directory
setfacl -m group:GROUPNAME:rwx /path/to/directory
OR
/mnt/acl$ mkdir foo
/mnt/acl$ getfacl foo
# file: foo
# owner: faheem
# group: faheem
user::rwx
group::r-x
other::r-x
- Set the group of foo to be staff, and set the acl of group and user of foo to rwx.
/mnt/acl$ chgrp staff foo
/mnt/acl$ setfacl -R -m u::rwx,g::rwx foo
/mnt/acl$ getfacl foo
# file: foo
# owner: faheem
# group: staff
user::rwx
group::rwx
other::r-x
- Set default acls of user and group to rwx as well. This defines permissions that files and directories inherit from foo. So all files and directories created under foo will have group permissions rw.
/mnt/acl$ setfacl -d --set u::rwx,g::rwx,o::- foo
/mnt/acl$ getfacl foo
# file: foo
# owner: faheem
# group: staff
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::---
- Now create some files in foo as users faheem and john.
/mnt/acl$ cd foo
/mnt/acl/foo$ touch bar
# switch to user john for this next command.
/mnt/acl/foo$ touch baz
- List files. Notice that both files owned by faheem and files owned by john are created with group permissions rw.
/mnt/acl/foo$ ls -la
total 3
drwxrwxr-x+ 2 faheem staff 1024 May 9 01:22 .
drwxr-xr-x 4 faheem faheem 1024 May 9 01:20 ..
-rw-rw---- 1 faheem faheem 0 May 9 01:20 bar
-rw-rw---- 1 john john 0 May 9 01:22 baz