Control panels

How to terminate a cPanel account in WHM safely

Remove a cPanel account from WHM without regrets. Take a full backup first, decide whether to keep the DNS zone, terminate one or many accounts and confirm files and databases are gone.

BeginnerLinux server3 min read

Terminating a cPanel account deletes everything it owns: website files, mailboxes, databases, cron jobs and usually its DNS zone. It cannot be undone from WHM. This guide shows how to take a backup first, terminate one or several accounts, and confirm that the data has really gone.

Before you start

  • Root or reseller access to WHM on a cPanel server running on a Linux VPS.
  • Written confirmation from the account owner or your own records that the account should be removed.
  • Enough free disk space for one full backup of the account.

Warning: Termination permanently deletes the account's files, email and databases. There is no recycle bin. Take a backup and copy it off the server before you continue.

Consider suspending first

If you are not sure the account is finished with, suspend it instead. A suspended account keeps all its data but stops serving the site. If nobody complains within a few weeks, terminate it then. See suspend and unsuspend cPanel accounts.

Step 1: Take a full backup

Create a full account backup (a cpmove file) from SSH:

Bash
/scripts/pkgacct exampleuser /root/final-backups

Replace exampleuser with the cPanel username. Create the folder first with mkdir -p /root/final-backups. When it finishes, you will see a file like:

/root/final-backups/cpmove-exampleuser.tar.gz

Copy it off the server, for example to your computer:

Bash
scp root@203.0.113.10:/root/final-backups/cpmove-exampleuser.tar.gz .

This file can be restored later with WHM's Restore a Full Backup/cpmove File tool if needed.

Step 2: Terminate one account

  1. In WHM, go to Home » Account Functions » Terminate Accounts.
  2. Find the account by domain or username and select it.
  3. Decide about DNS:
  • Leave Keep DNS Zone unticked to remove the zone. Choose this when the domain is gone for good or moving to another provider that will host its own DNS.
  • Tick Keep DNS Zone if this server is still the authoritative nameserver and you want the domain to keep resolving, for example while it moves elsewhere.
  1. Click Terminate, then confirm.

WHM shows a log while it removes the account.

Terminate several accounts

The same page lets you select several accounts at once. Select each one, check the list carefully, then click Terminate and confirm.

Warning: Bulk termination is the fastest way to delete the wrong account. Read the list of usernames twice before you confirm, and make sure each has a backup.

Check it works

Confirm the account is gone:

Bash
grep exampleuser /etc/trueuserdomains
ls -ld /home/exampleuser

Both should return nothing, or an error saying the directory does not exist.

Check its databases are gone. The name prefix is the username:

Bash
mysql -e "SHOW DATABASES LIKE 'exampleuser\_%';"

The query should return no rows.

If you removed the DNS zone:

Bash
ls /var/named/example.com.db

It should not exist.

Troubleshooting

  • Account still listed after terminating: the process failed part way. Check the output on screen, then run the termination again.
  • Domain still resolves to this server: the zone was kept, or other servers still cache the old records. Remove the zone or wait for the TTL to expire.
  • Leftover databases or users: a database was created outside cPanel with a name that does not use the account prefix. Remove it manually after checking it is not in use.
  • Need the account back: restore the cpmove file in Home » Backup » Restore a Full Backup/cpmove File.

Next steps

  • Learn restore options: restore a cPanel account backup.
  • Keep regular backups: cPanel backup configuration.
  • Need help with your server? Open a ticket.
Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.