• 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

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. How to enable/disable wayland on Ubuntu 20.04
  2. i3lock: command not found
  3. “Read-only locking type set. Write locks are prohibited. Can’t get lock for [volume group]” – error during lvextend
  4. qemu-system-x86_64: command not found
  5. How to Install gnome-session-wayland software package in Ubuntu
  6. How Files/Directories in /tmp gets Removed Automatically in CentOS/RHEL 5,6
  7. fwupdmgr Command Examples in Linux
  8. nmap Command Examples in Linux
  9. How To Disable Weak Cipher And Insecure HMAC Algorithms in SSH services for CentOS/RHEL 6 and 7
  10. e2fsck: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • nautilus Command Examples in Linux
  • namei: command not found
  • namei Command Examples in Linux
  • named Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright