Change Domain Name for cPanel Account from SSH Terminal

This article provides a quick workaround for changing the primary domain name of a cPanel account. Root level access is required.

In the case that the cPanel account domain name should be quickly modified (such as ->, the following procedure can solve the issue.


  • Requires full root access
  • cPanel installed on server
  • Recent backup of account which is to be modified (in this example, the account backup is located in /home/backupuser/backup.tar.gz)


As root user, access the server via SSH and run the following commands:

/scripts/removeacct --force username
/scripts/restorepkg --force /home/backupuser/backup/cpmove-username.tar.gz
mv /var/cpanel/userdata/username/ /var/cpanel/userdata/username/
mv /var/cpanel/userdata/username/ /var/cpanel/userdata/username/
sed -i -e 's/username\.com/username\.net/g' /var/cpanel/userdata/username/ 
rm -f /var/cpanel/userdata/username/cache
sed -i -e 's/username\.com/username\.net/g' /var/cpanel/userdata/username/main
rm -f /var/cpanel/userdata/username/main.cache
sed -i -e 's/username\.com/username\.net/g' /var/cpanel/users/username
mv /var/named/ /var/named/
sed -i -e 's/username\.com/username\.net/g' /var/named/
sed -i -e 's/username\.com/username\.net/g' /etc/named.conf
/scripts/updateuserdatacache --force username
rndc reload
#Changing Password
/scripts/chpass username myhardpassword
#Synching FTP pass

Use the following guidelines for creating the above commands with your custom data:

  • Substitute the cPanel account username for "username"

  • Substitute the IP Address for ""
  • Substitute existing domain name for ""

  • Substitute the new domain name for ""

  • Substitute the cPanel account password for "myhardpassword"
  • cpanel shortcut, modify domain, change domain, cpanel workaround, cli workarounds, cpanel cli, cpanel scripts
  • 11 Users Found This Useful
Was this answer helpful?

Related Articles

Remove a Service from ChkServd Monitoring for cPanel Servers

This guide requires root user account in server. In some circumstances, ChkservD cPanel...

Assigning a Dedicated IP Address to a Subdomain using WHM

To assign a dedicated IP address to a subdomain, perform the following steps: Step 1: Add the...

Enable Lets Encrypt AutoSSL Provider

This article refers to cPanel version 84 and later. Enable Let's Encrypt for AutoSSL Follow...

How to Fix Incorrect cPanel Account Quotas and Disk Usage

This article will provide a step-by-step guide to fix incorrect account quotas and disk usage on...

How to Uninstall Installatron in WHM cPanel Server

This guide will show you how to quickly uninstall Installatron software from WHM/cPanel server....