Stop user accounts from lingering when your LDAP or AD sync breaks
User & Group Management
Stop user accounts from lingering when your LDAP or AD sync breaks
🧩 The Challenge
Dealing with a pile of orphaned local home directories from ex-employees is a headache that ruins your disk quotas. Nobody wants to spend their Monday morning hunting down every folder owned by a UID that doesn’t exist on the server anymore.
💡 The Fix
Use find with the nouser flag to grab every file or folder that belongs to a user who has already been nuked from your directory service. It’s the fastest way to scrub the dead weight before you run out of space.
find /home -xdev -nouser -exec du -sh {} +
⚙️ Why It Works
Setting the -nouser flag tells find to look exclusively for files that have an owner ID not found in /etc/passwd or your mapped identity stores. Once you confirm the list looks safe, swap du for rm -rf if you really want to clear the deck.
🚀 Pro-Tip: Always run this with a dry-run flag or at least an ls -l before you start deleting things in production.
Linux Tips & Tricks | © ngelinux.com | 8/15/2026
