Setting ACL on webfolders when using GIT or SVN

When using a VCS(Version Control System) like SVN or GIT to deploy files to your webserver you are generally faced with some troubles with permissions.

If the website/webapplication needs permissions to write files in folders, you cannot easy chown these folders like:

sudo chown -R www-data:www-data content

When setting rights this way, the webapplication works like a charm, but updating with GIT or SVN give problems, because the user executing the update isn’t www-data.

A solution to this problem is to use ACL.

To install ACL on ubuntu

Then add the rwx right to the current running user and www-data on the folders content and config/user

sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx content config/user
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx content config/user