Restore backup via SSH Multiple accounts

jegavelan

Member
Dec 19, 2008
10
0
51
How to restore the backup from the backup via ssh for multiple accounts

Suppose i have 100 accounts how i can restore the cpanel of those accounts via the ssh without running the /scripts/restorepkg username for each account
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
You must run the "/scripts/restorepkg" command to restore from a full account backup; to avoid having to do this manually for each account backup you may want to script the shell command so that it runs "/scripts/restorepkg" in a loop from a list of users that you provide.

Here is an example, assuming the list of users is stored in a text file at "/root/list_of_users.txt":
Code:
# for x in $(cat /root/list_of_users.txt); do /scripts/restorepkg /home/cpbackup-$x.tar.gz; done;
Alternatively, if the filename of the full backups varied, you could store a list of the full paths to each backup in a text file, such as a text file at "/root/list_of_backups.txt" and then the command could be altered as follows:
Code:
# for x in $(cat /root/list_of_backups.txt); do echo /scripts/restorepkg $x; done;
 

raonaveed

Member
Nov 30, 2009
13
0
51
How can i take backup from any other server where i have only reseller access not the root or you can say only cpanel account access so in that case how i can take remote backup on that server and fetch on my server where i have root login using SSH command or api calls?
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
How can i take backup from any other server where i have only reseller access not the root or you can say only cpanel account access so in that case how i can take remote backup on that server and fetch on my server where i have root login using SSH command or api calls?
As I understand you said root access is available only on the destination server, where I believe you're wanting to transfer to or restore the account on via a full cPanel account backup.

With root access only on the destination server and not on the source/original server, you may use WHM via the following menu path:
WHM: Main >> Transfers >> Copy an Account from Another Server with Account Password

With or without root access on either machine, and specifically, with only access to the source/original server via the cPanel account username and password, you may login to cPanel and then generate a full cPanel account backup via either of the following two menu paths:
cPanel: Main >> Files >> Backups
cPanel: Main >> Files >> Backup Wizard

When generating the cPanel full account backup, you will have the option to modify the desired e-mail contact address that is used for notification upon completion; you will also have the option to select the desired destination of your full backup, including in the cPanel user's home directory on that same server, or a remote destination where the full backup will be copied into an FTP account you provide or copied to a remote server using SSH/SCP access that you provide. Depending on how much data is involved and how long it takes the server to complete the requested task there may be a significant period of time where you must wait while the backup is being created and, optionally, subsequently copied via FTP or SCP/SSH access. Upon completion you should receive an e-mail at the contact address that was provided when requesting the full backup be generated via cPanel.

If the domain name of the cPanel account no longer resolves to the original/source server you may access that server directly by IP address or hostname, such as one of the following examples; in these examples simply replace "server" with either the server IP address or the server hostname, whichever is known:
Code:
http://server:2082/
https://server:2083/
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,873
1,535
313
cPanel Access Level
Root Administrator
Hey there @Bashed

Those backups are created from cPanel user accounts using the Backup Wizard, but they can be restored the same way with the /scripts/restorepkg tool. I tested this on my end just now with a file named backup-5.14.2020_14-48-24_username.tar.gz that I had from an old migration and it worked just fine. Let me know if you run into issues!
 

Bashed

Well-Known Member
Dec 18, 2013
146
4
68
cPanel Access Level
Root Administrator
What about mass ownership change from old reseller username to new one, via ssh in one command instead of going through 50+ checkmarks in WHM?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,873
1,535
313
cPanel Access Level
Root Administrator
For that work, we do have the Change Ownership of Multiple Accounts interface in WHM, so you can click through a list of domains and perform that action all at once. You just choose the owner you want to switch the accounts to, and that will take you to a page that looks like this, where you can just choose which domains to switch over:

Screen Shot 2021-01-26 at 2.34.26 PM.png

We also have the Modify an Account API call here, which replicates the behavior of that interface in WHM:


so either one of those should get you where you need to be!
 

Bashed

Well-Known Member
Dec 18, 2013
146
4
68
cPanel Access Level
Root Administrator
For that work, we do have the Change Ownership of Multiple Accounts interface in WHM, so you can click through a list of domains and perform that action all at once. You just choose the owner you want to switch the accounts to, and that will take you to a page that looks like this, where you can just choose which domains to switch over:
Please read my last reply. I mentioned this already and it's cumbersome to "check" 50+ accounts for large migrations in WHM.

"What about mass ownership change from old reseller username to new one, via ssh in one command instead of going through 50+ checkmarks in WHM?"

I would like to know a bash script that can be run, similar to the bash script for the mass restore.