System information
To set a default ACL, add d : before the rule and specify a directory instead of a file name.
Examp le 20.3. Set t in g d ef au lt ACLs
For example, to set the default ACL for the /share/ directory to read and execute for users not in
the user group (an access ACL for an individual file can override it):
# setfacl -m d:o:rx /share
20.4. Ret rieving ACLs
To determine the existing ACLs for a file or directory, use the getfacl command. In the example
below, the g etfacl is used to determine the existing ACLs for a file.
Examp le 20.4 . Ret rievin g ACLs
# getfacl home/john/picture.png
The above command returns the following output:
# file: home/john/picture.png
# owner: john
# group: john
user::rw-
group::r--
other::r--
If a directory with a default ACL is specified, the default ACL is also displayed as illustrated below.
For example, g etfacl ho me/sal es/ will display similar output:
# file: home/sales/
# owner: john
# group: john
user::rw-
user:barryg:r--
group::r--
mask::r--
other::r--
default:user::rwx
default:user:john:rwx
default:group::r-x
default:mask::rwx
default:other::r-x
20.5. Archiving File Syst ems Wit h ACLs
By default, the d ump command now preserves ACLs during a backup operation. When archiving a
file or file system with tar, use the --acl s option to preserve ACLs. Similarly, when using cp to copy
files with ACLs, include the --preserve= mo d e option to ensure that ACLs are copied across too. In
Red Hat Ent erprise Lin ux 6 St orage Admin ist rat io n G uide
150