It becomes very easy to copy Addon Domains to a new account, when one has all the accurate information. That’s why, the detailed information provided here will prove to be very useful. But before we elaborate on the steps to attain this objective, there are certain important points to mention. The information provided here is valid only for cPanel & WHM version 54, and those earlier to it. For cPanel & WHM version 56 and the later versions, one should use Convert Addon Domain to Account interface in WHM. Since this process involves moving files, this action could be carried out only by the root user or by those resellers that have root-level privileges.
Once you have created an addon domain, it becomes possible for you to create a totally new account from that addon domain. For this purpose you need to copy the relevant information from the addon domain, and subsequently add it to the account that has been newly-created. The aim of this tutorial is to provide accurate information on how to copy addon domains to a new account.
Before elaborating on the steps that are involved in this process, the example values that have been used, need to be described.
Username – The user of the account is represented by it
Newusername – The user of the new account is represented by it
Addonname – The name of the addon domain is represented by it
Addondirectory – The directory for the addon domain is represented by it
Process of Copying Addon Domains to a New Account
The following steps need to be followed sequentially to ensure that addon domains get copied to a new account successfully.
1. Creation of a Backup File
The first step involves carrying out a full backup of that account, which contains the addon domain. You need to use the Backups interface of cPanel for this purpose or you can run the following script, /usr/local/cpanel/scripts/pkgacct
2. Creation of a New Account
Now you need to create a new account in the Create a New Account interface of WHM. This new account has to be created with a placeholder name.
WHM >> Home >> Account Functions >> Create a New Account
It needs to be mentioned here that you should not use the name of the addon domain as the name of the new account.
3. Extracting the Backup File
The below-mentioned steps need to be carried out for extracting the backup file.
You need to run the two commands that are being mentioned below, for creating the /home/backup-username directory. Then you need to move the backup files into it.
mkdir /home/backup-username
mv cpmove-username.tar.gz /home/backup-username/
Next you have to run the following commands in order to navigate to the /home/backup-username directory, and then uncompress the backup.
tar -xzf cpmove-username.tar.gz
cp /home/backup-username
The backup files’s contents are extracted to either the username directories or to the cpmove-username by these commands.
Now you need to run the following command for adding the homedir/public_html/addondirectory/ subdirectory to the /home/backup-username/public_html/ directory:
cp -R homedir/public_html/addondirectory/* /home/newusername/public_html/
4. Importing the Databases
The following steps need to be performed in order to import the databases.
You must recreate the databases of the addon domain, and create the database users in MySQL Databases interface of cPanel. Here it needs to be mentioned that you must prepend newusername to the databases while creating them.
Once you have created the databases and the database users, you need to import the database backups of each domain. For this purpose you need to run the below-mentioned command for each backup.
mysql newaccount_dbname < /home/backup-
username/username/mysql/username_dbname.sql
5. Updating Cron Job Paths
You have to carry out the below-mentioned steps for updating the new account’s cron paths.
Open the /home/backup-username/username/cron/username file, and then check for the addon domain’s cron jobs.
Next you need to add the paths with regard to the addon domain’s cron jobs to the new account in the Cron Jobs interface in cPanel. You need to ensure that the paths for the cron jobs match the new account’s paths to the same cron jobs files.
6. Changing File Ownership
You have to use the chown command for granting ownership of the copied public_html files to the user of the newusername.
Find /home/newusername/public_html -uid 0 -exec chown newusername:newusername {} +
7. Ascertaining That the Account Functions
Once you have changed the ownership of the files, you must ascertain whether the account is functioning properly. You need to point the hosts file of your OS (Operating System) to the temporary domain placeholder for this purpose.
8. Removing the Addon Domain
You should remove the addon domain of the old account in the Addon Domains interface in cPanel.
9. Changing the Placeholder Domain’s Name
Next you need to change the name of the placeholder domain. To do this, you should navigate to Modify an Account interface of WHM. Then you should change the main domain name of the new account to the addon domain’s name.
10. Copying Email Account Information
Now you should change the domain name, and copy the emails, filters, forwarders, and autoresponders of the old account to the new account. You need to open the /home/backup-username/username directory for this purpose, and then run the below-mentioned commands.
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/
When you have finished copying the emails, filters, forwarders, and autoresponders; you need to change the ownership of those files to the new user. You need to run the following commands for this purpose
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 {} +
Here it needs to be mentioned that you shouldn’t forget to append asterisks (*) on either side of addonname.
Once you have changed the ownership of the files, ensure that you are able to log in to the Webmail account of the user. You should navigate to the /home/newusername/etc/addonname directory, and then find the users and email passwords for authentication to Webmail, POP3, and IMAP.
This is how addon domains are copied to a new account, and now you have all the information that is needed for this process to be successfully carried out.
In the context of domains, if you are looking for the most professional, efficient and reliable service for registering domains, HTS Hosting is an ideal choice for you. Its top-tier quality of service has established it as the most preferred service provider with regard to registering domains, as well as for web hosting. HTS Hosting is frequently referred to as the “Best Website Hosting Company” and as the “Best Cloud Hosting Company” by our clients from various parts of the world, who vouch for our outstanding quality of service at the most affordable prices.
Comentarios