Stop your files from ignoring the group permissions of their parent folder
Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop your files from ignoring the group permissions of their parent folder
🧩 The Challenge
You ever set up a shared directory for a team, chmod it to 775, and then watch in horror as every file someone creates ends up with the wrong group ownership? It’s a total headache when the next person can’t edit a file just because the default system umask decided to be unhelpful.
💡 The Fix
The setgid bit is your best friend here. Apply it to the directory, and suddenly every file created inside will automatically inherit the group ID of the parent folder instead of the user’s primary group.
chmod g+s /path/to/shared/directory
⚙️ Why It Works
Setting this bit changes the directory’s behavior so that any new files or subdirectories created within it inherit the group ownership of the directory itself. It saves you from constant chgrp commands and makes shared projects actually function like they should.
🚀 Pro-Tip: Combine this with a default ACL if you need even more granular control over future files.
Linux Tips & Tricks | © ngelinux.com | 7/24/2026
