Stop files from inheriting wrong permissions in shared project folders

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

Stop files from inheriting wrong permissions in shared project folders

🧩 The Challenge

Setting up a group-writable directory for a dev team always seems fine until someone drops a file in there and suddenly nobody else can edit it. I’ve wasted so many afternoons fixing group bits that refuse to stick.

💡 The Fix

Use the setgid bit on the directory so every new file created inside automatically adopts the directory’s group ownership instead of the user’s primary group.

chmod g+s /path/to/shared/directory

⚙️ Why It Works

Setting this bit tells the kernel that any file created in this directory should inherit the group ID of the parent folder, keeping your collaboration access consistent without needing constant manual chgrps.

🚀 Pro-Tip: Combine this with a umask setting of 002 in your team’s profile to make sure the group actually gets write access by default.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted