Skip to content

Rclone for offsite backup to S3, Backblaze B2, or Wasabi

Use rclone to ship encrypted backups to S3-compatible storage with sync, bandwidth limits, retries, and object-lock for ransomware resistance.

You already have a local backup (rsync, restic, ZFS snapshot, whatever) and you need to ship it offsite to satisfy the 3-2-1 rule. Rclone is the canonical tool for that hop — it speaks every object-storage API you care about, supports client-side encryption via the crypt remote, handles bandwidth limiting and retries, and respects S3 object-lock for ransomware resistance. This article is the operator’s playbook for setting up an offsite tier with rclone.

How to verify

For a host that already runs rclone, the configuration plus a recent sync log tell you the shape of it:

rclone version
rclone listremotes
rclone config show
rclone size remote-name:bucket-name
systemctl list-timers '*rclone*'
journalctl -u rclone-offsite.service --since=yesterday | tail

rclone size walks the bucket and reports object count and bytes — useful for sanity-checking that the offsite copy is the size you expect.

What’s happening

Rclone is a Go binary that wraps every major object-storage backend behind a unified CLI. A “remote” is a named configuration: bucket name, credentials, endpoint, region. A crypt remote wraps another remote and adds client-side encryption — filenames and contents are encrypted before they hit the backend; the cleartext never leaves the host. rclone sync is the workhorse: copy from source to destination, delete anything in destination that no longer exists in source.

The patterns that matter for offsite backup: use crypt if the backend is anything other than your own S3 with KMS; use --immutable or backend-native object-lock for compliance-grade ransomware resistance; use --bwlimit to cap upload during business hours; and use --checksum periodically to detect bitrot.

The procedure

  1. Install rclone from upstream. Apt is fine for most hosts but the Debian package lags by months.

    curl -fsSL https://rclone.org/install.sh | sudo bash
    rclone version
  2. Create the backend remote. For S3, the config holds the access key, secret, region, and endpoint.

    sudo install -m 0700 -d /root/.config/rclone
    sudo install -m 0600 /dev/null /root/.config/rclone/rclone.conf
    # /root/.config/rclone/rclone.conf
    [acme-s3]
    type = s3
    provider = AWS
    region = us-east-1
    access_key_id = AKIA...
    secret_access_key = ...
    storage_class = STANDARD_IA
  3. Wrap with a crypt remote. The crypt remote needs its own password and salt; generate both and store them in your secret backend.

    rclone config password
    [acme-offsite]
    type = crypt
    remote = acme-s3:acme-backups/host-01
    password = OBSCURED...
    password2 = OBSCURED...

    From here, write to acme-offsite: — paths and bytes are encrypted on the fly.

  4. Set bucket-level immutability. On the backend bucket, configure S3 Object Lock with a GOVERNANCE or COMPLIANCE retention. This is the ransomware tier: even with full credentials, an attacker cannot delete or overwrite objects within the retention window.

    aws s3api put-object-lock-configuration --bucket acme-backups \
      --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"COMPLIANCE","Days":30}}}'
  5. Write the sync service+timer. Sync runs from a source directory that already holds a consistent backup (restic repo, ZFS snapshot mount, etc.).

    # /etc/systemd/system/rclone-offsite.service
    [Unit]
    Description=Rclone offsite sync
    Wants=network-online.target
    After=network-online.target
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/rclone sync /var/backups \
      acme-offsite:/ \
      --transfers 4 --checkers 8 \
      --bwlimit "08:00,2M 18:00,off" \
      --retries 3 --retries-sleep 30s \
      --log-level INFO --stats 1m --stats-one-line
    Nice=10
    IOSchedulingClass=best-effort
    # /etc/systemd/system/rclone-offsite.timer
    [Unit]
    Description=Run rclone offsite sync nightly
    [Timer]
    OnCalendar=*-*-* 03:30:00
    RandomizedDelaySec=900
    Persistent=true
    [Install]
    WantedBy=timers.target
  6. Verify with rclone check. check compares source and destination hashes; cryptcheck is the equivalent that decrypts the destination on the fly for hash comparison.

    rclone cryptcheck /var/backups acme-offsite:/ --one-way
  7. Restore drill. Once a quarter, restore a sample to a scratch path and confirm the data is readable. Without this, the offsite copy is unverified.

    rclone copy acme-offsite:/restic-repo /tmp/offsite-test --max-depth 2

Common pitfalls

  • A crypt remote without password2 (salt) has the same key derivation across hosts using the same password — set a unique password2.
  • --immutable is a client-side flag and does nothing if the bucket allows overwrites; backend object-lock is the real protection.
  • rclone sync with --delete-during removes destination objects that are gone from source — fine for syncing live data, dangerous for snapshot archives. Use rclone copy for append-only flows.
  • Object-lock retention cannot be reduced after the fact in COMPLIANCE mode — start short, extend after operational confidence.
  • An OIDC-issued credential or instance role is preferable to a long-lived access key in rclone.conf; the AWS SDK fallbacks work for the S3 backend.

In the engagements we run, rclone is the offsite shipper layered on top of restic or borg — encrypted both ends, immutable bucket, alarm on a missing sync run, and quarterly restore drills tied to /en/knowledge-base/disaster-recovery-drill/. See /en/services/managed-operations/.