Skip to main content
To back up a Linux server to S3 or Google Drive with rclone, install rclone, run rclone config to add your storage as a remote, optionally wrap it in an encrypted crypt remote, then copy your folders with rclone sync /var/www secret:www --backup-dir secret:old/2026-11-04. Test with --dry-run first and schedule it with cron.

Before you start

  • Connect with SSH. Commands use sudo; root users can leave it out.
  • Have your storage details ready: for S3-compatible storage an access key, secret key, endpoint and bucket; for Google Drive a Google account and a computer with a web browser.
  • A remote is rclone’s name for one storage location, for example s3backup: or gdrive:.

How to install rclone

The rclone project notes that distribution packages are often out of date, and recommends its install script:
You can also use your package manager (sudo apt install rclone on Ubuntu / Debian). Ubuntu 24.04 ships rclone 1.60, which is older but works for the commands on this page.

How to add a cloud storage remote

Run the backup as root, so configure rclone as root too. The configuration is saved in /root/.config/rclone/rclone.conf.
Choose n (new remote), enter a name, then pick the storage type.
Choose Amazon S3 Compliant Storage Providers, then your provider (or Other). Enter the access key, secret key and endpoint. The finished section in rclone.conf looks like this:
Test it by listing your buckets:

How to encrypt backups with an rclone crypt remote

A crypt remote encrypts file contents and file names before they leave your server. It sits on top of a normal remote.
1

Create the crypt remote

Run sudo rclone config, choose n, name it secret, and pick Encrypt/Decrypt a remote. For the remote to encrypt, enter a folder on your storage, for example s3backup:my-bucket/server1.
2

Choose passwords

Let rclone generate a password or enter your own, plus the optional second password (salt). Store both outside the server, for example in a password manager.
3

Always use the crypt remote

Upload and download through secret:. Files written straight to s3backup:my-bucket/server1 are not encrypted.
If you lose the crypt passwords and the rclone.conf file, nobody can decrypt your backups, including us. Keep a copy of the passwords somewhere other than the server you are backing up.

Should I use rclone copy or rclone sync?

For backups, use sync with --backup-dir, so deleted and changed files are kept for a while.

How to run an rclone backup

1

Dry run

rclone lists what it would copy and delete, without changing anything.
2

Run the backup

3

Check the result

Success ends with 0 differences found.
rclone sync deletes files on the destination that are not in the source. If you get the source and destination the wrong way round, it deletes your live files. Run --dry-run (or -i to confirm each change) whenever you change the command. --backup-dir must be on the same remote as the destination and must not overlap the destination folder.
Back up databases by dumping them to a file first, then include that file. See back up MySQL databases.

How to run rclone backups on a schedule

Put the sync commands in /usr/local/bin/rclone-backup.sh, then sudo chmod 700 /usr/local/bin/rclone-backup.sh and add it to root’s crontab with sudo crontab -e:
Add --bwlimit 20M if the upload slows your server; it limits rclone to 20 MiB/s (bytes, not bits). See schedule tasks with cron.

How to restore files with rclone

Copy from the remote to a temporary folder, check the files, then move them into place:
Older versions of changed or deleted files are under secret:old/<date>/.

Frequently asked questions

Does rclone keep old versions of files?

Not by itself. rclone sync keeps only the latest copy unless you add --backup-dir. For proper snapshots with deduplication, use restic, which can also store its repository through rclone.

Where is the rclone config file?

Run rclone config file. On Linux it is normally ~/.config/rclone/rclone.conf, so /root/.config/rclone/rclone.conf for root. It contains your storage keys: keep it readable only by root.

Can I use Google Drive on a server without a browser?

Yes. Answer n to the browser question in rclone config, run rclone authorize "drive" on a computer with a browser, and paste the token back on the server.

Why does rclone sync need permission to create buckets?

On S3, rclone checks or creates the bucket. If your key cannot create buckets, create the bucket yourself and add --s3-no-check-bucket.

VPS and dedicated server guides

Every guide in this section.

Back up a Linux server

What to back up and which tool to use.

Encrypted backups with restic

Versioned, deduplicated backups.

Back up with rsync

Copy to another server over SSH.

Schedule tasks with cron

Run backups automatically.

Checked against the official rclone documentation on 4 November 2026; rclone config create, copy, sync --dry-run, --backup-dir, check and a crypt remote tested on Ubuntu 24.04 LTS (rclone 1.60.1) against local storage. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026