1

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?

  • "The problem is that S3FS cascades user permissions down through it's directory structure." I really don't understand this comment. sudo chown -v -R sqlbot /sftp/sqlbot should make me the owner of the files and directories under my FTP home directory on s3fs the same as any other filesystem (or thing that acts like a filesystem). Does this not work for you? If not, what version of s3fs is this? – Michael - sqlbot May 23 '16 at 11:24
  • @Michael-sqlbot - I'm using Version 1.79. I'm unable to change permissions normally. sudo chown -v ec2-user:ec2-user /sftp/folder/ results in chown: changing ownership of ‘/sftp/folder/’: Operation not permitted – T. Brian Jones May 23 '16 at 16:08
  • It needs to be mounted without -o gid or -o uid. – Michael - sqlbot May 23 '16 at 21:43
  • @Michael-sqlbot - I've tried mounting with many combinations, including -o allow_other and user_allow_other in the /etc/fuse.conf file and excluding -o guid ### and excluding -o uid ###. No matter what I do, I cannot chmod or chown folders and get this message chown: changing ownership of ‘folder/’: Operation not permitted. I am able to chmod and chown files, however, but that doesn't solve my problem of allowing users to upload to their home folders. The same problem exists if the folder was pre-existing in S3 and if I create a new folder with mkdir after mounting. – T. Brian Jones May 24 '16 at 2:29
  • Well, that's weird. Unless something is broken, that should work. It does work on my systems, but I don't know whether I have 1.79 running. I'll take a look. – Michael - sqlbot May 24 '16 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.