Server Fault is a question and answer site for system and network administrators. 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

In our dev environment, I'm migrating some of our Apache sites to Nginx. What I'd like to do is ensure that my developers who all belong to the same group (webgroup) have full access to the files (e.g. log files) that are created by the web server user (www-data). The web user created files are typically owned by www-data:www-data so I thought I'd change that user's primary group to match that of the developers (webgroup).

The group change seemed to go through, but newly created files are still owned by www-data:www-data. I don't see a group directive for the nginx conf so I'm wondering whether there's any way to ensure that files created/updated by the nginx user get owned by the right group.

If I'd thought ahead, I suppose I could've made www-data the primary group for all of my users, but I didn't and I'd like to avoid going back and touching all of those users. Remember, this is a dev environment so security isn't hypercritical, but I'd still like to avoid having everyone authenticate as root or something similarly wide open.



I have since tried updating my nginx.conf file as show below, but to no avail. New files are still created as www-data:www-data after both a restart and a force-reload.

user www-data webgroup
share|improve this question – quanta Aug 22 '12 at 14:04
I've seen that, @quanta, but if the answer is in there, I guess I'm missing it. – Rob Wilkerson Aug 22 '12 at 14:06 the example, user www users, maybe the second value (users) is the group? I totally missed that. – Rob Wilkerson Aug 22 '12 at 14:07
Nope, guess not. I may need the remedial version of this lesson... – Rob Wilkerson Aug 22 '12 at 14:09 – quanta Aug 22 '12 at 14:28
up vote 3 down vote accepted

Simply apply a sticky bit to the folder where you store the log files. nginx is always using the group that was given at compile time for creating the logs. The group directive in the configuration is only applied during runtime.

chown -R www-data:webgroup /var/log/nginx && chmod g+s /var/log/nginx
share|improve this answer

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.