Skip to main content
Cloud Hosting starting at $2.91/mo. Auto-scaling servers with a FREE domain included. Start Now →
Tutorials

How to Create & Restore Website Backups Using cPanel and SSH

Your website is one bad plugin update away from disaster. This tutorial covers multiple backup methods — from cPanel's built-in tools to SSH scripts — so your data is always recoverable.

S

Serverlys Team

Jun 16, 2026 · 7 min read

Website backups are like insurance: you do not appreciate them until you need one. A bad theme update, a hacked admin account, an accidental file deletion, or a corrupted database can all take your site offline. Without a backup, recovering from any of these scenarios means rebuilding from scratch — which can take days or weeks and cost thousands of dollars in lost revenue.

This tutorial covers four backup methods, from beginner-friendly cPanel tools to advanced SSH scripts. We also cover how to restore from a backup when things go wrong.

The 3-2-1 Backup Rule

Before diving into the methods, understand the golden rule of backups:

A backup stored on the same server as your website is not a real backup. If the server fails, you lose both your site and your backup. Always store at least one copy in a separate location like Google Drive, Dropbox, Amazon S3, or a local hard drive.

What Should You Back Up?

A complete website backup includes two parts:

  1. Files: All website files including HTML, CSS, JavaScript, images, plugins, themes, uploads, and configuration files (like .htaccess and wp-config.php).
  2. Database: The MySQL database containing your content, pages, posts, comments, user accounts, settings, and plugin data.

You need both. Restoring files without the database gives you an empty website shell. Restoring the database without files gives you content with no design or functionality.

Method 1: Full Backup via cPanel

cPanel includes a built-in backup tool that creates a compressed archive of your entire hosting account, including all files, databases, email accounts, and settings.

Creating a Full Backup

  1. Log in to your cPanel dashboard.
  2. Go to Files → Backup Wizard (or Backup for the advanced view).
  3. Click Back Up (Step 1).
  4. Select Full Backup.
  5. Choose the backup destination:
    • Home Directory: Saves the backup to your hosting account (quickest, but uses your disk space).
    • Remote FTP Server: Sends the backup to an external FTP server.
    • Remote FTP Server (passive): Same as above but uses passive FTP mode.
    • SCP (Secure Copy): Sends the backup to a remote server via SSH.
  6. Enter your email address to receive a notification when the backup is complete.
  7. Click Generate Backup.

The backup process runs in the background. Depending on the size of your account, it can take anywhere from a few minutes to an hour. You will receive an email when it is done.

Downloading Partial Backups

If you only need to back up specific parts of your account, cPanel lets you download partial backups:

Important: Full cPanel backups cannot be restored through cPanel itself — they require your hosting provider to restore them. For self-service restoration, use partial backups (files + database separately) or one of the methods below.

Method 2: Database Backup via phpMyAdmin

For a quick database-only backup (useful before updating WordPress or running database operations):

  1. In cPanel, go to Databases → phpMyAdmin.
  2. Select your WordPress database from the left sidebar.
  3. Click the Export tab.
  4. Select Quick export method and SQL format.
  5. Click Export. Your browser will download a .sql file containing the entire database.

Restoring a Database from phpMyAdmin

  1. Open phpMyAdmin and select your database.
  2. If restoring over existing data, click Operations and select Drop all tables first. (Be very careful with this step.)
  3. Click the Import tab.
  4. Click Choose File and select your .sql backup file.
  5. Click Import. The database will be restored.

Method 3: SSH Backup Script

For developers and advanced users, SSH provides the fastest and most flexible backup method. You can create scripts that back up both files and databases, compress them, and upload them to cloud storage automatically.

Manual SSH Backup

Connect to your server via SSH and run these commands:

# Create a dated backup directory
mkdir -p ~/backups

# Back up all website files
tar -czf ~/backups/files-$(date +%Y%m%d).tar.gz -C ~/public_html .

# Back up the MySQL database
mysqldump -u dbuser -p'dbpassword' dbname > ~/backups/database-$(date +%Y%m%d).sql

# Compress the database dump
gzip ~/backups/database-$(date +%Y%m%d).sql

Replace dbuser, dbpassword, and dbname with your actual database credentials (found in wp-config.php for WordPress sites).

Automated Daily Backups with Cron

Create a backup script and schedule it to run daily using cron:

  1. Create the backup script:
#!/bin/bash
# backup.sh - Daily website backup script

