• 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

setfacl: command not found

by admin

The setfacl command is used to change the permissions associated with the ACL of a file or directory. The setfacl command has several options, some of the most common of which are described in the following table.

Option Description
-R Recursively set ACL options for directories and their contents.
-s Set the ACL of an object, replacing any existing ACL.
-m Modify the existing ACL of an object.
-x Remove entries from an existing ACL.
-b Remove all ACL entries (not including the standard permissions).

Syntax

The syntax of the setfacl command is:

# setfacl [-bR] [-mx {acl_spec}] {file/directory names}

The following is an example of modifying the ACL on a directory where the user http is given read access:

setfacl -m u:http:r-- /home/directory

If you encounter below error while executing the setfacl command:

setfacl: 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

Removing ACL

The setfacl command is also used with the -x option to remove the applied ACL for any user or group. The only difference when removing ACL from setting ACL is that we don’t specify the permission while removing. The following example illustrates the usage of the setfacl command to remove the ACL applied to a file named as file1 for the user geel and the group lab:

$ setfacl -x  u:geek,g:lab  file1

To remove all ACLs from a file or directory, we can use the -b option, as shown in the following command:

$ setfacl -b file1

setacl Command Examples

1. Modify ACL of a file for user with read and write access:

# setfacl -m u:username:rw file

2. Modify default ACL of a file for all users:

# setfacl -d -m u::rw file

3. Remove ACL of a file for a user:

# setfacl -x u:username file

4. Remove all ACL entries of a file:

# setfacl -b file

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Mount NFS File Systems Using ‘autofs’ in CentOS/RHEL
  2. ledctl: command not found
  3. How to Disable NUMA in CentOS / RHEL 6,7
  4. test: command not found
  5. How to add words to the dictionary cracklib uses for validating passwords against known dictionary words
  6. gnome-screenshot: command not found
  7. pacman-key Command Examples
  8. hdparm Command Examples in Linux
  9. How to Disable the ‘lvm2-lvmetad.socket/service’ on CentOS/RHEL 7
  10. disown Command Examples in Linux

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