I have a folder with files owned by: joe:www-data, joe belongs to the group.

Apache only seems to cooperate with www-data:www-data. Is there a way around this so I can keep the user as joe and the group as www-data?

Is it recommended to use this module below if I want to accomplish this task? Is this a good idea?

<IfModule unixd_module>
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User daemon
Group daemon

  • What error are you actually encountering? You should be able to keep the html folders grouped as www-data and have Apache use them.
    – slm
    Dec 1, 2013 at 1:27
  • Well I am deploying with the login joe, and the file permissions are joe:joe, I want to be able to chown to joe:www-data (Yet Apache will only read if its www-data:www-data
    – JREAM
    Dec 1, 2013 at 3:47
  • What are the permissions on your files? Giving the files to group www-data won't help if they're not readable to the group. Dec 1, 2013 at 8:50

2 Answers 2


Yes, you need to tell Apache to switch to your www-data group via the mechanism you found.

You could instead add joe to the daemon group and chgrp -R daemon the DocumentRoot containing the files you want to serve, but daemon is a general-purpose group. It's more secure to use a service-specific group, especially for so powerful a service as Apache.

  • I am going to try this tomorrow it sounds cool :)
    – JREAM
    Dec 1, 2013 at 9:46

You can also use apache2-mpm-itk which allows to customize Apache user and group used for each virtual host.

apt-get install apache2-mpm-itk

nano /etc/apache2/sites-available/mydomain.com

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/myuser/mydomain.com
    Options -Indexes
    AssignUserID myuser mygroup

See Create and set up an Apache virtual host for more details.

You must log in to answer this question.

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