You ran /scripts/killacct on a source server after a successful transfer, or used WHM’s “Terminate an Account.” Months later, repquota lists a UID that has no /etc/passwd entry, MySQL has grants for a user that no longer exists, or /etc/cron.d/ still runs jobs as a non-existent UID. The account is gone from cPanel’s point of view but its footprint persists in the host’s state.
What’s happening
cPanel account termination is a coordinated sequence: remove the user, drop databases, delete mail, clear DNS, remove cron, retire the certificate. Any one of those steps can fail silently — a database the user did not own but had grants on, a mail directory mounted from a different filesystem, a cron job written directly into /var/spool/cron/USER while a process held the file open, a custom integration that wrote to /etc/aliases.d/USER outside cPanel’s tracking. The cPanel user file is gone, but the kernel still tracks blocks against the UID, MySQL still has the grant, and the cron daemon still tries to fire jobs that fail to log because there is no shell.
How to verify
Find UIDs with disk usage but no passwd entry:
repquota -avs | awk '{print $1}' | while read u; do
getent passwd "$u" >/dev/null 2>&1 || echo "ORPHAN: $u"
done
Find MySQL users with no corresponding cPanel account:
mysql -BN -e "SELECT User FROM mysql.user WHERE User NOT IN ('root','mysql.sys','mysql.session','debian-sys-maint','horde','roundcube')" | \
while read u; do
cpanel_user=$(echo "$u" | cut -d_ -f1)
[ -d "/var/cpanel/users/$cpanel_user" ] || echo "ORPHAN MYSQL: $u (cpanel=$cpanel_user)"
done
Find stray cron entries:
for f in /var/spool/cron/*; do
u=$(basename "$f")
getent passwd "$u" >/dev/null 2>&1 || echo "ORPHAN CRON: $f"
done
And check /etc/userdomains, /etc/userdatadomains, /etc/trueuserdomains for entries pointing to non-existent users.
The fix
- Before removing anything, snapshot the affected paths or run
/scripts/pkgacct USERon the destination first to confirm the migration is genuinely complete. Orphan cleanup is irreversible. - Remove orphaned MySQL users with
DROP USER 'name'@'localhost';thenFLUSH PRIVILEGES. Drop databases owned by no cPanel user only after confirming with the customer or your CMDB. - Delete orphan cron files:
rm /var/spool/cron/ORPHAN_USERthensystemctl reload crond. Check/etc/cron.dand/etc/cron.hourlyfor hand-edited entries. - Run
/scripts/updateuserdomainsto rebuild the userdomain map and surface any inconsistencies. Then/scripts/fixquotasto clear orphan UID accounting. - Reclaim the home directory:
rm -rf /home/ORPHAN_USERonly after a finalfindfor unexpected files (custom integrations sometimes write under another tenant’s home). Uselsof +D /home/ORPHAN_USERfirst to ensure nothing is reading from it.
The cleanup itself is mechanical. The risk is removing something that still belonged to a live account through a misnaming collision — verify before deleting.
If a fleet of cPanel servers has accumulated orphan state over years of migrations, that is a remediation engagement we run inside Deployment Management. Get in touch.