Site icon New Generation Enterprise Linux

Stop hunting for sticky bits when files are owned by everyone

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

Stop hunting for sticky bits when files are owned by everyone

🧩 The Challenge

You know the pain of a shared directory where developers keep deleting each other’s files because they all have write access to the parent folder. I spent a whole afternoon debugging a deployment script that kept failing because a stray cron job nuked a directory it had no business touching.

💡 The Fix

Use the sticky bit on the directory to ensure that only the file owner can delete or rename the stuff inside, even if others have write permissions. It turns a chaotic shared space into a sane workspace.

chmod +t /path/to/shared/directory

⚙️ Why It Works

Adding that bit to the directory metadata tells the kernel to restrict file deletion to the owner, root, or the directory owner. It is the oldest trick in the Unix book and still saves my bacon every single week.

🚀 Pro-Tip: Check if it’s set by looking for a ‘t’ or ‘T’ at the end of your directory permissions in ls -ld output.

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

0 0 votes
Article Rating
Exit mobile version