Back up your website to your own computer with rclone

From Acenet Knowledgebase
Revision as of 13:49, 27 October 2026 by Docs admin (talk | contribs) (New guide: local backups with rclone)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

We back up your hosting account every day, but it's still a good idea to keep your own copy of your website, email and databases on a drive you control. This guide shows how to keep that copy up to date with rclone, a free program for Mac, Windows and Linux.

rclone connects to your account over SFTP (secure file transfer) and copies your files to your computer or an external drive. After the first copy, each run only downloads what has changed, so weekly backups are quick. It doesn't need any free space on the server, so it also works for large accounts that are too big for a full cPanel backup.

Each run keeps:

  • current: an exact copy of your account as it is now.
  • archive: a folder for each backup date, holding the old versions of files that changed or were deleted since the previous run. So if a file gets damaged or deleted, you can still get back an earlier version.

What you need

  • SSH access for your cPanel account. On your own cloud server or dedicated server, turn it on in WHM under Account Functions > Manage Shell Access (Jailed Shell is enough). If you have shared or reseller hosting and SSH isn't enabled for your account, please open a support ticket.
  • Your cPanel username and your server's hostname. See Find your cPanel username.
  • A computer or external drive with more free space than your account uses. cPanel shows your account's disk usage on its home page.

In the examples below, replace example with your cPanel username, server.example.com with your server's hostname, and /Volumes/Backup with the drive or folder where you want to keep your backups.

Step 1: Install rclone

  • Mac: open Terminal and run:
sudo -v ; curl https://rclone.org/install.sh | sudo bash
Or, if you use Homebrew: brew install rclone
  • Windows: download rclone from rclone.org/downloads, unzip it, and run the commands below from that folder in PowerShell, using .\rclone.exe instead of rclone.
  • Linux: run the same command as for Mac.

Check that it works:

rclone version

Step 2: Set up an SSH key

An SSH key lets rclone log in securely without your password.

1. Create a key on your computer. Press Enter to accept the default file name. You can set a passphrase or leave it empty for unattended backups.

ssh-keygen -t ed25519 -f ~/.ssh/acenet_backup

2. Show the public key and copy it:

cat ~/.ssh/acenet_backup.pub

3. In cPanel, go to Security > SSH Access > Manage SSH Keys > Import Key. Paste the public key into the public key box, give it a name, and click Import.

4. Back on Manage SSH Keys, click Manage next to the key, then Authorize.

5. Connect once with SSH to check the key works and to save the server's identity. Type yes when asked whether to trust the server:

ssh -i ~/.ssh/acenet_backup [email protected]

Type exit to close the connection.

Step 3: Prepare database backups

Your website's databases live in the database server, not in your files, so rclone can't copy them directly. A daily cron job in cPanel saves a copy of each database as a file, and rclone then downloads it with everything else.

1. In cPanel, go to Databases > Manage My Databases and create a database user for backups, for example example_backup, with a strong password. Add it to each database you want to back up, with ALL PRIVILEGES or at least SELECT, SHOW VIEW, TRIGGER, LOCK TABLES and EVENT.

2. In File Manager, turn on Show Hidden Files (Settings, top right), create a folder named backups in your home directory, and a file named .my-backup.cnf in your home directory containing:

[client]
user=example_backup
password="the password you chose"

Right-click the file, choose Change Permissions, and set it to 600, so only your account can read it.

3. In cPanel, go to Advanced > Cron Jobs and add a job that runs Once Per Day with this command. Use your database's name instead of example_wp, and add one line like it for each database:

mysqldump --defaults-extra-file=$HOME/.my-backup.cnf --single-transaction --no-tablespaces example_wp | gzip > $HOME/backups/example_wp.sql.gz

The next day, check that backups/example_wp.sql.gz appears in File Manager.

Step 4: Connect rclone to your account

Run this once on your computer:

rclone config create acenet sftp host=server.example.com user=example key_file=~/.ssh/acenet_backup known_hosts_file=~/.ssh/known_hosts

Check that it can see your account. You should see folders such as public_html, mail and backups:

rclone lsd acenet:

Step 5: Run a backup

1. Create a file named rclone-exclude.txt in your home folder on your computer, listing temporary files that don't need backing up:

/.cache/**
/tmp/**
/logs/**
/.trash/**

2. Run the backup:

rclone sync acenet: /Volumes/Backup/example/current --backup-dir /Volumes/Backup/example/archive/$(date +%F) --exclude-from ~/rclone-exclude.txt --progress

The first run downloads everything, so it can take several hours for a large account. Later runs only download what has changed.

On Windows, use a date you type in, for example:

.\rclone.exe sync acenet: D:\Backups\example\current --backup-dir D:\Backups\example\archive\2026-11-03 --exclude-from rclone-exclude.txt --progress

3. Optionally, check that the copy matches the server:

rclone check acenet: /Volumes/Backup/example/current --exclude-from ~/rclone-exclude.txt --one-way
Always use the same destination folder for current. rclone sync makes it an exact copy of your account, so a file deleted on the server is also removed from current on the next run. That's why the --backup-dir option matters: it moves those files into the dated archive folder instead of discarding them.

Keep it up to date

Run the command in step 5 once a week, or as often as you like. Keep the external drive disconnected or switched off between backups, so it's safe if your computer gets malware.

When the drive starts to fill up, delete the oldest dated folders in archive. Never delete current.

Restore from your backup

  • Files: upload them back to your account with File Manager, FTP or rclone, for example rclone copy /Volumes/Backup/example/current/public_html acenet:public_html.
  • Databases: unzip the .sql.gz file and import it into the database with phpMyAdmin in cPanel.
  • Email: your email is in the mail folder. Copy a mailbox's folder back into the same place to restore its messages.

For most restores, it's quicker to use our daily backups first. See Restore files, databases and email with JetBackup. If you need help restoring from your own copy, please open a support ticket.