I need a setup where I can put the contents of several user folders to a DMZ server from where external clients can download it, protocol SFTP, Linux, OpenSSH. To ease administration we want to use one single user for the upload.
What does work is to define
ChrootDirectory /home/sftp/ in sshd_config, set the according ownership and modes and define a home dir in
passwd so that the working directory of the user fits. This is my structure:
The uploader user can write
file2.txt to the corresponding folders and by having the user folders (user1, user2) set to the users' primary group + setting SETGUID on the folders the users are able to even delete the files (which is necessary).
Only problem: because
/home/sftp/ is the chroot base dir the users can change updir and see other users' folders, though not being able to change into because of access rights.
Requirement: We want to prevent users to change to /home/sftp/uploader/ and see other users' folders. My requirements are to use SFTP, have one upload user and every user must have write access to his home dir.
Obviously it's not an option to use something like
ChrootDirectory %h because every path component of the chroot path needs to have limited access rights, so as far as I understand this does not work.