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:
- I can configure files at
/sftp/*
to have these permissionsdrwxr-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
- I can configure files at
/sftp/*
to have permissionsdrwxrwxr-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?