User Tools

Site Tools


Migrating a cPanel addon domain to it's own account

Copying a cPanel addon domain to it's own cPanel account can be quite tricky. It's extremely beneficial, as my own personal prefence is for each website to have it's own cPanel account. This makes for much better/easier control and often times can prevent developmental issues down the road. This article will break down the steps recommended for migrating an addon domain to a new cPanel account. There are different methods in which to perform this task, however this is based on the recommended method from cPanel.

Copying a cPanel addon domain to it's own account is not covered by Support's Migration Services, this is considered developmental and proceed with caution at your own risk.

Copying an Addon Domain to a New cPanel Account

You'll need to login to your WHM Panel as the root user. ( https://yourserversip:2087 or http://yourserversip:2086 )

Create a backup of the account containing the addon domain

  1. Navigate to WHM's List Accounts Panel ( Home » Account Information » List Accounts )
  2. Open the cPanel interface for the account containing the addon domain by click the cPanel Logo Icon ( ) located in the "cPanel" column.
  3. In the user's cPanel account, navigate to ( Home » Files » Backup )
  4. Via the Backup Page, click the "Download" button under the "Full Backup" section.
  5. You will then be prompted to pick a backup destination and opt to be notified once the backup is complete. For the destination, ensure that you select "Home Directory".

Create a new cPanel account

  1. Close out of the cPanel user's interface and navigate back to WHM.
  2. Navigate to the Create a New Account Panel ( Home » Account Functions » Create a New Account ).
  3. When creating the new account, which will be used as the migrated destination for your current addon domain, you must not use the addon domain's domainname for this new account. I'd recommend something like ''
    • The remain configuration settings and options are strictly up to you.

Extracting the created backup

  • SSH into your server as the root user.
  ssh root@serversipaddress -p 2200
  • Make a new backup directory for the old addon domain account.
  mkdir /home/backup-oldaccountusername
  • Move the newly created backup file ( /home/oldaccountusername/backup-10.24.2014_15-59-39_oldaccountusername.tar.gz ) into that newly created backup directory.
  mv /home/oldaccountusername/backup-10.24.2014_15-59-39_oldaccountusername.tar.gz /home/backup-oldaccountusername/
  • Extract the backup file inside of that directory.
  cd /home/backup-oldaccountusername
  tar -xzf backup-10.24.2014_15-59-39_oldaccountusername.tar.gz
  • Copy the addon domain contents to the newly create cPanel account's html directory.
  cd /home/backup-oldaccountusername/backup-<date>_<digits>_<oldaccountusername>/homedir/public_html/
  • Determine the folder/directory that the addon domain resides in, for this example we'll say 'addondirectory'.
  cp -R addondirectory/* /home/newcpanelaccount/public_html

Import the old databases to the new account

  1. Recreate the addon domain's databases and create the database users in cPanel's MySQL Databases interface ( Home » Databases » MySQL Databases ).
    • Prepend newcpanelaccount to the databases when you create them. ( ex. newcpanelaccount_databasename ).
  2. After you create the databases and database users, import each domain's database backups. To do this, run the following command for each backup:
  mysql newcpanelaccount_databasename < /home/backup-oldaccountusername/backup-<date>_<digits>_<oldaccountusername>/mysqloldaccountusername_dbname.sql

Fix the ownership and permissions ( based on suPHP )

  1. Correct all file and directory permssions.
  find /home/newcpanelaccount/public_html/ -type d -print0 | xargs -0 chmod 0755
  find /home/newcpanelaccount/public_html/ -type f -not -name "*.pl" -not -name "*.cgi" -not -name "*.sh" -print0 | xargs -0 chmod 0644
  find /home/newcpanelaccount/public_html/ -type f -name "*.cgi" -print0 -o -name "*.pl" -print0 -o -name "*.sh" -print0 | xargs -0 chmod 0755
  1. Correct all file and directory ownership.
  find /home/newcpanelaccount/public_html/ -type f | xargs chown newcpanelaccount:newcpanelaccount
  find /home/newcpanelaccount/public_html/ -type d | xargs chown newcpanelaccount:newcpanelaccount

Confirm that the newly created account works properly

  1. You can test this with instructions from the How can I test my migrated website before changing the DNS? article in or Knowledgebase.

Remove the addon domain (it's ok, you have a backup if anything goes wrong)

  1. Once you've confirmed that the new account works properly remove the old account's addon domain from the cPanel user's interface.
  2. Once logged in to the old account's cPanel interface ( reference ) navigate to the Addon Domains Panel. ( Home » Domains » Addon Domains ).
  3. Scroll down to Modify Addon Domain and select the Delete Action.

Change the new account's domain name

  1. Navigate to WHM's Modify an Account Panel ( Home » Accounts » Modify an Account ) and change the 'temporary' new account domain ( ex. ) to the addon domain's domain name that is now removed.

Other Useful Resources

control-panels/cpanel-whm/how-can-i-migrate-a-cpanel-addon-domain-to-its-own-account.txt · Last modified: 2020/06/02 11:08 by Karson N.