Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got apache running on my mac workstation (OS X 10.7, with the pre-installed copy of apache), and our web applications require write access to certain sections of the filesystem to run (usually just a tmp dir, but sometimes more than that).

We have (literally) thousands of clients, and I want to be able to quickly grab a copy of any website's code, and have it "just work", however I always need to manually modify the unix permissions of specific directories after pulling a client's website out of source control (the list of directories varies from one client to another, as it has changed over the years).

Since it's a dev server, firewalled off from the general internet, I would like to give apache/php write access to the entire DocumentRoot. How can I do this?

I tried chmod 777 on the DocumentRoot, but if I create a directory inside it, the permissions are still 755 (owner: me, group: wheel).

I think there should be a way to force all files created inside DocumentRoot to be 777 or perhaps 775, with the _www user added to the wheel group?

share|improve this question

I was able to solve this by using ACL's, which supports inherited permissions:

sudo chmod -R +a '_www allow read,write,delete,add_file,add_subdirectory,file_inherit,directory_inherit' /Library/WebServer/Documents

Now, whenever I create a new directory or source control checkout in the DocumentRoot, the _www user has full read/write access.

share|improve this answer

setting your umask to 000 or 002 will give you the 777 or 775 create permissions you're looking for. Problem is, anything you create anywhere will get those permissions. If you're ok with 775, go for it. In not, you could make a mkwebdir command like so:

  umask 000;
  mkdir "$1";
  umask 022;

or even better, if you don't mind a sudo command in there:

  mkdir "$1" && sudo chown _www "$1"

then just do: mkwebdir username

share|improve this answer
I'm hoping for a more seamless solution than creating a shell script. I don't typically use mkdir to create directories, I typically use subversion or git or my IDE, sometimes I also use cp -r. – Abhi Beckert Apr 8 '12 at 21:54

You could try to use chown _www:wheel docroot and then chmod g+s after that setup umask as you need.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.