Skip to content

Changing a cPanel account's username — and why cPanel does not support rename

cPanel deliberately does not implement an account-rename operation. The supported path is terminate-and-recreate; the unsupported path is hacking the user file and accepting the breakage.

A customer’s company changed names and they want their cPanel username to match the new brand. The reseller looks for a “rename account” button in WHM, doesn’t find one, and asks support. The answer customers don’t want to hear is that cPanel does not support rename — never has, the engineering reasons are real, and the workaround is to package the account, terminate it, and restore it under a new name. The reseller asking the question usually doesn’t know why the answer is no.

What’s happening

A cPanel username is a Linux UID, a MySQL database prefix, a mailbox owner, an FTP user, a DNS reverse pointer in some shapes, a quota project ID, a directory name in /home/, a key in /var/cpanel/users/, an entry in /etc/userdomains, and a domain owner in several other internal indexes. Renaming consistently across all those surfaces is the kind of operation that has to be atomic; cPanel doesn’t ship a rename because the consequences of partial failure are worse than the rename was worth. The supported workaround is to recreate the account under the new name and let the customer’s apps re-configure.

How to verify

For any account, audit the surfaces where the username appears:

whmapi1 accountsummary user=acme
ls /home/acme
mysql -e "SHOW DATABASES LIKE 'acme\\_%'"
grep acme /etc/userdomains
grep acme /var/cpanel/users/*
quota -u acme

This is the list a rename would have to touch. Each surface is a potential failure point in any rename you attempt manually.

The fix

The supported workaround is the terminate-and-recreate dance:

  1. Snapshot the account with pkgacct user=acme. The archive contains everything you need.
  2. Communicate with the customer before doing anything irreversible. The new username changes their MySQL connection strings (acme_wp becomes newco_wp), their FTP username, their cPanel login, and the domain owner in WHM. Their apps need re-configuration.
  3. Inside the archive, rename the database prefix before restoring. Extract, edit the mysql directory and cpmove-acme-mysql.sql to replace acme_ with newco_, repack.
  4. Terminate the old account: whmapi1 removeacct user=acme keepdns=1. The keepdns=1 preserves the DNS zone for the new account to inherit.
  5. Restore under the new name: restorepkg --user=newco --owner=acmevpn /home/cpmove-acme-modified.tar.gz. The restore command builds the account with the new username; the new home directory is /home/newco; the database prefix is now newco_.
  6. Customer config update: walk the customer through updating wp-config.php, FTP clients, any saved cPanel bookmarks, and any external integrations that referenced the old username.

For shops where customer rebrand requests come up regularly, Stack Harbor’s agency partner practice runs the terminate-recreate dance with the customer’s app-side updates as a single ticket so the customer never sees a partial state.