Fix sticky bit permission madness on shared directories
Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Fix sticky bit permission madness on shared directories
🧩 The Challenge
You know that feeling when you set up a shared folder for the team and suddenly everyone is deleting each other’s files? I’ve spent way too long cleaning up accidental ‘rm -rf’ disasters caused by someone having write access to a directory they didn’t really own.
💡 The Fix
Throw the sticky bit on the directory. It’s the easiest way to ensure that only the file owner, the directory owner, or root can delete or rename files inside a shared space.
chmod +t /path/to/shared/directory
⚙️ Why It Works
Setting this bit changes how the kernel handles file deletion, essentially ignoring the write permission of the parent directory if the user doesn’t own the specific file being targeted.
🚀 Pro-Tip: Check if it’s already set by looking for a ‘t’ or ‘T’ at the end of the directory permissions in an ‘ls -ld’ output.
Linux Tips & Tricks | © ngelinux.com | 9/28/2026
