WHM Backup Restore: Recover a Directory Safely
In this article
To restore a backup file directory in WHM, use the backup restoration tools under WHM > Backup > Backup Restoration (labels can differ slightly by version). You select the backup date and the account, then choose the directory you want to restore and where it should go. This achieves a point-in-time recovery of files without touching the rest of the account, which is useful when a site update, accidental deletion or bad upload broke a folder. Before you start, confirm the backup actually contains the directory you need and that you have root access to WHM; restoring over live files will overwrite whatever is currently there.
What You'll Need
- Root-level access to WHM (the Backup Restoration area is not available to resellers or cPanel users).
- At least one completed backup that includes the account and directory you want to recover.
- The exact account name (cPanel username) and the directory path, for example
public_html/wp-content/uploads. - Enough free disk space on the destination server for the restored files.
- A maintenance window or a way to put the site into maintenance mode, so visitors do not see half-restored files.
Step-by-Step
- Log in to WHM as root. Open your WHM URL in a browser and sign in with the root account. If you only have cPanel access, you cannot use this tool; ask your host or server administrator to run the restore for you.
- Confirm the backup exists and is complete. Go to WHM > Backup > Backup Configuration and check that backups are enabled and where they are stored. Then open WHM > Backup > Backup Restoration (or the equivalent restore area in your WHM version) and look for the backup date you need. If the date is missing, the backup did not finish or was pruned, and you will need another copy before continuing.
- Select the backup date. In the restoration tool, choose the date that contains the version of the directory you want. Pick the most recent date that is known to be good, not simply the newest one, if the problem was caused by a change made after that date.
- Choose the account. Select the cPanel account that owns the directory. If you are unsure of the username, check WHM > Account Information > List Accounts.
- Pick the directory to restore. The tool lets you restore a full account or selected items. Choose the specific directory or file path you need. Restoring a single directory is faster and safer than restoring the whole account, because it leaves databases, email and other files untouched.
- Decide where the files should go. Most restore tools place files back at their original path. If you want to inspect the files before overwriting anything, restore to a temporary location such as a staging folder or a separate directory outside
public_html, then compare and copy across the files you need. - Start the restore and watch the output. Click the restore button and leave the page open until the process reports completion. Large directories can take several minutes. Do not close the browser or start a second restore while one is running.
- Check ownership and permissions. Restored files should keep the account's user ownership. If you restored to a temporary folder, verify ownership with the file manager or a shell command before moving files into place. Files owned by the wrong user can cause permission errors or, worse, be readable by other accounts.
- Verify the site. Load the affected pages, check that images and uploads display, and review the error log for the account. If the directory contained code, test the relevant feature rather than only the home page.
- Clean up temporary copies. Delete any staging folder you created so old files are not left publicly accessible or counted against disk quota.
Common Mistakes
- Restoring the whole account when only one folder is needed. A full restore can roll back databases, email and configuration you did not intend to change.
- Assuming the newest backup is the right one. If the damage happened before the latest backup ran, the newest copy may already contain the broken files.
- Restoring directly over live files during business hours. Visitors can hit missing or mismatched files while the restore is in progress.
- Ignoring ownership. Files restored as the wrong user often produce 403 or 500 errors even though the content is correct.
- Forgetting that backups may exclude some directories. Backup configuration can skip certain folders or be limited to specific accounts, so check the include and exclude settings before relying on a copy.
Tips
- Restore to a temporary directory first whenever the change is risky, then move only the files you need. This keeps a working copy available if the restore makes things worse.
- Note the exact backup date and account in your change log so the next person knows which copy was used.
- Put the site into maintenance mode before restoring a live directory, and take it out afterwards.
- If the directory is large, restore during low-traffic hours to reduce the chance of timeouts or partial page loads.
- Keep at least one recent backup on separate storage, because a backup stored on the same disk as the live site can be lost with it.
Troubleshooting
- The backup date is missing from the list. The backup may have failed, been pruned by retention settings, or be stored in a location WHM cannot read. Check the backup logs and the destination path in Backup Configuration.
- The restore finishes but files are unchanged. Confirm you selected the correct account and path, and that the backup actually contains that directory. Some configurations exclude certain folders.
- Permission denied or 500 errors after restore. Check file ownership and permissions. Restored files should belong to the account user, with directories typically readable and executable and files readable.
- The restore times out. Very large directories can exceed browser or server limits. Restore a smaller subdirectory at a time, or ask your host to run the restore from the command line.
- Disk space runs out mid-restore. Free space first; a partial restore can leave incomplete files. Remove the partial copy and run the restore again once space is available.
Frequently Asked Questions
Can I restore a single directory without restoring the whole account?
Yes. WHM's backup restoration tools let you select specific files or directories for an account, which is the safer option when only one folder is damaged.
Will restoring a directory overwrite newer files?
Yes, if you restore to the original location. Anything currently in that path is replaced by the backup version. Restore to a temporary folder first if you need to compare.
Can a reseller or cPanel user run this restore?
No. The WHM backup restoration area requires root access. cPanel users should ask their host or administrator to perform the restore.
Does restoring files also restore the database?
Not when you restore only a directory. Database contents are separate; restoring a folder does not roll back MySQL data.
How do I know which backup date to choose?
Pick the most recent date before the problem occurred. If you are unsure, restore to a temporary location and inspect the files before replacing live ones.
What if the backup does not include the directory I need?
Check the backup include and exclude settings and the backup logs. If the folder was excluded or the backup failed, you will need another backup source.