I need files created by apache2 to have umask 002, i.e. group rw, by default.

I've tried putting umask 002 in /etc/apache2/envvars and although this script does get executed as part of apache start up (apache2ctl graceful) the umask has no effect. Presumably somewhere further in the start up process (e.g. when the user is downgraded from root to www-data) there's somewhere better to put this.

I've read posts about fedora and one suggesting putting umask in /etc/init.d/apache2 but neither of these apply/work in debian (Squeeze).

How do you create new files (WebDAV, PHP)?
–
Jens BradlerApr 29 '12 at 5:27

In my test, I'm using file_put_contents(). but the code I'm trying to 'fix' with this is Drupal's Less module (which creates cached versions of processed Less CSS files). My specific problem is that I cannot run drush cc all as my user because it errors out on all these www-data created cache files.
–
artfulrobotApr 30 '12 at 9:15

1 Answer
1

To be sure that the umask setting takes effect please use a simple test and do not use any other web application for this. It might be the case that these application change the rights independently from the umask setting of Apache.