Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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