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 root access to my hosted machine. I have created a user account 'abcd' and the user's directory is:

/home/abcd/public_html

In httpd.conf i have:

<VirtualHost *:80>
ServerName abcd.mysite.com
DocumentRoot  /home/abcd/public_html
</VirtualHost>

This user has a website at that above location. however he cant get his site to upload images into /images folder.

The permissions are:

drwxrwxr-x

on images

share|improve this question

1 Answer 1

up vote 2 down vote accepted

/home/abcd/public_html/images is owned by the user and group abcd. The web server is running as another user and group (e.g. apache or www-data). So, can the web server write to that directory?

  • d rwx rwx r-x : the user permission don't apply, since the web server isn't running as the user abcd
  • d rwx rwx r-x : the group permissions don't apply, since the web server isn't running as the group abcd
  • d rwx rwx r-x : then the other permissions must apply and they do not allow the web server to write to it

You might think that the solution is to chmod o+w /home/abcd/public_html/images, but that would allow any user to write to images when all you want is to allow the web server to write to it. A better approach would be to change the group that owns the images directory to the group that the web server runs as. Since you're using apache, you should be able to find that group with ps -o group $(pgrep httpd). You can ignore the one process running as root.

If this isn't clear, maybe the wordpress documentation on changing file permissions will help.

share|improve this answer
    
thanks that is helpful. i changed the ownership to apache and it worked, but now the user can't update the files in that folder himself. He normally does an svn update to pull files which go into images/ and elsewhere, but he cant write to that foldr now... –  matt74tm May 1 '11 at 4:11
    
The wordpress doc says "All files should be owned by your user account on your web server, and should be writable by your username. Files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody)." –  matt74tm May 1 '11 at 4:13
    
I set the ownership as: drwxrwxr-x 5 apache apache - but he's not able to create a file withing in @sciurus –  matt74tm May 1 '11 at 4:18
    
Set the user ownership to abcd and the group ownership to apache, e.g. drwxrwxr-x 5 abcd apache –  sciurus May 1 '11 at 4:28

Your Answer

 
discard

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.