I'm trying to make Wordpress work. I currently have this error message:

Could not create directory. /var/www/html/wp-content/upgrade/theme_name

when trying to upload a theme. This is the permissions set to /var/www/html/wp-content/upgrade/

drwxrwxr-x 3 ec2-user apache 4096 Jun 21 00:30 upgrade

chmod 777 upgrade makes the error go away. But that is not considered best practice. However, I think this should work too... why not?

I guess the web server may not be included by the above permissions. What group should I use to allow the web server to write?

(My setup is Amazon EC2, Amazon Linux AMI with httpd)


I don't know anything about Amazon EC2, but you should be able to:

  1. Retrieve the name of the user running Apache with a command similar to this:

    ps aux | grep apache # The username should be in the first column.
  2. Retrieve the groups this user is part of with the groups(1) command:

    groups [USERNAME]
  • The first column is apache, and groups apache return apache : apache. A line from the first commmand looks like this: apache 11171 0.0 3.4 39984 21516 ? S Jun20 0:02 /usr/sbin/httpd – user1995 Jun 21 '12 at 11:14
  • 1
    User apache clearly has permissions to write in the directory. You say chmod 777 solves the issue, so I am guessing you're using a different user to upload your themes. I don't know Wordpress very well. According to this answer try changing ownership to user www-data. – rahmu Jun 21 '12 at 11:28
  • Thank you for taking the time to look up the article and everything. It was indeed a different user, as I realized Wordpress used FTP to do its work. I found out that user by what was suggested below and then added group apache, found out by step 1, to it. That solved it. – user1995 Jun 21 '12 at 16:55

You may try to use the following command-line method to find out your Apache group names:

WWW_GROUP=`ps axo user,group,comm | egrep '(apache|httpd)' | grep -v ^root | cut -d\  -f 2| uniq`
echo Apache group is: $WWW_GROUP

To get the user, check: How to determine Apache user from the command-line?


chmod 777 upgrade makes the error go away.

Well, in that case ls -ld /var/www/html/wp-content/upgrade/theme_name should reveal creator's credentials, which you can use for precise access granting.

And it's better using 1777 (as for /tmp) since at least it guarantees that only owner of a file would be able to unlink it.

  • 1
    Make the error go away! Interesting approach to problem solving. This is not a solution, it's a lie. – iharob Nov 25 '15 at 14:17
  • What do you call "lie" — citing original author's text? :) or suggestion to at least use 1777 instead of 777? :) or finding out creator ownership and using it for "precise access granting"? – poige Nov 25 '15 at 19:54
  • It's a lie to the system, because 777 is not correct in any context I know. – iharob Nov 25 '15 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy