TransWikia.com

Custom file/folder permissions with S3FS?

Server Fault Asked by T. Brian Jones on February 8, 2021

I have setup an SFTP server using OpenSSH. The home directory for users is /sftp/%user. I’m mounting an S3 bucket at /sftp using S3FS. The problem is that S3FS cascades user permissions down through it’s directory structure, meaning:

  1. I can configure files at /sftp/* to have these permissions drwxr-xr-x 1 root root which allow SFTP users to connect, but they cannot write to their home directories because they don’t own them.

s3fs nwd-sftp /sftp/ -o iam_role=sftp-server -o allow_other -o stat_cache_expire=10 -o enable_noobj_cache -o enable_content_md5 -o umask=022

  1. I can configure files at /sftp/* to have permissions drwxrwxr-x 1 root sftpusers so users can (in theory) write to their home directories, but the SSH protocol won’t let them login because it considers these permissions incorrect (allowing members of a group write access).

s3fs nwd-sftp /sftp/ -o iam_role=sftp-server -o allow_other -o stat_cache_expire=10 -o enable_noobj_cache -o enable_content_md5 -o umask=002 -o gid=501

I can’t figure out how to customize the ownership or permissions once a drive is mounted with S3FS. Is there a way to do this? How can I customize the users’ home folders within the S3 mounted /sftp folder?

One Answer

Syntax:

s3fs# fuse _netdev,allow_other,passwd_file=/home/ubuntu/.passwd-s3fs,use_cache=/tmp,umask=002,uid=1000 0 0

Example:

s3fs#examples /home/ubuntu/s3bucket/examples fuse _netdev,allow_other,passwd_file=/home/ubuntu/.passwd-s3fs,use_cache=/tmp,umask=002,uid=1000 0 0

Answered by Viraj Wadate on February 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP