TechSpace Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

How to Copy Addon Domains to a New Account

Views: 181
Votes: 0
Posted: 29 Apr, 2016
by:
Updated: 30 Apr, 2016
by:

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.

Copy an addon domain to a new account

Important:

 Only the root user, or resellers with root-level privileges, can perform this action because it requires that you move files.

To copy an addon domain to a new account, perform the following steps:

Note:

In this document:

  • username represents the user of the account.
  • newusername represents the user of the new account.
  • addonname represents the name of the addon domain.
  • addonfolder represents the folder for the addon domain.

Step 1: Create a backup

Create a full backup of the account with the addon domain. To do this, use cPanel's Backups interface (Home >> Files >> Backups), or run the/scripts/pkgacct script.

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

Step 2: Create a new account

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

Important:

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

Step 3: Extract the backup

Extract the backup that you created.  To do this, perform the following steps:

  1. Create the /home/backup-username directory, where username represents the name of the account. To do this, run the following command:

    mkdir /home/backup-username
  2. Open the /home directory and move the backup file into the /home/backup-username directory. To do this, run the following command:

    mv cpmove-username.tar.gz /home/backup-username/
  3. Uncompress the backup.  To do this, run the following command:

    tar -xzf cpmove-$username.tar.gz

    This commands extracts the backup to either the cpmove-username or username directories
     

  4. Open the directory and add the homedir/public_html/addonfolder/ subdirectory to the /home/newusername/public_html/ directory.  To do this, run the following command:

    cp -R homedir/public_html/addonfolder//home/newusername/public_html/

Step 4: Import the databases

To import the databases, perform the following steps:

  1. Recreate the addon domain's databases and create the database users in cPanel's MySQL Databases interface (Home >> Databases >> MySQL Databases).
    • Prepend newusername to the databases when you create them.  For example, $newusername_dbname
  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 $newaccount_dbname < /home/backup-$username/$username/mysql/$username_dbname.sql

Step 5: Update cron paths

To update the cron paths for the new account, perform the following steps:

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

    Important:

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

Step 6: Change file ownership

Use the chown command to grant ownership of the public_html files that you copied to $newuser. To do this, run the following command:

find /home/$newusername/public_html -uid 0 -exec chown $newusername:$newusername {} +

Step 7: 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.

Step 8: Remove the addon domain

After you confirm that your new account functions, remove the old account's addon domain in cPanel's Addon Domains interface (Home >> Domains >> Addon Domains).

Step 9: Change the placeholder domain's name

After you remove the old account's addon domain, navigate to WHM's Modify an Account interface (Home >> Accounts >> Modify an Account)and change the new account's main domain name to the addon domain's name.

Step 10: Copy over email account information

After you change the domain name, copy the old account's emails, forwarders, filters and auto responders to the new account. To do this, open the /home/backup-$username/$username directory and run the following commands:

1
2
3
4
5
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:

1
2
3
4
5
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 {} +

Important:

Make certain that you pass 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.

Others in this Category
document Import contacts from Google Gmail to Outlook
document Microsoft : Autodiscover Service
document How to access cPanel
document Access webmail from the cPanel interface
document How to use SSH to log in to the command line
document cPanel & WHM service URLs
document How to Configure Mail Filters
document How to Configure the Apache SpamAssassin Report_Safe Option
document How to Create a Spam Email Filter
document How do I set up an out-of-office reply for incoming emails?
document How to Create Mail Filter Rules For Mailing Lists
document How to Set Email Send Limits
document How to Set Up a cPanel Email Account for iOS
document How to Set Up a cPanel Email Account for How to Set Up a cPanel Email Account for iOS
document IMAP vs. POP3
document Introducing Send Email in Access 2013 web apps
document How to always pop-out an email window in Outlook 2013
document Tutorial: Outlook signature image with hyperlink
document Fix for Outlook: “Contacting the server for information”
document "Attachment size exceeds the allowable limit" error when you add a large attachment to an email message in Outlook
document Outlook 2013 max file limit: “The file you’re attaching is bigger than the server allows.”
document Outlook hangs on loading profile? Solutions
document Message stuck in Outbox
document How To Convert A POP/IMAP Mailbox To Exchange / Exchange Mailbox to POP/IMAP
document 550 Relay Not Permitted error message when sending mail
document Turn Thunderbird into the Ultimate Gmail IMAP Client
document Set up email in Android email app



RSS