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 this issue with different web-hosting, particular upload scripts which can only upload to a folder only if it has 777 permission (which is risky). On the test server (on a different webhost), 755 works well.

On another web-hosting, log files generated by PHP file functions cannot be write to some time, but other files are mysteriously unaffected (for instance, the log files for the entire week is 655, and they work well, but just today's log-file doesn't work unless it is set to 777).

I am more of an application developer than a server backend expert, so these behaviours puzzle me to no end. Why are they happening? What can be done?

share|improve this question

Some hosts run apache in a low privilege mode. You must explicitly give world write access to directories that Apache needs to write to. In addition, the apache process must be able to read all of the files, so, any other user on the same system can read the files/directories on the system. Granted the top directories only need execute privileges to traverse down into them, preventing you from being able to list the files inside those directories. A remote shell wouldn't be able to modify files except those that were world writeable.

Some hosts run php in setuid mode, which means that php runs as your userid. While this provides more security from other users on the system, it now makes every file in your webroot able to be modified by any php process. A remote shell would be able to modify all files in your web space.

Whether one is more secure than the other is a decision that you need to make. Running apache in a low privilege mode prevents webscripts from defacing your site, but, leaves it open to other users on that system being able to read files that might include your wordpress config file that contains your mysql username/password/hostname.

share|improve this answer

are you running your server with different users? How does the ownership of your files look like?

share|improve this answer

Your Answer


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