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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. GoBuster: command not found
  2. pidof Command Examples in Linux
  3. conan: open source, decentralized and cross-platform package manager to create and share all your native binaries
  4. How To Increase The Retention Of “sar” Data To ‘N’ Days in Linux
  5. How to install CentOS / RHEL 7 on RAID Partition
  6. enum4linux Command Examples in Linux
  7. mycli: command not found
  8. How To Force User/Group Ownership Of Files On A Samba Share
  9. How to Debug systemd boot process in CentOS/RHEL 7 and 8
  10. eget: Easily install prebuilt binaries from GitHub

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright