Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop worrying about the umask when setting up shared directories
đź§© The Challenge
Setting up a project folder for a team where everyone needs to read and write each other’s files is a nightmare because umask always gets in the way. You end up with a folder full of files that only one person can edit, leading to the inevitable 3 AM ticket about permission denied errors.
đź’ˇ The Fix
Use the setgid bit on the parent directory along with default ACLs to force new files to inherit the right group ownership and permissions regardless of the user’s specific umask settings.
chgrp projectgroup /data/project && chmod g+s /data/project && setfacl -d -m g:projectgroup:rwx /data/project
⚙️ Why It Works
Setting the group ID bit ensures every file created inside inherits the directory’s group, while the default ACL pushes those read/write/execute bits onto new entries automatically. It effectively bypasses the usual permission scramble that happens when someone with a restrictive umask drops a file in the shared space.
🚀 Pro-Tip: Always verify with getfacl after you set it up, or you’re just guessing if it stuck.
Linux Tips & Tricks | © ngelinux.com | 11/13/2026
