Site icon New Generation Enterprise Linux

Stop permissions hell with recursive setfacl

Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)

Stop permissions hell with recursive setfacl

đź§© The Challenge

Dealing with a shared directory where developers keep overwriting each other’s files is a nightmare, especially when chmod doesn’t track new file creations. I’ve wasted so many afternoons fixing group write bits because someone dragged a file in and killed the inheritability.

đź’ˇ The Fix

Use ACL default entries to force every new file created in that directory to inherit the correct group permissions automatically. It saves you from having to run periodic cron jobs just to clean up broken access rights.

setfacl -R -d -m g:developers:rwx /shared/project/data
setfacl -R -m g:developers:rwx /shared/project/data

⚙️ Why It Works

Setting the default ACL entry ensures that any child object created in the future automatically picks up the permissions you define. The -d flag is the magic bit that makes it persistent for new items rather than just applying to what is currently there.

🚀 Pro-Tip: Always double check with getfacl -p on the directory after you run this so you know exactly what is going to be applied to new files.

Linux Tips & Tricks | © ngelinux.com | 7/19/2026

0 0 votes
Article Rating
Exit mobile version