Permissions and owners
The setfacl command
Grants fine-grained permissions to specific users or groups, beyond the owner, group and others that chmod shows. These are POSIX ACLs: they let ana read a report without making her the owner or adding her to the group. You inspect them with getfacl.
Most useful options
-m, --modify <entrada>Adds or changes an entry. Format type:name:permissions, such as u:ana:rw-x, --remove <entrada>Removes one entry, without the permissions field: u:ana-b, --remove-allRemoves all ACL entries and keeps only the basic permissions-R, --recursiveApplies the change to the folder and all its contents-d, --defaultSets a default ACL: new files in the folder inherit itCopy-ready examples
$ setfacl -m u:ana:rw informe.txtgives ana read and write access without changing the file's owner or group.$ getfacl informe.txtshows the file's ACLs. The user:ana line is the new entry.Example output
# file: informe.txt # owner: miguel # group: miguel user::rw- user:ana:rw- group::r-- mask::rw- other::r--
$ setfacl -R -m g:devs:rX proyecto/the devs group can read the whole project and enter its folders. The X only grants execute on directories.$ setfacl -d -m g:devs:rwx proyecto/new files created in proyecto/ will inherit that entry for devs.$ setfacl -x u:ana informe.txtremoves only ana's entry. The rest of the permissions stays.You can try them in the browser terminal: it does not touch your computer.
Common errors
| Message | Cause | Fix |
|---|---|---|
| setfacl: informe.txt: Operation not permitted | Only the file owner or root can change its ACL. | Run it as the file owner or with sudo, and check the result with getfacl. |
Typical mistakes
- Copies without preservation options, and some backups, drop ACLs. Check that the destination keeps them.
Differences from similar commands
Security
An entry such as o::rw opens the file to anyone on the system. Check getfacl before granting broad permissions. And remember that chmod changes the ACL mask: after a chmod on the group, the permissions of named users may shrink without warning.
FAQ
What does the + mean in ls -l?
That the file has ACLs. Use getfacl to see the specific entries.
How do I remove all ACLs from a file?
With setfacl -b file. Only the basic owner, group and others permissions remain.
Why does my ACL not work on a file on a USB drive?
Because the file system does not support ACLs. ext4, XFS and Btrfs do, while FAT and exFAT do not.
More Permissions and owners commands
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course