# Backing up to S3 with rclone: config, sync, nightly

https://www.trecloud.com.tr/en/knowledgebase/article/rclone-ile-s3-yedekleme

An architecture office's file server keeps growing with project folders, and a copy needs to leave the building every night. rclone is an open-source, single-binary tool that syncs folders to S3-compatible storage. In this article we set up rclone s3 for your TreCloud S3 bucket, take the first copy and schedule a nightly backup. The examples are for Ubuntu 24.04.

![Backing up to S3 with rclone: nightly sync from a server to a TreCloud S3 bucket](https://www.trecloud.com.tr/resources/uploads/articles/2026-11-24/rclone-ile-s3-yedekleme.jpg)

**Contents**

1. [Installing rclone and the config file](#kurulum)
2. [Basic commands](#komutlar)
3. [sync carries deletions too](#sync-uyarisi)
4. [Automatic nightly sync](#cron)
5. [Optional: rclone crypt](#crypt)
6. [Frequently asked questions](#sss)

## Installing rclone and the config file

The rclone version in the Ubuntu repository can lag behind. You can install the current release with rclone's official install script:

```
sudo apt install -y curl unzip
curl https://rclone.org/install.sh | sudo bash
rclone version
```

Get the connection details from the client area under **Hizmetlerim** (My Services) › service › **Yönetim** (Manage) › **Nesne depolama** (Object storage); each row is explained in [S3 access details and keys](https://www.trecloud.com.tr/bilgi-bankasi/makale/s3-erisim-bilgileri-ve-anahtarlar). The `rclone config` command asks questions step by step, but writing the config file directly is faster. Add this section to `~/.config/rclone/rclone.conf`:

```
[trecloud]
type = s3
provider = Minio
access_key_id = ACCESS_KEY
secret_access_key = SECRET_KEY
endpoint = https://s3.trecloud.com.tr
region =
no_check_bucket = true
```

You can leave `region` empty or enter the **Bölge** (Region) value from the panel. TreCloud S3 uses path-style addressing; in rclone `force_path_style` is already on by default, so you do not need to add it. The `no_check_bucket = true` line stops rclone from trying to create the bucket again; your service has one bucket and it already exists. The secret key is stored in plain text in this file, so tighten its permissions:

```
chmod 600 ~/.config/rclone/rclone.conf
```

## Basic commands

Below, replace `kova-adi` with the bucket name from the panel. First test the connection; this command lists the folders in the bucket:

```
rclone lsd trecloud:kova-adi
```

`copy` sends new and changed files and never deletes anything on the target. `check` compares both sides and reports missing or different files:

```
rclone copy /srv/projeler trecloud:kova-adi/projeler --progress
rclone check /srv/projeler trecloud:kova-adi/projeler
```

`sync` makes the target an exact copy of the source. Run every new command with `--dry-run` first; rclone prints what it would copy and delete but does nothing:

```
rclone sync /srv/projeler trecloud:kova-adi/projeler --dry-run
rclone sync /srv/projeler trecloud:kova-adi/projeler --progress
```

To restore, just reverse the direction: `rclone copy trecloud:kova-adi/projeler /srv/geri-yukleme`. If the restoring machine uses the read key, it cannot write to or delete from the bucket.

## sync carries deletions too

sync deletes files from the target that are missing from the source. If an employee deletes a folder by mistake, or ransomware corrupts files, the damage reaches the bucket the next night. Versioning is not listed on the TreCloud S3 product card, so a deleted file does not come back from the bucket. There are two practical remedies. The first is to use copy instead of sync. The second is to add `--backup-dir` to sync: deleted or changed files are moved to a dated folder instead of being removed. These folders use your quota; clean out old ones by hand from time to time.

## Automatic nightly sync

Putting the command in a script keeps the cron line simple and stops the `%` character in the date expression from causing trouble in cron. Create `/usr/local/bin/s3-yedek.sh`:

```
#!/bin/bash
set -euo pipefail
TARIH=$(date +%F)
rclone sync /srv/projeler trecloud:kova-adi/projeler \
  --backup-dir trecloud:kova-adi/eski/$TARIH \
  --log-file /var/log/s3-yedek.log --log-level INFO
```

Make the script executable and add a line with `sudo crontab -e` to run it every night at 02:30. Because root runs this cron job, put the config file at root's `/root/.config/rclone/rclone.conf` or pass the path with `--config` in the script:

```
sudo chmod +x /usr/local/bin/s3-yedek.sh
sudo crontab -e
```

```
30 2 * * * /usr/local/bin/s3-yedek.sh
```

Check the log file for the first few days. You get an e-mail at 80% of the quota; when the limit is full, writing stops and rclone reports errors, while reading continues.

## Optional: rclone crypt

If you want to encrypt files with your own key before sending them, use rclone crypt. Define a new remote with `rclone config`, choose `crypt` as the type, set `remote` to `trecloud:kova-adi/sifreli` and enter the password as rclone prompts. Then use the new remote's name in your commands. If you lose the password, the files cannot be opened; keep it somewhere separate from the config file.

## Frequently asked questions

Why do we set provider to Minio?TreCloud S3 runs on MinIO. With this value rclone picks settings that suit the server. Why does rclone lsd trecloud: return an error?Your key is scoped to your own bucket and may not be allowed to list all buckets. Run the command with the bucket name. Can I use it on a Windows server?Yes. rclone is also distributed for Windows; the settings are the same and you schedule it with Task Scheduler.

## Related pages

- [S3 object storage packages](https://www.trecloud.com.tr/nesne-depolama)
- [Using S3 with the AWS CLI](https://www.trecloud.com.tr/bilgi-bankasi/makale/aws-cli-ile-s3-kullanimi)
- [What is S3 object storage?](https://www.trecloud.com.tr/s3-nesne-depolama-nedir)
- [The 3-2-1 backup rule](https://www.trecloud.com.tr/3-2-1-kurali-ucuncu-kopya-ayni-kabindeyse)
- [rclone S3 documentation](https://rclone.org/s3/)

Written by TreCloud Team · TRE Teknoloji · October 11, 2026
