Grant Per-User File Access with setfacl and getfacl
Use POSIX ACLs to grant an individual user read/execute rights on a file without touching its owner, group, or the 755 bits everyone else relies on.
Run setfacl -m u:deploy:rx /var/www/app to give user 'deploy' read+execute, and getfacl /var/www/app to view the resulting ACL.
01Command
Command
$ setfacl -m u:deploy:rx /var/www/app
getfacl /var/www/app02What it does
Access control lists extend the classic owner/group/other model: setfacl -m adds an entry granting a named user (u:name) or group (g:name) specific permissions, while getfacl prints the full effective ACL. This solves the recurring 'user X needs access but changing the group breaks something' problem cleanly. After modification the classic permission bits gain a trailing + in ls -l, signalling that extended entries exist.
03Risk
!Warning: ACLs are silently ignored on filesystems mounted without the acl option, and rsync/tar need flags (--acls) to preserve them — verify with getfacl after any copy.
04Undo
Undo
$ setfacl -x u:deploy /var/www/app05Sources
- setfacl(1) — Linux manual pageEvidence: setfacl man page: '-m, --modify=acl Modify the ACL of the file(s)' with u:uid:perms entry syntax.
- Debian Wiki: ACLEvidence: Documents installing the acl package and the default-ACL feature for new files in a directory.
Last verified: 2026-09-17 · Category: Security & Privacy