BACKUP_DIR="$HOME/backups"
DATE=$(date +%Y%m%d-%H%M)
SITE_DIR="$HOME/public_html"
DB_NAME="your_database"
DB_USER="your_dbuser"
DB_PASS="your_dbpass"

# Create backup directory
mkdir -p "$BACKUP_DIR"

# Backup files
tar -czf "$BACKUP_DIR/files-$DATE.tar.gz" -C "$SITE_DIR" .

# Backup database
mysqldump -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" | gzip > "$BACKUP_DIR/db-$DATE.sql.gz"

# Delete backups older than 30 days
find "$BACKUP_DIR" -type f -mtime +30 -delete

echo "Backup completed: $DATE"
  1. Make it executable: chmod +x ~/backup.sh
  2. Add a cron job in cPanel (Cron Jobs section) or via command line:
# Run daily at 3:00 AM
0 3 * * * /home/username/backup.sh >> /home/username/backups/backup.log 2>&1

Method 4: WordPress Backup Plugins

If you are running WordPress, backup plugins offer the most user-friendly experience with cloud storage integration:

UpdraftPlus (Recommended)

  1. Install and activate UpdraftPlus from Plugins → Add New.
  2. Go to Settings → UpdraftPlus Backups.
  3. Click the Settings tab and configure:
    • Backup schedule: Daily for files, daily for database.
    • Retention: Keep the last 14 backups.
    • Remote storage: Choose Google Drive, Dropbox, Amazon S3, or another cloud provider. Authenticate with your account.
  4. Click Save Changes.
  5. Click Backup Now to create your first backup immediately.

Restoring with UpdraftPlus

  1. Go to Settings → UpdraftPlus Backups.
  2. Under "Existing Backups," find the backup you want to restore.
  3. Click Restore.
  4. Select which components to restore (plugins, themes, uploads, database, other).
  5. Click Restore and wait for the process to complete.

"The best backup is one you have tested. Create a backup, then practice restoring it on a staging site. If you have never restored a backup before, you do not actually have a backup — you have a file you hope works."

Restoring a Full cPanel Backup

If you created a full cPanel backup and need to restore it:

  1. Contact your hosting provider. Full cPanel backups must be restored by the server administrator. Open a support ticket with Serverlys and provide the backup file.
  2. If you have SSH access and the appropriate permissions, you can use the cPanel restore API, but this requires root or reseller access.

Restoring Files from a Partial Backup

  1. In cPanel, go to Backup → Restore.
  2. Under "Restore a Home Directory Backup," click Choose File.
  3. Select the compressed home directory backup file.
  4. Click Upload. cPanel will extract the files to their original locations.

Restoring a Database from a Partial Backup

  1. In cPanel, go to Backup → Restore.
  2. Under "Restore a MySQL Database Backup," click Choose File.
  3. Select the .sql or .sql.gz backup file.
  4. Click Upload. The database will be restored.

Serverlys Tip: All Serverlys hosting plans include automatic daily backups with 30-day retention. You can restore from any backup point with one click through your control panel. No manual backup scripts needed. See plans.

Backup Best Practices

Frequently Asked Questions

How often should I back up my website?

Daily is the minimum recommendation. If your site changes frequently (ecommerce stores with new orders, active blogs with daily posts), consider multiple backups per day. The goal is to minimize data loss — if your latest backup is 24 hours old, you lose up to 24 hours of changes in a disaster.

How much storage do backups need?

A typical WordPress site with a 500MB file directory and a 100MB database creates backups around 150–200MB when compressed. Keeping 30 daily backups requires roughly 5–6 GB of storage. Cloud storage for this amount costs $1–2/month.

Can I restore a backup to a different hosting provider?

Yes. If you have separate file and database backups, you can restore them on any hosting account. Upload the files via FTP, import the database via phpMyAdmin, and update wp-config.php with the new database credentials.

What is the difference between incremental and full backups?

A full backup copies everything every time. An incremental backup only copies files that have changed since the last backup. Incremental backups are faster and use less storage, but restoration requires the full backup plus all subsequent incremental backups.

Will backups slow down my website?

Backups use server resources (CPU and I/O) while they are running. Schedule backups during low-traffic hours (e.g., 3:00 AM) to minimize impact. On well-provisioned servers, the performance impact is negligible.

Related Tutorials

Automatic backups, zero effort

Serverlys cloud hosting includes automatic daily backups with 30-day retention. One-click restore, free SSL, and free domain included.