Stop fighting over permission bits on shared directories
Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop fighting over permission bits on shared directories
🧩 The Challenge
Setting up a shared directory for a dev team is a nightmare because someone always creates a file that nobody else can edit. You end up manually fixing group ownership every single morning and it gets old fast.
💡 The Fix
Use the setgid bit on the directory so every file created inside automatically inherits the folder’s group rather than the user’s primary group. It keeps the project access consistent without you hovering over everyone’s shoulders.
chmod g+s /path/to/shared/dir
⚙️ Why It Works
Setting the setgid bit on a directory forces new files to inherit the group of the parent directory instead of the user’s default group. This saves you from having to run chgrp or chmod every time someone saves a new log or source file.
🚀 Pro-Tip: Pair this with a default umask of 002 for those users if you really want to ensure group write access sticks.
Linux Tips & Tricks | © ngelinux.com | 9/19/2026
