Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

Install rclone

# Debian and Ubuntu
sudo apt install rclone
# AlmaLinux and Rocky Linux (EPEL)
sudo dnf install epel-release
sudo dnf install rclone

Distribution packages can be older than the current release. Check with rclone version.

Step 1: Configure a Remote

rclone config

The tool asks questions: choose n for a new remote, give it a name such as remote, choose the storage type (S3 for S3-compatible storage), then enter the access key, secret key, and endpoint your storage service gives you. Run it as the user that will run the scheduled job; for the root cron job below, that is sudo rclone config. The result is saved in a configuration file:

[remote]
type = s3
provider = Other
access_key_id = ACCESS_KEY
secret_access_key = SECRET_KEY
endpoint = https://S3_ENDPOINT

The file is not encrypted: password fields are only obscured, and S3 keys are stored as plain text. Find it with rclone config file and make sure only its owner can read it:

sudo chmod 600 /root/.config/rclone/rclone.conf

That is the default path for root. To encrypt the whole file, set a configuration password with option s in rclone config; a scheduled job then needs that password, for example through --password-command.

Step 2: Look Around

CommandWhat it shows
rclone lsd remote:Buckets
rclone lsd remote:bucketFolders in a bucket
rclone ls remote:bucket/pathFiles with sizes
rclone size remote:bucket/pathTotal size

copy vs sync

CommandOn the destination
rclone copyAdds and updates files, never deletes
rclone syncMakes it identical, deleting extra files
rclone moveLike copy, then deletes the source files
rclone copy /var/backups remote:bucket/web1 --progress

For backups, copy is the safer default.

Use sync Safely

Warning first: sync deletes files on the destination that are not in the source. A wrong path can empty a bucket folder. Always preview:

rclone sync /var/www remote:bucket/web1/www --dry-run
rclone sync /var/www remote:bucket/web1/www \
  --backup-dir remote:bucket/web1/deleted/2026-11-28

--backup-dir moves deleted and replaced files to a dated folder instead of removing them. It must be on the same remote, which must support server-side move or copy, and it must not overlap the synced folder.

Progress and Bandwidth Limits

rclone copy /var/backups remote:bucket/web1 --progress --bwlimit 10M
rclone copy /var/backups remote:bucket/web1 --bwlimit "08:00,5M 23:00,off"

The limit is in bytes per second, not bits: 10M is 10 MiB per second, and a number without a suffix is read as KiB per second. The second form slows uploads during the day and lifts the limit at night.

Encrypt with crypt

A crypt remote wraps another remote and encrypts file contents and names before upload, so the storage service sees only scrambled data. Create it with rclone config (type crypt, pointing at a path such as remote:bucket/encrypted), keep a copy of its passwords off the server, and use it like any other remote.

Schedule with cron

In root's crontab (sudo crontab -e), with no keys in the line: rclone reads them from its config file.

30 3 * * * /usr/bin/flock -n /tmp/rclone.lock /usr/bin/rclone copy /var/backups remote:bucket/web1 --log-file /var/log/rclone.log --log-level INFO

flock stops a second run from starting while the first is still uploading. More in how to create a cron job.

Test a Restore

rclone check /var/backups remote:bucket/web1
rclone copy remote:bucket/web1/mysql /tmp/restore-test/ --progress
gunzip -t /tmp/restore-test/*.sql.gz

rclone check compares both sides; the download proves you can get files back. rclone keeps one copy, not versions: for dated versions, use restic in a separate folder of the bucket. Keep this bucket at a different provider from the server, with keys used for nothing else, so it can serve as the off-site copy in the 3-2-1 backup rule.

Was this answer helpful?
Loading...