Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can't add files to /Library/WebServer/Documents

I can't use my iMac as a local webserver because I can't add any files to /Library/WebServer/Documents. I was able to edit the index.html.en file after using the sudo and chmod commands in Terminal to grant myself read and write privileges to the file, but I still cannot save any other files to the same directory. Why not and what can I do about it? My operating system is Lion (10.7.5).

Posted on Sep 24, 2012 11:07 AM

Reply
16 replies

Sep 25, 2012 11:57 AM in response to Mark Jalbert

Here it is, (with everything before the $ prompt deleted for security reasons):


$ pkgutil --file-info /Library/WebServer/Documents

volume: /

path: /Library/WebServer/Documents


pkgid: com.apple.pkg.Essentials

pkg-version: 10.7.0.1.1.1306847324

install-time: 1320059339

uid: 0

gid: 0

mode: 755


pkgid: com.apple.pkg.update.os.10.7.3.11D50b.combo

pkg-version: 1.0.1.1306847324

install-time: 1328492715

uid: 0

gid: 0

mode: 755

Sep 25, 2012 11:58 AM in response to Mike Enders

This is what I did


sudo chown -R $USER /Library/WebServer/Documents


I left all the other permissiosn as they were, as once I was the owner, all was well (sort-of)


However, I then run into issues when Disk Utility Repair Permissions is run (which is sometimes run by other utilities on my behalf), as that will reset ownership back to 'root' 🙂


So then I have a 'root' owned crontab entry that changes it back to my ownership. These days, others would suggest a launchd .plist, or at least those that told me I shouldn't change the ownership in the first place 🙂


All in all, it starts to get complicated.


Message was edited by: BobHarris

Dec 10, 2016 12:59 PM in response to lagardeonline

lagardeonline wrote:


HI, Im also trying to access WebServer to work on a local for a website.

The moment I copy any of the code you guys say here, the terminal asks me for a password and doesn´t let me type anything...

Any ideas?

Thanks..

The sudo command's password prompt will not echo anything back, but the Mac will every letter of your account's password (the account you are using must be an admin account; the first account created on a Mac is an admin by default). After you have typed in your password, press the <return> key and the Mac will process your password.


The Terminal interface to the Unix side of OS X is very "Old School", and this is how it was done back in the '70's and it has not changed since.

Can't add files to /Library/WebServer/Documents

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.