The getfacl command is used to retrieve and print the Access Control Lists (ACLs) of a file or directory. ACLs provide more fine-grained permissions apart from the traditional file permissions (read, write, execute) used by the operating systems.
- About getfacl : To get file access control lists
- It comes from “acl-2.2.49” package.
Examples:
1. To get the ACL’s of a file
$ getfacl /tmp/test.txt |
2. To display the file access control list
$ getfacl -a /tmp/file.txt $ getfacl –access /tmp/file.txt |
3. To display the default access control list
$ getfacl -d /tmp/file.txt $ getfacl –default /tmp/file.txt |
4. To avoid displaying comment header
$ getfacl -c /tmp/file.txt $ getfacl –omit-header /tmp/file.txt |
5. To Print all effective rights comments
$ getfacl -e /tmp/file.txt $ getfacl –all-effective /tmp/file.txt |
6. To avoid printing effective rights
$ getfacl -E /tmp/file.txt $ getfacl –no-effective /tmp/file.txt |
7. To skip files that only have the base ACL entries
$ getfacl -s /tmp/file.txt $ getfacl –skip-base /tmp/file.txt |
8. To list the ACL’s recursively
$ getfacl -R /tmp $ getfacl –recursive /tmp |
9. To follow the symbolic links
$ getfacl -L /tmp/file.txt $ getfacl –logical /tmp/file.txt |
10. To avoid following the symbolic links
$ getfacl -P /tmp/file.txt $ getfacl –physical /tmp/file.txt |
11. To get the tabular output format
$ getfacl -t /tmp/file.txt $ getfacl –tabular /tmp/file.txt |
12. Do not strip leading slash characters
$ getfacl -p /tmp/file.txt $ getfacl –absolute-names /tmp/file.txt |
13. To list the numeric user and group IDs
$ getfacl -n /tmp/file.txt $ getfacl –numeric /tmp/file.txt |
14. To get the version of the getfacl
$ getfacl -v $ getfacl -version |
15. To get the help for getfacl
$ getfacl -h $ getfacl –help |
Related Commands: setfacl, acl
getfacl command not found
While checking, you may get the message as “getfacl command not found”, then it means you do no have the “acl” package installed on your system. Please follow below instructions to get that installed.
OS Version | Command to install |
RedHat / CentOS | yum install acl |
Debian / Ubuntu | apt install acl |