Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
stylenone

Overview

After you create an addon domain, you can create an entirely new account from that addon domain. To do this, copy the information from the addon domain and add it to a newly-created account. This tutorial shows you how to copy addon domains to a new account.

Warning
titleImportant:
  • In cPanel & WHM version 56 and later, do not use the method in this document. Instead, use WHM's Convert Addon Domain to Account interface (WHM >> Home >> Transfers >> Convert Addon Domain to Account).
  • Because it requires that you move files, only the root user or resellers with root -level privileges can perform this action.


Note
titleNote:

This document uses the following example values:

  • username represents the user of the account.
  • newusername represents the user of the new account.
  • addonname represents the name of the addon domain.
  • addondirectory represents the directory for the addon domain. 


Copy addon domains to a new account


Section


Column
width72px


Column

Create a backup file.

Perform a full backup of the account that contains the addon domain. To do this, use cPanel's How to Copy Addon Domains to a New Account  interface (cPanel >> Home >> Files >> Backups) or run the /usr/local/cpanel/scripts/pkgacct script.

For more information about the contents of the backup file, read our Backup Tarball Contents documentation.


 


 

Section


Column
width72px


Column

Create a new account.

Create a new account with a placeholder name in WHM's Create a New Account interface (WHM >> Home >> Account Functions >> Create a New Account).

Warning
titleImportant:

Do not use the addon domain's name as the new account name.



 


 

Section


Column
width72px


Column

Extract the backup file.

To extract the backup file, perform the following steps:

  1. Run the following commands to create the /home/backup-username directory and move the backup file into it:

    Code Block
    languagebash
    linenumberstrue
    mkdir /home/backup-username
    mv cpmove-username.tar.gz /home/backup-username/


  2. Run the following commands to navigate to the /home/backup-username directory and uncompress the backup:

    Code Block
    languagebash
    linenumberstrue
    tar -xzf cpmove-username.tar.gz
    cp /home/backup-username

    These commands extract the backup file's contents to either the cpmove-username or username directories.

  3. Run the following command to add the homedir/public_html/addondirectory/ subdirectory to the /home/backup-username/public_html/ directory:

    Code Block
    languagebash
    cp -R homedir/public_html/addondirectory/* /home/newusername/public_html/



 


 

Section


Column
width72px


Column

Import the databases.

Perform the following steps to import the databases:

  1. Recreate the addon domain's databases and create the database users in cPanel's MySQL Databases interface (cPanel >> Home >> Databases >> MySQL Databases).

    Note
    titleNote:

    Prepend newusername to the databases when you create them. For example, you might create the newusername_dbname file, where dbname represents the name of the database.


  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:

    Code Block
    languagesql
    mysql newaccount_dbname < /home/backup-username/username/mysql/username_dbname.sql



 


 

Section


Column
width72px


Column

Update cron job paths.

Perform the following steps to update the cron paths for the new account:

  1. Open the /home/backup-username/username/cron/username file and check for the addon domain's cron jobs.
  2. Add the paths for the addon domain's cron jobs to the new account in cPanel's Cron Jobs interface (cPanel >> Home >> Advanced >>  Cron Jobs).

    Warning
    titleImportant:

    Ensure that the cron jobs' paths match the new account's paths to the same cron jobs files.



 


 

Section


Column
width72px


Column

Change file ownership.

Use the chown command to grant ownership of the copied public_html files to the newusername user:

Code Block
languagebash
find /home/newusername/public_html -uid 0 -exec chown newusername:newusername {} +



 


 

Section


Column
width72px


Column

Confirm that the account functions

After you change the files' ownership, confirm that the account functions correctly.  To do this, point your operating system's hosts file to the temporary domain placeholder.

For information about how to set the hosts file for your operating system, read Wikipedia's hosts file article.


 


 

Section


Column
width72px


Column

Remove the addon domain.

Remove the old account's addon domain in cPanel's Addon Domains interface (cPanel >> Home >> Domains >> Addon Domains).


 


 

Section


Column
width72px


Column

Change the placeholder domain's name.

Navigate to WHM's Modify an Account interface (WHM >> Home >> Accounts >> Modify an Account) and change the new account's main domain name to the addon domain's name.


 


 

Section


Column
width72px


Column

Copy over email account information

Change the domain name, copy the old account's emails, forwarders, filters, and autoresponders to the new account. To do this, open the /home/backup-username/username directory and run the following commands:

Code Block
languagebash
linenumberstrue
cp va/addonname /etc/valiases/
cp vf/addonname /etc/vfilters/
cp homedir/.autorespond/*addonname* /home/newusername/.autorespond/
cp -R homedir/etc/addonname /home/newusername/etc/
cp -R homedir/mail/addonname /home/newusername/mail/ 

After you copy the emails, forwarders, filters and autoresponders, change the ownership of those files to the new user.  To do this, run the following commands:

Code Block
languagebash
linenumberstrue
chown newusername:mail /etc/valiases/addonname
chown newusername:mail /etc/vfilters/addonname
chown newusername:newusername /home/newusername/.autorespond/*addonname*
find /home/newusername/etc -uid 0 -exec chown newusername:mail {} +
find /home/newusername/mail -uid 0 -exec chown newusername:mail {} +


Warning
titleImportant:

Make certain that you append asterisks ( * ) on either side of addonname to ensure that it keeps the wildcards.

After you change the ownership of the files, confirm that you can log in to the user's Webmail account.

Navigate to the /home/newusername/etc/addonname directory to find the users and email passwords for authentication to IMAP, POP3, and Webmail.


 


 

Additional documentation

Localtab Group


Localtab
activetrue
titleSuggested documentation

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("domains","accounts","accountcreation") and label = "whm" and space = currentSpace()


Localtab
titleFor cPanel users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("domains","accounts","accountcreation") and label = "cpanel" and space in ("DOC",currentSpace())


Localtab
titleFor WHM users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("domains","accounts","accountcreation") and label = "whm" and space in (currentSpace(),"DOC")


Localtab
titleFor developers

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("domains","accounts","accountcreation") and space = "DD"