Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop chasing your tail when file attributes keep blocking your deletions
🧩 The Challenge
Ever tried to nuke a file only to get a permission denied error, even though you are root and the chmod bits look perfectly fine? I once spent an hour trying to figure out why I couldn’t delete a specific log rotation file before realizing someone had set an immutable attribute on it.
💡 The Fix
Use the extended attribute list command to check for flags that standard permissions ignore. It saves you the headache of banging your head against the wall when you have full ownership but the kernel still refuses to let go of the file.
lsattr /path/to/stubborn/file
chattr -i /path/to/stubborn/file
⚙️ Why It Works
Immutable flags sit outside the standard POSIX permission model and effectively lock a file until the flag is explicitly cleared. Even the root user can’t unlink or rename the file while that ‘i’ attribute is active.
🚀 Pro-Tip: Use chattr +a if you want an append-only log file that even a compromised process can’t wipe out.
Linux Tips & Tricks | © ngelinux.com | 8/19/2026
