How to Backup and Restore cPanel Accounts via SSH

How to Backup and Restore cPanel Accounts via SSH

Backing up and restoring cPanel accounts via SSH is a critical skill for any server administrator. This guide covers how to create individual account backups and restore them using the command line.

How to Create a Backup of an Individual cPanel Account via SSH

  1. Log in to the SSH as the root user.
  2. Enter the following command:
    /scripts/pkgacct username

Note: The account backup will be created in the current directory you are in. The backup file will be named cpmove-username.tar.gz.

Backup to a Specific Directory

To save the backup to a specific location:

/scripts/pkgacct username /path/to/backup/directory

How to Restore an Individual cPanel Account via SSH

  1. Navigate to the directory where the backup file is stored.
  2. Enter the following command:
    /scripts/restorepkg username

Note: You must be in the directory where the cpmove-username.tar.gz file is located, or specify the full path.

Restore from a Specific Path

/scripts/restorepkg /path/to/backup/cpmove-username.tar.gz

Backup All cPanel Accounts

To create backups for every cPanel account on the server:

for user in $(ls /var/cpanel/users); do /scripts/pkgacct $user /backup/; done

Useful Options

  • --skiphomedir — Skip the home directory (backs up only MySQL, email, and configs).
  • --skipmysql — Skip MySQL databases.
  • --skipacctdb — Skip the account database backup.

Troubleshooting Common Issues

  • Disk space error: Make sure you have enough free disk space in the target backup directory.
  • Permission denied: Ensure you are running the commands as root.
  • Account already exists: If restoring an account that already exists, use --force flag to overwrite.
  • cpanel, backup, restore, ssh, migration
  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

How to GET Unlimited hosting with Free Domain Name

How to Get Unlimited Hosting with a Free Domain Name At SubwayHost, we offer unlimited hosting...

How to fix cPanel 500 internal server error

How to Fix cPanel 500 Internal Server Error A 500 Internal Server Error in cPanel is one of the...

cPanel does not support NetworkManager enabled

Fix: cPanel Does Not Support NetworkManager Enabled If you encounter the following error while...

How to install Softaculous on cPanel/WHM

How to Install Softaculous on cPanel/WHM Softaculous is the leading auto-installer for web...

How to rebuild user data files for cPanel

How to Rebuild User Data Files for cPanel The userdata directory is one of the most important...