Backup all cPanel accounts (then restore them) from ssh as root

To backup all accounts at once use the following command:

for backup in `\ls /var/cpanel/users/`; do echo /scripts/pkgacct $backup; done


Afterwards download the backup files created (they will begin with cpmove- and be in the /home directory)

To restore the backups upload the files under /home on the server then run the following also while within the /home directory:

for backup in `ls |grep cpmove- | cut -d- -f2 | cut -d. -f1`; do echo /scripts/restorepkg $backup; done


Please note for safety reasons I have added the echo command before the script command in the examples so you can see what the script is going to actually do first. If everything looks good then remove echo from the line and away you go!

Good luck!

Share this Post