The customer asked for cancellation, billing closed the contract, and the account is queued for removal. Two weeks later the auditor asks for the access logs from the period the account was active, or the customer comes back asking for a copy of their site for handoff to a new vendor. If removeacct ran without an archive step, neither request has an answer. Termination is irreversible by design; the workaround is to make the archive step non-optional.
What’s happening
removeacct deletes /home/<user>, drops every MySQL database owned by the account, purges /var/cpanel/users/<user>, removes DNS zones from named, clears Exim queues for the account’s domains, and updates /etc/userdomains. None of this hits the backup system in real time — your nightly Borg, Acronis, or cPbackup run is your only safety net, and that net has holes if the cancellation happens within the retention window. Worse, customer data can include records you have a regulatory obligation to retain past the account life — invoices, audit logs, support tickets — and the WHM interface does nothing to surface that.
How to verify
Before you press the button, inventory what’s actually on disk and in databases:
pkgacct user=acme
whmapi1 accountsummary user=acme
whmapi1 list_dbs user=acme
ls -la /home/acme/
mysqldump --databases $(whmapi1 list_dbs user=acme --output=json | jq -r '.data.mysql_databases[]')
pkgacct builds a full account archive in /home/cpmove-acme.tar.gz — site files, databases, mail, DNS zone, account metadata. This is the canonical handoff artifact. Generate it before any termination, even when nobody asked.
The fix
- Make
pkgacctmandatory in your termination runbook. The archive lives outside/home/acme, so it survivesremoveacct. Copy it to your offsite retention bucket before proceeding. - Capture access and error logs separately —
/usr/local/apache/logs/access_loganddomlogs/for the account. These do not go into thepkgacctarchive. Tar them into a sidecar bundle named with the account and the cancellation date. - Flag accounts under regulatory hold in
/var/cpanel/users/<user>with a sentinel file (HOLD_UNTIL_YYYY-MM-DD) that your termination script reads before callingremoveacct. The script refuses to proceed when the file exists. - Defer the actual delete by 14 days. Suspend immediately, archive immediately, then schedule
removeacctfor a future date. If the customer returns within that window, unsuspending is free; if they don’t, the disk reclaim is the same.
Retention obligations around terminated accounts are exactly the kind of policy Stack Harbor’s cPanel and WHM management practice writes into operational runbooks so the audit trail is intact without slowing the team down.