Yesterday, I was finally able to get my apache process to write files to a directory by setting the umask to 002 in the /etc/sysconfig/httpd script, but I was wondering if it's possible to set this umask directive at the config layer?
I am seeking to do this for portability reasons, because my vhost configs are version controled and published to remote servers. I'd prefer not being forced to manually configure each server's httpd script (no puppet yet).
Thanks.
-- Edit --
Using Ruby/Capistrano to deploy code and config files
Using PHP mkdir() when creating files uploaded by users.
Rather than set a directory to 777, I am creating a specific 'filer' user / group which will own the directory. Then add the apache user to the group. If I don't set the umask to 002 then I get permission denied errors because apache user != filer user, but apache user is in the filer group.
Answer
Since you are using PHP code you can just use the PHP functions chmod()
and umask()
depending on the need.
The main Apache umask seem to only be configured the way you already figured out, not anywhere in the configuration itself, so doing it in the application/code is the best way.
No comments:
Post a Comment