What a good backup setup looks like
- ✓ Automatic: backups run on a schedule, without anyone remembering to start them.
- ✓ Off-site: at least one copy lives on a different server or storage service.
- ✓ Kept long enough: you keep several days or weeks, so you can go back before a problem started.
- ✓ Tested: you have restored from a backup at least once, and you know it works.
- ✓ Secure: no plain-text passwords in scripts, and backups are not reachable from the web.
Option 1: server-wide backups in WHM (recommended)
If you have root access to WHM, this is the most reliable method. It backs up every account, including files, databases, email and settings.
- Log in to WHM as root.
- Go to Backup > Backup Configuration and turn on Enable Backups.
- Choose the backup type. Compressed saves the most space. Incremental is faster after the first run but cannot be sent to every destination.
- Set the schedule (daily, weekly or monthly) and how many copies to keep.
- Under Files, back up user accounts and, if you want, system files.
- Under Databases, choose to back up databases per account, the whole MySQL folder, or both.
- Under Additional Destinations, add an off-site destination, such as SFTP, an S3-compatible storage service, or another backup server. Use the Validate button to test it.
- Save the configuration.
To start a backup straight away instead of waiting for the schedule, run this as root:
/usr/local/cpanel/bin/backup --force
Backup logs are in /usr/local/cpanel/logs/cpbackup/. Check them after the first run, and set up a WHM notification so you hear about failures.
Option 2: account-level backups from cPanel
Without root access, you can still back up your own account. In cPanel, open Files > Backup or the Backup Wizard. You can download a full backup, or partial backups of your home folder, databases and email forwarders and filters.
Full backups can only be restored by the server administrator, while partial backups can be restored from the same page. Keep both if you want the most options.
Option 3: schedule account backups with cron (no passwords)
cPanel’s Backup API can create a full account backup from a cron job. Send it to another server with an SSH key, not a password, so no secret is stored in the cron line.
Step 1: create an SSH key for backups
In cPanel, open Security > SSH Access > Manage SSH Keys and generate a key. Add the public key to the backup user on the destination server. Give that user access only to its backup folder.
Step 2: add the cron job
In cPanel, open Advanced > Cron Jobs and add a job, for example daily at 3:30. Replace the host, user, key name and folder with your own:
uapi Backup fullbackup_to_scp_with_key host=backup.example.com username=backupuser key_name=backupkey directory=/backups/myaccount email=you@example.com
cPanel sends an email to the address you set when the backup finishes, so you know whether it worked. To keep a copy in your home folder instead, use uapi Backup fullbackup_to_homedir, but remember that a copy on the same server does not protect you if the server fails.
Do not do this:
scripts that log in with your cPanel password, or FTP passwords written in a cron job or a PHP file. Anyone who reads the file gets your account. Use SSH keys or WHM backups instead.
What cPanel backups do not include
Account backups cover what lives inside the cPanel account. They do not cover everything on the server:
- Databases outside MySQL or MariaDB, such as MongoDB or Redis data. Back these up with their own tools.
- Custom server settings, such as hand-edited Apache, PHP or firewall configuration, unless you also back up system files.
- Files stored outside the account’s home folder.
List anything else your sites depend on, and add it to your backup plan.
How long to keep backups
| Site type | Suggested schedule | Suggested retention |
|---|---|---|
| Brochure site that rarely changes | Weekly | 4 to 8 weeks |
| Blog or business site | Daily | 14 to 30 days |
| Online store or busy database | Daily, plus database dumps during the day | 30 days or more |
Keep at least one older copy as well. Malware and data errors are often noticed days after they happen, so a backup from last night may already contain the problem.
Test a restore
A backup you have never restored is a guess. At least once a quarter:
- Restore one account or one database to a test location, not over the live site.
- Check that the site loads and recent data is there.
- Write down how long it took, so you know what to expect in a real emergency.
Administrators can restore accounts in WHM > Backup > Backup Restoration, or single files in File and Directory Restoration. For command-line restores, see our guide to backing up and restoring a cPanel account over SSH.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| Backups stop when the disk is nearly full | cPanel skips backups when free space is low | Free up space, use compressed backups, or send backups to a remote destination only. |
| Remote destination fails validation | Wrong credentials, a firewall, or a closed port | Check the login details and that the destination allows connections from your server’s IP address. |
| The cron backup never arrives | The SSH key is not authorised on the destination | Test the key with a manual SSH login, then check the cron email for errors. |
| Backups take hours | Large accounts, or many accounts in one run | Use incremental backups, or exclude cache folders and old logs. |
For more on protecting your data, see our guide to off-site cPanel backups and creating account backups over SSH.
Need help with this?
Want off-site backups without managing them yourself? UnderHost backup plans store copies on separate infrastructure, with SSH and RSYNC access.
Frequently asked questions
Does WHM back up databases and email?
Yes. WHM account backups include files, databases, email and account settings, as long as accounts and databases are selected in Backup Configuration.
Is a backup on the same server enough?
No. If the server fails or is compromised, local backups can be lost too. Keep at least one copy on another server or storage service.
How do I back up a cPanel account without root access?
Use Files > Backup in cPanel to download a backup, or schedule the Backup API with a cron job that sends the backup to another server with an SSH key.
How often should I test a restore?
At least once a quarter, and after any change to your backup setup. Restore to a test location so the live site is not affected.
Related guides
