Stop fighting over group permissions when umask is being a jerk

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

Stop fighting over group permissions when umask is being a jerk

🧩 The Challenge

You know the pain of two developers trying to work on the same directory, only for one person’s files to be inaccessible to the other because the default umask is too restrictive. I’ve spent way too long manually running chmod -R g+rw every time someone pushes a new file.

💡 The Fix

Use the setgid bit on the directory itself so every new file created inside automatically inherits the directory’s group instead of the user’s primary group. It saves you from constantly fixing permissions manually.

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

⚙️ Why It Works

Setting the setgid bit forces all new files or directories created within the parent to adopt the group ownership of that parent directory. It effectively flattens the permission headache for shared team folders.

🚀 Pro-Tip: Pair this with default ACLs using setfacl -d -m g:mygroup:rwX to ensure those group rights stick regardless of the user’s umask.

Linux Tips & Tricks | © ngelinux.com | 11/12/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted