s3fs

Prerequisites

Install s3fs

See https://github.com/s3fs-fuse/s3fs-fuse for installation instructions for your OS.

Configure s3fs to use Storj S3 Gateway

You can use either Self-hosted S3 Compatible Gateway or Storj-hosted S3 Compatible Gateway. You only need S3 compatible credentials and endpoint.

Create the credentials file

Please substitute your own Access Key ID instead of ACCESS_KEY_ID and your own Secret Access Key instead of SECRET_ACCESS_KEY in the example below:

echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs
chmod 600 ${HOME}/.passwd-s3fs
echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs
chmod 600 ${HOME}/.passwd-s3fs

Create a bucket

First you will want to create a bucket.

Mount a bucket to the folder

Create a folder:

sudo mkdir /mnt/my-bucket
sudo chown myuser /mnt/my-bucket
sudo mkdir /mnt/my-bucket
sudo chown myuser /mnt/my-bucket

Mount a bucket to the folder. We will assume that you created a bucket my-bucket earlier. We will use the endpoint https://gateway.storjshare.io here, as this will Storj-hosted S3 Compatible Gatewayautomatically.

If you use the Self-hosted S3 Compatible Gateway, then the endpoint could be http://localhost:7777 (depends on your configuration and infrastructure).

s3fs my-bucket /mnt/my-bucket -o passwd_file=${HOME}/.passwd-s3fs -o url=https://gateway.storjshare.io -o use_path_request_style
s3fs my-bucket /mnt/my-bucket -o passwd_file=${HOME}/.passwd-s3fs -o url=https://gateway.storjshare.io -o use_path_request_style

Mount a bucket to the folder on boot

You should make sure that the credentials file is available for the root on boot time. You can create it in the /etc/ folder:

sudo echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > /etc/passwd-s3fs
sudo chmod 600 /etc/passwd-s3fs
sudo echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > /etc/passwd-s3fs
sudo chmod 600 /etc/passwd-s3fs

Then add the following to /etc/fstab:

my-bucket /mnt/my-bucket fuse.s3fs _netdev,allow_other,use_path_request_style,url=https://gateway.storjshare.io 0 0
my-bucket /mnt/my-bucket fuse.s3fs _netdev,allow_other,use_path_request_style,url=https://gateway.storjshare.io 0 0

Check that it is working - The command:

sudo mount -a
sudo mount -a

should not return any error. Next, check that your Storj bucket is mounted:

df -HT
df -HT

Now you can use the mounted bucket almost as any folder.

See also

We recommend having a look at Rclone and its rclone mount command as well.

Please note - you can configure a native connector in rclone, (see: Rclone Native Integration) and use Design Decision - End-to-end Encryption, unlike Storj-hosted S3 Compatible Gateway which usesDesign Decision - Server-side Encryption to provide a S3-compatible protocol (the S3 protocol does not use client side encryption by design).

Previous
S3 Browser