I have a webserver where apache runs as www-data. Users are set up using chef, and some of their file/folder permissions are set to group: www-data, e.g. uploads folders.
Deployments are done with Capistrano, using the user account. It would be useful if during deployment, Capistrano could also change the group of files/folders to www-data.
How could I configure this, whilst maintaining security? I'm thinking an entry in the sudoers file that allows
<user> to execute
chgrp www-data /home/<user>/* whilst ensuring that the command does not contain