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 have a php script in a directory called /manager. In it, I open and write to a file in the directory above /manager. However, if the permissions are set to allow owner write, I get "failed to open stream: Permission denied"

It only works when I change permissions to allow public write, but doesn't this allow anyone to write to my file? Could this be happening because it is reaching up a directory, or am I misunderstanding permissions?

share|improve this question

My first question is who owns the directory? is it Apache? If not, then you will probably have issue writing to that directory. Your next option is to allow group permissions to handle things -- is the owner in the www group? (Pardon if that is not the right name) If so, you can have the group permissions set to allow Apache and yourself to write (assuming that the owner is in the group).

As to public write -- that means that all users and services which are running on/logged in to that machine will be able to write to that directory. It does not mean that a malicious person operating outside of the machine will be able to futz with it... unless he happens to be able to sign on...

share|improve this answer
So if I am on a shared server on a web host, does that mean anybody else who happens to be hosted on the same server as me could write to my files? – cstack Jul 24 '10 at 14:13
No... Most web servers make each user work in his own virtualized machine. Hostgator, for example, only shows the users I create in my /home/ directory. Now, if you happen to be sharing the same account with others, that would allow them to write to your directories. So, I happen to own, if my wife were to log in, she might be able to change some data, but then she would need to actually log in to the server (she wouldn't want to...) . If you wanted to change my data (even chmod 777 stuff), you could not, even if you had a hostgator account. – cwallenpoole Jul 29 '10 at 18:35

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.