# Use S4 with Rclone

> Learn how to set up Rclone to sync your files with S4 object storage.

## Goal

Rclone is a backup tool that syncs with a wide range of storage backends and runs on Windows, macOS, and Linux.

**This guide shows you how to set up Rclone to sync your files with S4 object storage.**

> **Tip**
>
> Make sure you've [signed up for a Bitiful account](https://console.bitiful.com/) and completed [real-name verification](https://console.bitiful.com/users).

## Prerequisites

- You've [created](/en/bitiful-s4/handbook/quick-start) an S4 bucket.
- You've created a sub-account and an access_key for it.
- You've granted the `sub-account` full permissions on the `relevant bucket`.

## Instructions

To configure Rclone, edit or create the `~/.config/rclone/rclone.conf` file and add the following:

```bash
[s4-demo] 
type = s3 
provider = Other 
env_auth = false 
access_key_id = <access_key> 
secret_access_key = <secret_key> 
end = https://s3.bitiful.net
```

Rclone is now ready to use.

**Example commands**

List all buckets:

```bash
$ rclone lsd s4-demo: 
```

Create a new bucket:

```bash
$ rclone mkdir s4-demo:mybucket 
```

List the contents of a bucket:

```bash
$ rclone ls s4-demo:mybucket 
```

Sync `/home/user/documents` to a bucket:

```bash
$ rclone sync /home/user/documents s4-demo:我的桶
```

Copy the file `/home/user/bitifl-logo.png` to a bucket:

```bash
$ rclone copy /home/user/bitifl-logo.png s4-demo:mybucket
```

Download the file `bitifl-logo.png` from a bucket:

```bash
$ rclone copy s4-demo:mybucket/bitifl-logo.png bitifl-logo.png 
```

Mount a bucket as a `local directory`:

```bash
$ rclone mount s4-demo:/ /LOCAL_DIR --no-modtime --no-checksum --no-seek \
    --daemon \
    --allow-other \
    --vfs-cache-mode full \
    --dir-cache-time 1m \
    --buffer-size 128M \
    --transfers 200 \
    --checkers 200 \
    --tpslimit 200 \
    --vfs-read-chunk-size 10M \
    --vfs-read-chunk-size-limit 256M \
    --vfs-cache-max-age 24h \
    --vfs-cache-max-size 1G \
    --log-level INFO \
    --log-file ./rclone.log \
    --umask 002 \
    --attr-timeout 1s \
    --volname "s4mount"
```

#### Further reading

1. [Official Rclone documentation](https://rclone.org/docs/)
2. [Ugediao: Mount Bitiful on a Debian server with rclone](https://ugediao.com/debian-rclone-bitiful.html) (in Chinese)
