Search code examples
amazon-ec2ubuntu-14.04ftp-servers3fsvsftpd

Restricting user access on SFTP server backed by S3


I am trying to create a SFTP server which will be backed by S3. I have already succeeded in installing vsftpd and s3fs, linked them and things are working just fine.

Requirements :

  1. A FTP server will have more than one users, and each other will have different s3 buckets linked to their ftp folder. [done]

    Approach : Created two different users (say user1 & user2), and mounted buckets to their home directory.

  2. One user should not be able to view folders and files of other users.

    Approach : Since I created two different users, I thought the access will be restricted. But looks like when I mount a bucket using s3fs it changes access of the folder to 777.

Now the issue is, I can't restrict my users to access files of other users. My /etc/vsftpd.conf looks like this :-

ftpd_banner=Welcome to Dave's FTP service.

# Now restrict users to their home directories:
chroot_local_user=YES
allow_writeable_chroot=YES

I have seen and tried issues like this, this and this. These didn't help, so please think again before marking it as duplicate


Solution

  • You need to create mount directory inside the user directory like /home/user1/mountToS3 and then restrict that directory using chmod and chown. This should do. Let me know if you find any issue. :)