Stop wondering who changed your directory permissions
Permissions & Security (Chmod/Chown/ACLs/SELinux/AppArmor)
Stop wondering who changed your directory permissions
🧩 The Challenge
Dealing with a shared web directory where someone keeps nuking the permissions and breaking the application is a special kind of hell. I’ve spent entire weekends chasing down which intern or runaway script did a recursive chmod on a production root.
💡 The Fix
Use an audit rule to watch the directory so the kernel snitches on exactly which user and command touched your permissions. It’s the fastest way to catch the culprit red-handed.
auditctl -w /var/www/html/ -p wa -k web_dir_watch
⚙️ Why It Works
Setting a watch on the path with the ‘wa’ flag tells the audit subsystem to trigger a log event whenever someone writes to or changes attributes on that specific node. You can then pull the logs using ausearch to identify the UID, PID, and executable responsible for the damage.
🚀 Pro-Tip: Don’t forget to add the rule to /etc/audit/audit.rules so it doesn’t vanish when you reboot.
Linux Tips & Tricks | © ngelinux.com | 11/21/2026
