I am setting up a file server in Ubuntu Server 16.04.

I've got 3 users (and 6 hard drives, 2 each in a RAID 1 config). These Raided drives are mounted to /mnt/username, which have been set as the user's home directory. I have set up SFTP with SSH keys and login is a breeze. However, I do not want userA to leave /mnt/userA and gain access to /mnt and see the other user's folders.

To remedy this I set up chroot in sshd_config for each user, to their directories. This however prevents the user from writing to their folder (which is useless as far as a file server is concerned).

How do I jail a SFTP user to their home directory, while still allowing their home directory to be writeable by them?

  • Create a directory under /mnt/userA, which will be writeable by the user. – Jakuje Aug 2 '16 at 9:51
  • @Jakuje but then they can just go up a level into /mnt/UserA which isn't ideal either. This sort of thing can't be that difficult. – sharf Aug 2 '16 at 13:19
  • why it is not ideal? – Jakuje Aug 2 '16 at 13:20
  • @Jakuje Because they are then not confined to their home directory, they can go up a level and don't start at their root. It's not as clean. And being migrated from a Windows server where that was easy to set up - I imagine it can't be that hard to set it up securely on Linux. – sharf Aug 2 '16 at 15:49
  • 1
    @Jakuje I want a set up that will be identical to my users, where they log in to their "/" and can't go up any further. However, the user will still need to be able to make directories and files (upload). It can't be impossible, but may require me installing a different program – sharf Aug 2 '16 at 19:29

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.