ACL Commands Cheat Sheet

Here is a cli commands cheat sheet for ACL command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is ACL command?

ACLs allow us to apply a more specific set of permissions to a file or directory without (necessarily) changing the base ownership and permissions. They let us "tack on" access for other users or groups.

# Get ACL
getfacl 

# Add or modify ACL on file
setfacl -m u:username:rX 
setfacl -m g:groupname:rw 
setfacl -m o::- 

# or provide all permissions at once
setfacl -m u::rwx,g:groupname:rX,o::- 

# Copy ACL from file-A to file-B
getfacl file-A | setfacl -M - file-B

# Apply ACL recursivelly to directory
setfacl -R -m u:username:rX 

# Delete ACL
setfacl -x u:username,g:groupname 

# Delete all ACL on file, including default
setfacl -b 

# Same operations works for default ACLs
setfacl -m d:u:username:rx 
setfacl -x d:u:username 

# Delete only default ACLs
setfacl -k 
    

Check out the ACL command documentation .

You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list