proFTPd: Making Apache the owner of uploaded files

I google’d a lot and found no sufficient solution to the rather common problem.
So here’s the required configurations to place inside /etc/proftpd/proftpd.conf

I noticed, that proFTPd has to run in standalone mode,
because when running as xinetd service… only chgrp works, but not chown.

ServerType Standalone

This one switches the capabilities module on and enables the execution of chown():

<IfModule mod_cap.c>
   CapabilitiesEngine on
   CapabilitiesSet +CAP_CHOWN

In order to define which user/group shall been set on file creation…
proFTPd uses Umask for defining the permissions (which subtract from octal permissions).
The first mask are the permissions for files, the second mask are the ones for directories.

<Directory /var/www>
   UserOwner www-data
   GroupOwner www-data
   Umask 002 003

Then restart the server and hope it works:

service proftpd restart

Of course the ftp-user may require membership in group www-data:

adduser ftpusername
usermod -g www-data ftpusername

proFTPd Documentation Quicklink: