Stop your files from ignoring the group bit when folks copy them around
Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop your files from ignoring the group bit when folks copy them around
🧩 The Challenge
Dealing with shared project directories is a nightmare when every new file created by a developer defaults to private permissions. I’ve wasted hours fixing broken web server access because a teammate forgot to manually chmod everything they moved into the public folder.
💡 The Fix
Flip the setgid bit on the parent directory so that any new file automatically inherits the group ownership of the folder itself. It saves you from constant manual permission corrections.
chmod g+s /path/to/shared/directory
⚙️ Why It Works
Setting the setgid bit forces files created in that directory to keep the group ID of the folder, ensuring consistent access levels for your whole team. It’s basically the “set and forget” way to handle shared storage.
🚀 Pro-Tip: Combine this with a default umask of 002 in your profile scripts to make sure those files stay writable by the group too.
Linux Tips & Tricks | © ngelinux.com | 8/10/2026
