Skip to content

Recovering an accidentally terminated cPanel account

A cPanel account was terminated by mistake. How to recover it from JetBackup, R1Soft, or a manual pkgacct archive — and the time window that matters.

A WHM operator clicked terminate on the wrong account. The home directory is gone, MySQL databases are dropped, email is deleted. Recovery is possible from backups but the clock is ticking — JetBackup or R1Soft retention windows govern how long you have, and the cleanup happens by background job, not synchronously.

What’s happening

Terminating a cPanel account through WHM removes the account from /var/cpanel/users/, deletes the home directory, drops MySQL databases owned by the account, removes email accounts, and unschedules cron entries. This is done by /usr/local/cpanel/scripts/removeacct and is irreversible from cPanel’s perspective. Recovery depends on having a recent backup outside cPanel’s view.

How to verify

Check what’s available:

jetbackup5api -F getRestorePoints -D '{"account":"<user>"}'
ls /backup/jb/destinations/*/accounts/<user>/ 2>/dev/null
ls /backup/cpmove-<user>.tar.gz 2>/dev/null
serverbackup-recover --list-recovery-points --host <cpanel-host>

JetBackup retention applies — if the terminated account’s snapshots have been purged because the cPanel record is gone, retention may treat them as eligible for cleanup. Act before that happens.

The fix

  1. Immediately disable any retention purge jobs that might delete the terminated account’s snapshots. jetbackup5api -F updateBackupJob with retention temporarily extended, or disable the purge cron.
  2. Identify the most recent snapshot. JetBackup will still show snapshots for the deleted account if you query by account name. R1Soft will show them in the Backup Manager UI.
  3. Restore the account from the snapshot via WHM > JetBackup 5 > Restore > Accounts. The cPanel account will be recreated from the backup state. Confirm package, IP, and quota are correct after restore.
  4. For databases: JetBackup restore includes them, but verify with mysql -e 'SHOW DATABASES' that the expected databases reappeared and mysqlcheck -A for integrity.
  5. Communicate the recovery with timestamps: “Account terminated at 14:32, restored from 02:00 snapshot, six hours of data between the snapshot and termination are not recovered.”
  6. Post-mortem: WHM permissions, not human reflexes, are the right fix. Terminate should require a second-operator confirmation in shared environments.

Stack Harbor handles accidental-termination recovery under environment management when speed matters.