Granting ACLs That Are Inherited by Both Files and Directories
This section provides examples that identify the file and directory ACLs that are applied when both the file_inherit and dir_inherit flags are set.
In the following example, user alice is granted read, write, and execute permissions that are inherited for newly created files and directories.
$ pfexec chmod A+user:alice:read_data/write_data/execute:file_inherit/dir_inherit:allow test3.dir $ ls -dv test3.dir drwxr-xr-x+ 2 root root 2 Jul 20 15:00 test3.dir 0:user:alice:list_directory/read_data/add_file/write_data/execute :file_inherit/dir_inherit:allow 1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory /append_data/read_xattr/write_xattr/execute/delete_child /read_attributes/write_attributes/read_acl/write_acl/write_owner /synchronize:allow 2:group@:list_directory/read_data/read_xattr/execute/read_attributes /read_acl/synchronize:allow 3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes /read_acl/synchronize:allow
The inherited text in the following output is an informational message that indicates that the ACE is inherited.
$ touch test3.dir/file.3 $ ls -v test3.dir/file.3 -rw-r--r--+ 1 root root 0 Jul 20 15:01 test3.dir/file.3 0:user:alice:read_data:inherited:allow 1:owner@:read_data/write_data/append_data/read_xattr/write_xattr /read_attributes/write_attributes/read_acl/write_acl/write_owner /synchronize:allow 2:group@:read_data/read_xattr/read_attributes/read_acl/synchronize:allow 3:everyone@:read_data/read_xattr/read_attributes/read_acl/synchronize :allow
In these examples, because the permission bits of the parent directory for group@ and everyone@ deny write and execute permissions, user alice is denied write and execute permissions. The default aclinherit property is restricted, which means that write_data and execute permissions are not inherited.
In the following example, user alice is granted read, write, and execute permissions that are inherited for newly created files, but are not propagated to subsequent contents of the directory.
$ pfexec chmod A+user:alice:read_data/write_data/execute:file_inherit/no_propagate:allow test4.dir $ ls -dv test4.dir drwxr--r--+ 2 root root 2 Mar 1 12:11 test4.dir 0:user:alice:list_directory/read_data/add_file/write_data/execute :file_inherit/no_propagate:allow 1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory /append_data/read_xattr/write_xattr/execute/delete_child /read_attributes/write_attributes/read_acl/write_acl/write_owner /synchronize:allow 2:group@:list_directory/read_data/read_xattr/read_attributes/read_acl /synchronize:allow 3:everyone@:list_directory/read_data/read_xattr/read_attributes/read_acl /synchronize:allow
As the following example illustrates, alice's read_data/write_data/execute permissions are reduced based on the owning group's permissions.
$ touch test4.dir/file.4 $ ls -v test4.dir/file.4 -rw-r--r--+ 1 root root 0 Jul 20 15:09 test4.dir/file.4 0:user:alice:read_data:inherited:allow 1:owner@:read_data/write_data/append_data/read_xattr/write_xattr /read_attributes/write_attributes/read_acl/write_acl/write_owner /synchronize:allow 2:group@:read_data/read_xattr/read_attributes/read_acl/synchronize:allow 3:everyone@:read_data/read_xattr/read_attributes/read_acl/synchronize :allow