I want to provide users a personal storage to upload files to their home directory via SFTP(chrooted). These files should then be displayed on our website to decide whether they should be imported to the system or not. So the webserver (www-data user) need to have read/write access.

Right now, I cannot get www-data being able to write/delete those files

From reading many sources and answers to that problem, I ended up in this setup:

  • The ownership of home directories are: username:www-data
  • I used setgid to overwrite the group of each uploaded file via SFTP
  • I learned, that I cannot actively set the file permissions on server side, I can only reduce by using an umask

How can I automatically manage to give "g+w" permission on each uploaded file via SFTP, so that the www-data user an delete them after they has been processed.

What I tried so far:

  • Played arround with umasks (to learn the will never increate the rights on a file)
  • Played arround with ACL, but here the same problem seem rule
  • Use FTPS instead of SFTP to gain better control over such things. So I used vsftpd, but even with that, I could not get a sticky "g+w" permission on files

What I don't want:

  • Using rsync or any further server (that can fail) to syncronize the home folders with any other folder while translating the proper file rights.

Thanks so much for any tips!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.