---
title: "s3fs"
sidebar_label: "s3fs"
sidebar_position: 6
description: "How to mount a bucket using s3fs and work with it as a folder on Linux and macOS"
---

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'

# s3fs

s3fs is an open-source tool for Linux and macOS. With s3fs, you can mount a bucket to a folder on your device and work with it as you would with a regular folder while it is mounted.

## Configure s3fs

1. [Install the client](#configure-s3fs).
2. [Configure S3 access](#configure-s3-access).
3. [Create a file with keys](#create-file-with-keys).
4. [Mount the bucket](#mount-bucket).

### 1. Install the client \{#configure-s3fs}

Use the [Installation](https://github.com/s3fs-fuse/s3fs-fuse#installation) instructions in the s3fs-fuse GitHub repository.

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

<GrantAccess />

### 3. Create a file with keys \{#create-file-with-keys}

1. Open the CLI.

2. In the `~/.passwd-s3fs` file, save your S3 key:

   ```bash
   echo <access_key>:<secret_key> > ~/.passwd-s3fs
   ```

   Specify:

   * `<access_key>` — the value of the **Access key** field from the [S3 key](/s3/manage/manage-access.mdx#issue-s3-key);
   * `<secret_key>` — the value of the **Secret key** field from the S3 key.

3. Restrict access to the `~/.passwd-s3fs` file:

   ```bash
   chmod 600 ~/.passwd-s3fs
   ```

### 4. Mount the bucket \{#mount-bucket}

The bucket will be mounted to a folder on your device. Upon each system reboot, the bucket will be unmounted.

You can:

* manually perform a one-time bucket mount after each system reboot;
* configure automatic mounting that will be performed automatically each time the system boots.

<Tabs queryString="mounting-type">
  <TabItem value="one-time" default>
    <TabItemLabel>
      One-time mount
    </TabItemLabel>

    1. Open the CLI.

    2. Create an empty folder:

       ```bash
       mkdir ~/<local_folder>
       ```

       Specify `<local_folder>` as the folder name.

    3. Mount the bucket:

       ```bash
       s3fs <bucket_name> <path> -o passwd_file=~/.passwd-s3fs -o allow_other -o use_path_request_style -o endpoint=<pool> -o url=https://<s3_domain>
       ```

       Specify:

       * `<bucket_name>` — the bucket name;
       * `<path>` — the path to the local folder where the bucket will be mounted;
       * `-o allow_other` — optional: a parameter that allows other users on the device to access the bucket folder. If you do not specify this parameter, only the current user will be able to work with the folder;
       * `-o use_path_request_style` — optional: a parameter that enables Path-style addressing. If you do not specify this parameter, [Virtual-Hosted addressing](/s3/buckets/addressing-types.mdx) will be used;
       * `<pool>` — the [pool](/infrastructure/locations.mdx#pool) where S3 is located;
       * `<s3_domain>` — the [S3 API domain](/s3/manage/domains.mdx#s3-api-domains). The domain depends on the [pool](/infrastructure/locations.mdx#pool) where S3 is located.
  </TabItem>

  <TabItem value="automatic">
    <TabItemLabel>
      Automatic mount
    </TabItemLabel>

    1. Open the CLI.

    2. Create an empty folder:

       ```bash
       mkdir ~/<local_folder>
       ```

       Specify `<local_folder>` — the folder name.

    3. Open the `fstab` file:

       ```bash
       nano /etc/fstab
       ```

    4. Add the following line to the ` fstab` file:

       ```bash
       s3fs#<bucket_name> <path> fuse allow_other,nonempty,passwd_file=~/.passwd-s3fs,use_path_request_style,endpoint=<pool>,url=https://<s3_domain> 0 0
       ```

       Specify:

       * `<bucket_name>` — the bucket name;
       * `<path>` — the path to the folder where the bucket will be mounted;
       * `allow_other` — optional: a parameter that allows other users on the device to access the bucket folder. If you do not specify this parameter, only the current user will be able to work with the folder;
       * `use_path_request_style` — optional: a parameter that enables Path-style addressing. If you do not specify this parameter, [Virtual-Hosted addressing](/s3/buckets/addressing-types.mdx) will be used;
       * `<pool>` — the [pool](/infrastructure/locations.mdx#pool) where S3 is located;
       * `<s3_domain>` — the [S3 API domain](/s3/manage/domains.mdx#s3-api-domains). The domain depends on the [pool](/infrastructure/locations.mdx#pool) where S3 is located.

    5. Close the file ( \*\*Ctrl+X \*\*) and save the changes ( \*\*Y \*\*).
  </TabItem>
</Tabs>

<Formbricks />
