Site icon New Generation Enterprise Linux

Stop fighting with nested directories that ignore your setgid bit

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

Stop fighting with nested directories that ignore your setgid bit

đź§© The Challenge

You finally get a shared group directory set up for your dev team, only to find that every time someone drops a file in there, the group ownership resets and nobody else can touch it. I’ve wasted hours chasing these “access denied” tickets that turn out to be someone’s default umask overriding the group permissions.

đź’ˇ The Fix

Use the setgid bit on the directory itself, which forces all new files created inside to inherit the parent directory’s group ID instead of the user’s primary group. It’s the only way to keep a shared workspace sane without constant chgrp runs.

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

⚙️ Why It Works

Setting this special bit changes the behavior of the filesystem to ignore the creating user’s default group and lock new entries to the directory’s owning group, ensuring everyone stays in sync.

🚀 Pro-Tip: Run that on the parent folder and your team will stop pinging you every time they upload a shared asset.

Linux Tips & Tricks | © ngelinux.com | 9/13/2026

0 0 votes
Article Rating
Exit mobile version