I'm trying to convert a Chef script that's used in AWS OpsWorks for an Ubuntu system to a script I can use with my AWS OpsWorks setup for my Amazon Linux AMI installation.

Their Ubuntu Setup:

  • sudo chown -R www-data:www-data /var/www

My Linux Setup:

  • sudo usermod -a -G www apache
  • sudo chown -R apache /var/www
  • sudo chgrp -R www /var/www

Their chef Script is as follows:

cookbook_file "/srv/www/wordpress/current/wp-config.php" do source "wp-config.php" mode '0755' action :create owner 'deploy' group 'www-data' end

Do I just need to change their 'www-data' user to my 'apache' user to get this script to work with my setup?

  • Or you could add the apache user to a www-data group on your server (I think).
    – Caja
    Commented Feb 12, 2016 at 16:01
  • 1
    Hi @Caja thanks for the response, say I didn't want to add the apache user to my www-data group. Would changing 'www-data' to 'apache' in my Chef configuration work? The reason I ask is because when I run groups command on my EC2 instance, i only have ec2-user wheel www groups, there is no www-data group.
    – Corey
    Commented Feb 12, 2016 at 17:22
  • I would imagine that would work as well, although I have never done it.
    – Caja
    Commented Feb 12, 2016 at 18:01

1 Answer 1


DocumentRoot should be owned by the apache's user or the group who has permission to access DocumentRoot. To check which user or group has permission, you can go to your apache's configuration file and find for user or group. You can find both the entries in configuration file which you can use to give permission to the DocumentRoot. According to that, you can change your chef recipe for user and group. By default in Ubuntu OS the user and group value is "www-data".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .