setfacl
file managementLinux
The setfacl command is one of the most frequently used commands in Linux/Unix-like operating systems. setfacl Set file access control lists (ACLs)
Quick Reference
Command Name:
setfacl
Category:
file management
Platform:
Linux
Basic Usage:
setfacl [options] [arguments]
Common Use Cases
Syntax
setfacl [options] acl_spec file...
Options
Option | Description |
---|---|
-m, --modify=acl |
Modify the ACL of file(s) |
-x, --remove=acl |
Remove entries from the ACL of file(s) |
-b, --remove-all |
Remove all extended ACL entries |
-k, --remove-default |
Remove the default ACL |
--set=acl |
Set the ACL, replacing the current ACL |
--set-file=file |
Set the ACL using entries from a file |
--mask |
Recalculate the effective rights mask |
-n, --no-mask |
Don't recalculate the effective rights mask |
-d, --default |
Operations apply to the default ACL |
-R, --recursive |
Apply operations recursively to all files and directories |
-L, --logical |
Follow symbolic links in recursive mode |
-P, --physical |
Don't follow symbolic links in recursive mode |
--restore=file |
Restore ACLs from a file created by getfacl |
--test |
Test mode: show the operations that would be performed |
--version |
Display version information and exit |
--help |
Display help information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the setfacl
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
setfacl -m u:user1:rwx file.txt