I've set up SFTP, so that some users can upload files to a directory where the web application can pick them up. The webserver is running as user A, and SFTP is configured for user B.
User A is uploading files to /sftpchroots/filesbyA/ (owned by root:root, to enable a chroot). Naturally, these files are owned by A after uploading. User B has to process them, though, and needs ownership to be able to remove them afterwards.
Is there a way to set it up so that everything uploaded to that directory, (or everything uploaded by user A) has its ownership changed to user B? Or is there a way to allow B to unlink the files without being owner (e.g. having group permissions set somehow)?
EDIT: as it turns out, the situation is a bit more nuanced. User A will be uploading folders with files in them. These folders will thus be owned by A, as well as their contents.
Bto delete all files directly below the directory that is owned byB. However, as soon asAuploads a directory with files insideBcannot touch these files, it seems.. – Joost Aug 17 '15 at 21:25