---
title: "Rclone"
sidebar_label: "Rclone"
sidebar_position: 2
description: "How to install and configure Rclone, and how to work with storage via the Rclone command-line interface"
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'
import GrantAccess from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/s3/grant-access.mdx'

# Rclone

[Rclone](https://rclone.org/) is a command-line interface for working with S3 objects.

## Configure Rclone \{#configure-rclone}

1. [Configure S3 access](#configure-s3-access).
2. [Install the client](#install-client).
3. [Create an Rclone configuration](#create-configuration).

### 1. Configure S3 access \{#configure-s3-access}

<GrantAccess />

### 2. Install the client \{#install-client}

:::info

For compatibility with Selectel, Rclone version v1.69 or higher is required.

:::

<Tabs queryString="os">
  <TabItem value="windows" default>
    <TabItemLabel>
      Windows
    </TabItemLabel>

    1. On the [Rclone website](https://rclone.org/downloads/), download the distribution for Windows.
    2. Unpack the distribution archive.
    3. Open the command prompt.
    4. Navigate to the directory containing the distribution:

       ```bash
       cd <path>
       ```

       Specify `<path>` — the path to the directory with the distribution.
  </TabItem>

  <TabItem value="linux-macos">
    <TabItemLabel>
      Linux/macOS
    </TabItemLabel>

    1. Open the terminal.
    2. Install Rclone using any method — for example, using the provided script:

       ```bash
       sudo -v ; curl https://rclone.org/install.sh | sudo bash
       ```

       Read more about all installation methods on the [Rclone website](https://rclone.org/install/).
  </TabItem>
</Tabs>

### 3. Create an Rclone configuration \{#create-configuration}

1. Make sure that [Virtual-Hosted addressing is enabled](/s3/buckets/addressing-types.mdx#enable-virtual-hosted) in the bucket.

2. Open the configuration mode:

   ```bash
   rclone config
   ```

   A dialog will appear in the console:

   ```bash
   No remotes found, make a new one?
   n) New remote
   s) Set configuration password
   q) Quit config
   ```

3. Create a new configuration:

   ```bash
   n/s/q> n
   ```

4. Enter a name for the remote storage connection (for example, `selectel_s3`):

   ```bash
   name> selectel_s3
   ```

5. Enter the storage type indicated after the line `Amazon S3 Compliant Storage Providers including ..., Selectel, ...`:

   ```bash
   Storage> s3
   ```

6. Enter the provider type indicated after the line `Any other S3 compatible provider`:

   ```bash
   provider> Selectel
   ```

7. Select the method for obtaining credentials indicated after the line `Enter AWS credentials in the next step`:

   ```bash
   env_auth> false
   ```

8. Enter the `AWS Access Key ID`:

   ```bash
   access_key_id> <access_key>
   ```

   Specify `<access_key>` — the value of the **Access key** field from the [S3 key](#configure-s3-access).

9. Enter the `AWS Secret Access Key (password)`:

   ```bash
   secret_access_key> <secret_key>
   ```

   Specify `<secret_key>` — the value of the **Secret key** field from the [S3 key](#configure-s3-access).

10. Enter the [pool](/infrastructure/locations.mdx#pool) where S3 is located (e.g., `ru-1`):

    ```bash
    region> <pool>
    ```

11. Enter the URL for S3 API access:

    ```bash
    endpoint> <s3_domain>
    ```

    Specify `<s3_domain>` — the [S3 API domain](/s3/manage/domains.mdx#s3-api-domains). The domain depends on the [pool](/infrastructure/locations.mdx#pool) in which S3 is located.

12. Leave the `location_constraint` parameter empty.

13. Leave the `acl` parameter empty.

14. Leave the `Edit advanced config` parameter empty or enter `n`.

15. Verify the configuration:

    ```bash
    Remote config
    --------------------
    [selectel_s3]
    type = s3
    provider = Selectel
    env_auth = false
    access_key_id = <access_key>
    secret_access_key = <secret_key>
    region = <pool>
    endpoint = <s3_domain>
    --------------------
    y) Yes this is OK
    e) Edit this remote
    d) Delete this remote
    ```

    If the configuration is correct, press **Enter**. If not, enter `e` and edit the configuration.

16. Confirm the configuration creation:

    ```bash
    y/e/d> y
    ```

17. Exit the settings dialog:

    ```bash
    e/n/d/r/c/s/q> q
    ```

## Working with Rclone \{#working-with-rclone}

### Command format \{#command-template}

General command structure:

```bash
<command> <remote_name>:<bucket_name>/<object_name>
```

Specify:

* `<command>` — an Rclone command in the format `rclone <subcommand>`. You can view all commands on the [Rclone website](https://rclone.org/commands/) or in the output of the `rclone --help` command
* `<remote_name>` — the connection name specified when configuring Rclone;
* `<bucket_name>` — the bucket name;
* optional: `<object_name>` — the object name.

### Create a bucket \{#create-bucket}

You can create only private buckets via the S3 API.

1. Open the CLI.
2. Create a bucket:

   ```bash
   rclone mkdir <remote_name>:<bucket_name>
   ```

   Specify:

   * `<remote_name>` — the connection name specified when configuring Rclone;
   * `<bucket_name>` — the name of the new bucket. Consider the bucket naming rules; learn more in the [Bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) section of the AWS documentation.

### View the object list \{#view-object-list}

1. Open the CLI.
2. View the list of objects:

   ```bash
   rclone ls <remote_name>:<bucket_name>/<prefix>
   ```

   Specify:

   * `<remote_name>` — the connection name specified when configuring Rclone;
   * `<bucket_name>` — the bucket name;
   * optional: `<prefix>` — [prefix](/s3/objects/manage-folder.mdx) to filter the objects by.

### Upload an object \{#upload-object}

When performing copy and synchronization operations, Rclone checks all objects based on the date and time of modification or md5 sum. Objects that have been modified are transferred from the source directory to the destination directory.

1. Open the CLI.
2. Upload an object from the local directory:

   ```bash
   rclone copy <path> <remote_name>:<bucket_name>/<object_name>
   ```

   Specify:

   * `<path>` — the path to the object in the local directory;
   * `<remote_name>` — the connection name specified when configuring Rclone;
   * `<bucket_name>` — the bucket name;
   * optional: `<object_name>` — the name to be assigned to the uploaded object. If this is not specified, the filename will be used.

### Get an object link \{#obtain-link-to-object}

You can get a link to an object in a public or private bucket via a signed URL (Presigned URL). Learn more about Presigned URLs in the [Sharing objects with presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html) section of the AWS documentation.

1. Open the CLI.
2. Get a link:

   ```bash
   rclone link <remote_name>:<bucket_name>/<path_to_object> --expire <time>
   ```

   Specify:

   * `<remote_name>` — the connection name specified when configuring Rclone;
   * `<bucket_name>` — the bucket name;
   * `<path_to_object>` — the path to the object in the bucket;
   * optional: `--expire <time>` — the link expiration time, where `<time>` is the time after which the link will stop working, e.g., `24h`. If you do not add the `--expire <time>` parameter, the link will be valid for one hour.

### Delete an object \{#delete-object}

1. Open the CLI.
2. Delete the object:

   ```bash
   rclone deletefile <remote_name>:<bucket_name>/<object_name>
   ```

   Specify:

   * `<remote_name>` — the connection name specified when configuring Rclone;
   * `<bucket_name>` — the bucket name;
   * `<object_name>` — the name of the object to delete.

<Formbricks />
