How to Duplicate WHM account with in the same server?

phpsharma

Registered
Feb 22, 2012
1
0
51
cPanel Access Level
Root Administrator
Hi

I am using WHM v11.42 on vps sever.
I would like to duplicate a account to another name?
I don't want to copy/transefer from another servers.

Please advise me.

Thanks,
sharma
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,256
463
Hello :)

If you mean that you want to just make an exact copy of the account on the same server, then you will have to first backup the account with a command such as:

/scripts/pkgacct $username

Then, since you can not have the same domain name exist on a single server, you must rename the first account to a different domain name and username via ""WHM Home » Account Functions » Modify an Account". You can then restore the previous account from backup. Note that this does not take into account the user of parked/addon domains, or MySQL databases.

Thank you.
 

cpatafio

Registered
Feb 17, 2015
2
0
1
cPanel Access Level
Root Administrator
Hi!

I have a similar but slightly different requirement. I've setup a new VPS server and copied one of our landing page sites to the new server. I've created 10 new cpanel accounts with different cpanel users and domains (the first of 100 such landing page accounts). I now want to clone the first website into the 10 new sites.

I know how to do this by downloading the contents of the public_html directory to my computer and exporting the MySQL database to my computer then uploading the contents to the public_html directory of the new cpanel accounts and importing the MySQL database to the new database. However, since ultimately, there will be over 100 of these sites (with minor text and image tweaks), I was hoping there was an easier way from within WHM to accomplish this. Is there?

I thought I could use the "Restore a Full Backup/cpmove File" function and NOT have it overwrite the existing (new) cpanel username. But, when I tried this, I received an error stating that the same cpanel user already exists.

Does anyone have an "easy" way to do this? I realize, once the clone is created (if it can be), we'll have to login and modify the configuration files that point to the database. But, this is a lot less work than having to upload the files over 100 times.

I hope someone out there has figured out how to do this. If it is possible to use the "Restore a Full Backup/cpmove File", can someone tell me how?

Thanks in advance,

Clem
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,256
463
You could setup a post account creation hook that runs a custom script to copy files/databases. Information on script hooks is available at:

Guide to Standardized Hooks
Whostmgr Functions

You may want to consult with a software developer if you need the full script developed for you.

Thank you.