1

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

siliconpi
  • 1,807
  • 6
  • 32
  • 46

1 Answers1

2

/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.

sciurus
  • 12,678
  • 2
  • 31
  • 49
  • 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... – siliconpi May 01 '11 at 04: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)." – siliconpi May 01 '11 at 04:13
  • I set the ownership as: drwxrwxr-x 5 apache apache - but he's not able to create a file withing in @sciurus – siliconpi May 01 '11 at 04:18
  • Set the user ownership to abcd and the group ownership to apache, e.g. drwxrwxr-x 5 abcd apache – sciurus May 01 '11 at 04:28