mac osx permission error - apache folder chown _www
There's no single "correct" way to set this up; what the permissions need to be depends on who should be allowed to do what to which files. Does anyone other than you need to be able to edit the web files? Is it ok if other users on the computer can read the web files (directly, as opposed to via the webserver)?
Here's a simple option that gives you full (read+write) access, lets the webserver read the files, and locks everyone else out of the web folder (note: replace "sandro" with your actual username):
sudo chown -R sandro:_www /Library/WebServer/Documents
chmod -R u=rwX,g=rX,o= /Library/WebServer/Documents
If you need other access rules for the web files, please clarify.
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 18, 2022Comments
-
Admin almost 2 years
I deleted
Library/WebServer/Documents
folder and created it again.When I visited
localhost
it gave me forbidden error.I ran
sudo chown _www:_www Documents
And forbidden error was gone, but now I couldn't edit files at all. I couldn't even go into Documents folder from GUI.
Any ideas what is correct way to set this up??
ty.
-
Gordon Davisson over 11 years
chmod 777
is almost always the wrong answer -- it's a bit like having a little trouble with one of your door locks, and "solving" the problem by leaving the door wide open all of the time. -
nerdwaller over 11 yearsGenerally I would agree, but for presumably local web development, not really a huge issue.
-
Admin over 11 yearsI also tried sudo chown -R sandro:_www /Library/WebServer/Documents, in this situation I get forbidden error when visiting localhost.
-
Gordon Davisson over 11 yearsDid you also do the
chmod
command? If you're still having trouble after that, post the results ofls -lea /Library/WebServer/Documents
so we can see what's going on. -
Admin over 11 yearsYes it was chmod problem. Eventually I just did permission check on disk and it fixed it for me. And yes your solution was correct, thanks!