Suddenly the following problem has happened:
I have an Apache web directory at /www. Everything was ok with the permissions, but at some point (I can't realize what caused it), I become unable to create any new files in this directory.

I have tried two methods:

  1. Saving a new file from Sublime

  2. running sudo echo "" > newfile.

But both methods failed. On the other hand I am able to create new files in my home directory (using both mentioned ways) and then to copy or move them to /www. What may be the issue and how to solve it?

  • 1
    What does ls -l / show for www ? – user151019 Nov 20 '13 at 21:43
  • Does the sudo echo thing fail silently or return an error code/message? – nohillside Nov 20 '13 at 22:12
  • ls -l / for www returns: drwxr-xr-x 8 root wheel 272 19 Nov 23:58 www sudo echo "" > newfile returns: -bash: newfile: Permission denied – pigeek Nov 20 '13 at 22:41
  • does newfile exist already? Can you do the full path sudo echo "" > /www/newfile – user151019 Nov 20 '13 at 23:28
  • newfile doesn't exist (I am just new to Mac, but in general I know what I am doing). Running with the full path has the same effect. BTW sudo mkdir newdir does work. – pigeek Nov 21 '13 at 1:04

sudo echo "" > newfile should never have worked, because sudo only applies to the echo command and not to the redirection. Try using sudo touch newfile or echo "" | sudo tee newfile.

Sublime Text doesn't seem to support creating new files to a directory you don't have write permission to. It does support authenticating as root when modifying an existing file though. See http://sublimetext.userecho.com/topic/27820-prompt-if-need-elevated-permission-to-save/.

Maybe you did have write permission to the directory earlier but something (like upgrading to 10.9) removed it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .