• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

getfacl: command not found

by admin

An access control list (ACL) is a list of permissions attached to an object. ACLs can be used for situations where the traditional file permission concept does not suffice. ACLs enable you to assign permissions to individual users or groups even if these do not correspond to the object’s owner or group.

For example, members of two department groups may need different levels of access to the same resource. Group 1 might need r/w/x to a directory, whereas Group 2 only needs r/x access. By using ACLs, you are able to grant different levels of access to different users, groups, and even processes. ACLs enable a more granular level of control.

The getfacl command is used to retrieve the ACLs of files and directories. The basic output format of the getfacl command shows metadata about the object including its owner, its group, any SUID/SGID/sticky bit flags set, the standard permissions associated with the object, and the individual permission entries for users and groups.

If you want to see what are the ACL associated with the file, we can make use of the getfacl command. The syntax is quite simple:

# getfacl filename

Which gives the output as:

# file: filename
# owner: geek
# group: geek
user::rw-
user:andy:r--
user:bob:r--
user:james:rwx
group::r--
mask::rwx
other::r--

If you encounter below error while executing the getfacl command:

getfacl: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install acl
Ubuntu apt-get install acl
Alpine apk add acl
Arch Linux pacman -S acl
Kali Linux apt-get install acl
CentOS yum install acl
Fedora dnf install acl
Raspbian apt-get install acl

getfacl Command Examples

1. To get the ACL’s of a file:

# getfacl /tmp/file.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 

Filed Under: Linux

Some more articles you might also be interested in …

  1. lshal Command Examples in Linux
  2. How to Disable RSH Server in CentOS/RHEL
  3. How To Disable Weak Cipher And Insecure HMAC Algorithms in SSH services for CentOS/RHEL 6 and 7
  4. ‘lxc_cgfs – Device or resource busy – failed to set memory.use_hierarchy to 1; continuing’ – error while starting LXC container
  5. uname: command not found
  6. List of SELinux Utilities
  7. light: command not found
  8. finch: command not found
  9. How to configure LDAP Client on CentOS/RHEL 6 using SSSD
  10. add-apt-repository Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright