Access Control Lists (ACLs)
What you'll learn: How to use getfacl and setfacl to create more granular file permissions than traditional owner/group/other modes allow.
Beyond Traditional Permissions
Standard Linux permissions give you three levels of control: owner, group, and everyone else. But what happens when you need to grant specific access to multiple users or groups without creating complex group memberships or changing ownership? That's where Access Control Lists (ACLs) shine.
Think of traditional permissions as a velvet rope with three sections: VIP (owner), Members (group), and General Admission (others). ACLs let you issue individual passes to specific people, regardless of which section they'd normally be in.
How ACLs Work
ACLs extend the traditional permission model by allowing you to define permissions for:
- Named users beyond the file owner
- Named groups beyond the primary group
- A default mask that limits maximum permissions
Using getfacl and setfacl
getfacl displays ACL information for a file or directory:
getfacl /path/to/file
This shows all traditional permissions plus any additional ACL entries.
setfacl modifies ACLs:
# Grant user alice read+write access
setfacl -m u:alice:rw /path/to/file
# Grant group developers read+execute
setfacl -m g:developers:rx /path/to/directory
# Remove alice's ACL entry
setfacl -x u:alice /path/to/file
Files with ACLs show a + when using ls -l, signaling that additional permissions exist beyond the basic mode.
Key Takeaway: ACLs extend traditional Linux permissions using getfacl and setfacl, enabling you to grant fine-grained access to specific users and groups without restructuring ownership or group memberships—essential for complex multi-user environments.