Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been tried to change group of the whole directory with code example below [bash terminal on ubuntu 11.10]:

chgrp apache -R ./test1

but failed and said :

chgrp: invalid group: `apache'

user and group in httpd.conf is set to "apache".

share|improve this question
up vote 3 down vote accepted

If you've installed Apache via sudo apt-get install apache2 or with sudo tasksel install lamp-server then the default group is www-data not apache you'll need to use that group name instead (You may also need to update the Apache configuration file).

If you've custom compiled it, or using a 3rd party source, you will need to make sure the apache group actually exists. You can check by typing the following in the command line:

cat /etc/group | grep "apache"

If no results are returned then you'll need to create the group, you can do so with sudo addgroup apache. However, at this point I STRONGLY ADVISE you use aptitude to install Apache, as by using the apt package manager you'll always stay up to date and configuration (including group creation) will be done for you.

share|improve this answer
got it. www-data works. but therz a problem with part1 of your guide. i have changed APACHE_RUN_USER|GROUP to apache [this file: etc/apache2/envvars] and comment www-data group|user, then when tried to restart apache it said: bad name "apache". why www-data works but my custom name is bad name ?! – Netmoon Nov 13 '11 at 10:05
@Netmoon because it must be an existing user and existing group. When you install apache from the ubuntu repositories, it will create the user www-data and the group www-data during installation. If you want to use a different user and group, you have to create them first. You can use the addgroup and adduser commands to create them. – geirha Nov 13 '11 at 10:09
@Netmoon Please see the second half of the answer, if you're using a custom group (not recommended), you will need to run sudo addgroup apache – Marco Ceppi Nov 13 '11 at 15:00
thanks.understand it perfectly. – Netmoon Nov 17 '11 at 13:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.