• 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

chacl Command Examples in Linux

by admin

The chacl command is used to modify the ACL for a file. ACLs can be specified to chacl in two distinct forms: as a list of entries or with a chmod-like syntax. By default, chacl adds entries to the current ACL. It also provides a bit more information about how ACLs really work than the shorthand version of the setfacl command.

For example, to add the user alex as someone who can read the file resume.xml, I would use a chacl (change ACL) command like the following:

$ chacl u::rw-,g::r--,o::---,u:alex:r--,m::rw- resume.xml

Using the getfacl command to retrieve the ACL for my resume shows that the user alex has indeed been added to the list of people who have access to the file:

$ getfacl resume.xml
# file: resume.xml
# owner: wvh
# group: wvh
user::rwx
group::r--
other::---
user:alex:r--
mask::rw-
Note: Though the content is the same, the format of the output of the getfacl command depends on the version of the ACL suite that is being used on your Linux system.

chacl Command Examples

1. To change the ACL of a file:

# chacl u::r-x,g::r-x,o::r-- file

2. To set default acl for a directory:

# chacl -d u::rwx,g::r-x,o::r-- /anydir/

3. To remove the ACL:

# chacl -R file

4. To remove the directory default ACL:

# chacl -D /anydir/

5. To remove all ACLs:

# chacl -B file

6. To list the ACL for a file/directory:

# chacl -l file

7. To set the access ACL recursively:

# chacl -r u::r-x,g::r-x,o::r-- /tmp/

Filed Under: Linux

Some more articles you might also be interested in …

  1. runlevel Command Examples in Linux
  2. esearch Command Examples in Linux
  3. logwatch : command not found
  4. iftop Command Examples in Linux
  5. rmmod: command not found
  6. gpgv Command Examples
  7. pacman4console: command not found
  8. git bisect: Use binary search to find the commit that introduced a bug
  9. hostnamectl: command not found
  10. dpkg-scanpackages: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright