Apache – How to check which Apache group I can use for the web server to write

apache-httpdchmodpermissions

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)

Best Answer

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]
    
Related Question