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 am developing web applications with Ubuntu Linux, MySQL and PHP.

I put my files in the /var/www/some_web_project/ directory. I have problems with permissions, for example when I want to output image in my web application by <img src="images/some.jpg"/>, it does not show me images until I change permissions of the folder. Usually I change it to 777. But I do not think this is the right from a security perspective

What should the correct permission mode be?

share|improve this question
What is the owner/group of some_web_project? – mako_reactor Feb 13 '13 at 15:07
Using root for the owner is fine; especially if you login with an unprivileged user who is a member of the group that has write permissions to the directory/files. – Chris S Feb 13 '13 at 15:53
up vote 2 down vote accepted

Directory Permissions should either be 775 or 755, depending on whether you use groups or not (respectively). Be sure to set the owner and group appropriately (it should not be owned by the www user or anything related to the webserver daemon itself).

File Permissions should be 664 or 644, depending on group use again. CGI scripts should have the same permissions as the directories however.

chmod -R ug=rwX,o=rX /var/www/some_web_project or chmod -R u=rwX,go=rX /var/www/some_web_project should set permissions correctly, except for CGI Scripts and their like, which will need manual attention.

share|improve this answer

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.