Use chmod -R for simple, broad permission changes, and use setfacl when permissions must vary by user, group, or directory inheritance. That is the practical rule. Recursive permission changes can fix access fast, but they can also break production files just as fast.
TLDR: chmod -R changes traditional Linux mode bits across a directory tree, while setfacl applies finer access rules without forcing everything into owner, group, and other. For example, on a shared project with 18 developers and 60,000 files, setfacl can grant one QA group read access without making files world-readable. If your goal is “make every directory executable and every file readable,” chmod is enough. If your goal is “give Alice write access, keep Bob read-only, and make new files inherit that rule,” use ACLs.
What chmod -R actually does
chmod -R applies permission changes recursively to a path. It walks through subdirectories and updates files and folders below the target. A common command looks like this:
chmod -R 755 /var/www/exampleThis sets directories and files to the same numeric mode. That is often too blunt. Directories need execute permission to be entered. Files usually do not need execute permission unless they are scripts or binaries. Running chmod -R 755 on a web directory can make every image, CSS file, and config file executable. It works, but it is sloppy.
A safer pattern uses find to separate files from directories:
find /var/www/example -type d -exec chmod 755 {} \;
find /var/www/example -type f -exec chmod 644 {} \;That gives directories rwxr-xr-x and files rw-r--r--. It is boring. Good. Permission work should be boring.

Where chmod -R fits best
chmod is the right tool when the access model is simple. Linux mode bits support three classes:
- Owner: the user who owns the file.
- Group: the group assigned to the file.
- Other: everyone else.
For many systems, that is enough. A private SSH directory should be locked down:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keysA public web asset directory may need readable files and searchable directories. A backup folder may need access only for one service account. These are clean use cases for chmod, especially when paired with correct ownership through chown.
The annoyance starts when exceptions appear. One extra contractor needs read access. One service needs write access to only uploads. One group needs access to new files created next month, not just files present today. At that point, forcing everything through chmod and Unix groups can feel like trying to fix a watch with a hammer.
What setfacl adds
setfacl manages Access Control Lists, usually called ACLs. ACLs extend the basic owner, group, and other model. They let you assign permissions to named users and named groups.
Example:
setfacl -m u:alice:rwX /srv/projectThis grants Alice read and write access. The uppercase X is useful. It applies execute permission only to directories and to files that already have execute permission. That avoids the common mistake of making every regular file executable.
To apply this recursively:
setfacl -R -m u:alice:rwX /srv/projectTo make new files and directories inherit the rule, set a default ACL on directories:
setfacl -R -m d:u:alice:rwX /srv/projectIn real shared directories, this is often the deciding feature. chmod -R changes what exists now. Default ACLs influence what gets created later.

The ACL mask: the bit that surprises people
ACLs include a mask. The mask limits the effective permissions of named users and groups. This trips up many administrators because getfacl may show one permission, while the effective access is lower.
Check ACLs with:
getfacl /srv/project/report.csvYou may see something like:
user:alice:rwx #effective:rw-That means Alice has an ACL entry with execute, but the mask removes it. Honestly, it feels like ACLs hide the answer one line lower than where people expect it. Always read the effective permissions before blaming the application.
You can set the mask explicitly:
setfacl -m m::rwx /srv/project/report.csvBe careful. A wide mask may allow more than you intended. A tight mask may make ACL entries useless.
Security risks of recursive permission changes
Recursive commands deserve respect. A single typo can expose secrets or break services. This is true for both tools.
chmod -R 777is almost never acceptable. It gives everyone read, write, and execute access.- Running from the wrong path can change thousands of files before you notice.
- Symbolic links can cause confusion. Check tool behavior before running bulk changes.
- Mixed file types need care. Scripts, sockets, logs, and keys should not share one mode.
Before making large changes, test on a small directory. Use ls -l, namei -l, and getfacl. On a production system, capture the current state first:
getfacl -R /srv/project > project.acl.backupYou can restore it later with:
setfacl --restore=project.acl.backupChoosing between chmod -R and setfacl
Use chmod -R when the rule is simple and global. Use setfacl when access differs across users or teams.
| Need | Better tool |
|---|---|
| Set all web files to readable | chmod |
| Give one user write access without changing ownership | setfacl |
| Apply different rules to files and directories | chmod with find, or setfacl with X |
| Make future files inherit access rules | setfacl |
| Lock down private keys | chmod |

A practical example
Assume /srv/reports is owned by reports-admin. The finance team needs read and write access. The audit team needs read-only access. New monthly reports must inherit the same rules.
chown -R reports-admin:finance /srv/reports
find /srv/reports -type d -exec chmod 2770 {} \;
find /srv/reports -type f -exec chmod 660 {} \;
setfacl -R -m g:audit:rx /srv/reports
setfacl -R -m d:g:finance:rwX /srv/reports
setfacl -R -m d:g:audit:rx /srv/reportsThe 2 in 2770 sets the setgid bit on directories. New files inherit the finance group. The ACL gives the audit group access without making “other” users eligible. This is a clean mix of classic permissions and ACLs.
Operational guidance
- Prefer named commands over numeric shortcuts when reviewing changes with a team.
chmod -R g+rwXis easier to reason about than a mystery mode. - Avoid
777. If it seems required, the ownership model is probably wrong. - Document ACL use. Files with ACLs show a
+inls -l, but the full rule is hidden untilgetfaclis used. - Check backup tools. Some preserve ACLs by default. Some need flags such as
-Awithrsync. - Know your filesystem. Ext4 and XFS commonly support ACLs, but mounts and older systems may need checking.
The safest answer is not “chmod or setfacl.” It is using the smallest permission change that matches the access requirement. For simple ownership and mode cleanup, chmod -R is fast and clear. For shared directories, exceptions, and inherited permissions, setfacl is usually the cleaner tool. Treat recursive permission changes like database migrations: review them, test them, and keep a rollback path.