How to Configure Rclone with Hetzner Object Storage for Automated Backups and Restores
Object storage is an excellent choice for storing backups because it is inexpensive,
scalable, and highly durable. This guide explains how to configure Rclone
to connect to Hetzner Object Storage so you can manually upload/download
backups or automate the process using scripts and cron jobs.
This guide is intended for Developers and DevOps engineers who want a
reliable backup and restore workflow.
Prerequisites
- A Linux server or workstation
- A Hetzner Object Storage bucket
- An Access Key and Secret Key
- Sudo access
- Internet connectivity
Step 1: Install Rclone
Install the latest version of Rclone.
curl https://rclone.org/install.sh | sudo bash
Verify the installation.
rclone version
Step 2: Generate the Configuration Directory
Run Rclone once to generate the configuration directory.
rclone
The default configuration file is located at:
~/.config/rclone/rclone.conf
You can exit Rclone after the directory has been created.
Step 3: Configure Hetzner Object Storage
Edit the configuration file.
nano ~/.config/rclone/rclone.conf
Add the following configuration:
[hetzner]
type = s3
provider = Other
access_key_id = <ACCESS_KEY>
secret_access_key = <SECRET_KEY>
endpoint = https://hel1.your-objectstorage.com
# Use fsn1, nbg1, or hel1 depending on your bucket region.
region = hel1
Configuration Parameters
| Parameter | Description |
|---|---|
| hetzner | Name of the Rclone remote. You may choose any name. |
| access_key_id | Hetzner Object Storage Access Key. |
| secret_access_key | Hetzner Object Storage Secret Key. |
| endpoint | Object Storage endpoint for your bucket. |
| region | Bucket region (hel1, fsn1 or nbg1). |
Note: The endpoint and region must match the region where your bucket was created.
Step 4: Verify the Configuration
List all configured remotes.
rclone listremotes
Expected output:
hetzner:
List all buckets.
rclone lsd hetzner:
Step 5: Upload Files to Object Storage
Upload a file or directory.
rclone copy <SOURCE> hetzner:<BUCKET_NAME>/PATH/ \
--transfers 24 \
--progress
Example
rclone copy /backups/database.sql.gz \
hetzner:production-backups/database/ \
--transfers 24 \
--progress
Command Options
| Option | Description |
|---|---|
| copy | Copies files without deleting anything from the destination. |
| –transfers 24 | Runs up to 24 parallel file transfers. |
| –progress | Displays upload progress. |
Step 6: Download Files from Object Storage
Download files from your bucket.
rclone copy \
hetzner:<BUCKET_NAME>/PATH/ \
<DESTINATION> \
--transfers 24 \
--progress
Example
rclone copy \
hetzner:production-backups/database/ \
/restore/database \
--transfers 24 \
--progress
Useful Commands
List Buckets
rclone lsd hetzner:
List Files
rclone ls hetzner:<BUCKET_NAME>
Display Folder Structure
rclone lsf -R hetzner:<BUCKET_NAME>
Check Bucket Size
rclone size hetzner:<BUCKET_NAME>
Delete a File
rclone deletefile hetzner:<BUCKET_NAME>/PATH/file.tar.gz
Delete a Folder
rclone purge hetzner:<BUCKET_NAME>/PATH/
Warning: The purge command permanently deletes all contents under the specified directory.
Backup Best Practices
Organize backups by date.
production-backups/
├── database/
│ ├── 2026-07-27.sql.gz
│ ├── 2026-07-28.sql.gz
│
├── volumes/
│ ├── 2026-07-27.tar.gz
│
└── logs/
Automating Backups
Create a simple backup script.
#!/bin/bash
BACKUP_FILE="/backup/database-$(date +%F).sql.gz"
rclone copy \
"$BACKUP_FILE" \
hetzner:production-backups/database/ \
--transfers 24 \
--progress
Make it executable.
chmod +x backup.sh
Run manually.
./backup.sh
Or schedule it using Cron.
0 2 * * * /opt/scripts/backup.sh
Restore Workflow
Download the required backup.
rclone copy \
hetzner:production-backups/database/2026-07-27.sql.gz \
/restore \
--progress
Verify the download.
ls -lh /restore
Troubleshooting
Authentication Failed
- Verify the Access Key
- Verify the Secret Key
- Check the endpoint
- Confirm the region
Bucket Not Found
- Verify the bucket name.
- Ensure the bucket exists.
- Check the configured endpoint.
Slow Uploads
Adjust the number of parallel transfers.
--transfers 8
or
--transfers 32
Show Configuration Location
rclone config file
Security Recommendations
- Never commit
rclone.confinto Git. - Restrict file permissions.
chmod 600 ~/.config/rclone/rclone.conf
- Rotate Access Keys periodically.
- Use dedicated credentials for backup automation.
- Store secrets securely using a secrets manager whenever possible.
Conclusion
Rclone makes it simple to interact with Hetzner Object Storage for backup and restore
operations. Once configured, these commands can easily be integrated into shell scripts,
Cron jobs, CI/CD pipelines, or Kubernetes CronJobs, providing a reliable and scalable
backup strategy.