So, you mean you want the files/directories created within that directory to inherit the permissions of the parent directory?
To do that, you need to use a default ACL (acl(5)
):
If a default ACL is associated with a directory, the mode
parameter to the functions creating file objects and the default ACL of
the directory are used to determine the ACL of the new object:
- The new object inherits the default ACL of the containing directory as its access ACL.
So, with setfacl(1)
, the -d
flag tells it to modify the default ACL:
$ ls -ld data
drwxrwsr-x+ 2 userone groupone 4096 Dec 8 18:36 data/
$ setfacl -d -m u::rwx,g::rwx,o::r-x data
$ getfacl data
# file: data
# owner: userone
# group: groupone
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
With that set up, a new file or directory created within the directory gets its permissions from the default ACL. This overrides the umask
of the process creating the file, but doesn't override the file mode given to the open()
/mkdir()
/etc. system call.
$ mkdir data/test
$ ls -ld data/test
drwxrwsr-x+ 2 userone groupone 4096 Dec 8 18:38 data/test/
You may need to enable ACLs on the file system at mount time with the acl
mount option.