Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Trying out Linode for the first time, running an Arch Linux image, I successfully installed nginx as root.

This, however, made /usr/share/nginx/html inaccessible to non-root users.

Intuitively, I thought this would work:

  • newgrp www (create a new group)
  • chgrp -R www /usr/share/nginx/html (associate directory recursively with new group)
  • chmod -R g=rw /usr/share/nginx/html (give read-write permissions to new group)
  • usermod -a -G www john.doe (add non-root user to new group)

However, I still could not write files to /usr/share/nginx/html as john.doe. I also tried

  • chown -R :www /usr/share/nginx/html

to see if it had any effect—it didn't.

Here's what the setup looks like currently:

[john.doe@hydrogen nginx]$ ls -l
total 4
drwxrw-r-x 4 root www 4096 Dec 19 08:10 html
[john.doe@hydrogen nginx]$ id
uid=1000(john.doe) gid=100(users) groups=100(users),10(wheel)
[john.doe@hydrogen nginx]$ groups john.doe
wheel www users

Could someone kindly identify what I'm misunderstanding / missing that I can't write to this directory?

share|improve this question
new groups do not activate immediately. I had loads of trouble with this, when I added a new group to my self. Logging out and back in fixes it. I don't remember the other option. But try 'newgrp', – richard Dec 19 '13 at 14:06
Obscuring information makes questions difficult to understand. id says you're john.doe, but you ran groups acheong87. These aren't the same user. – Patrick Dec 19 '13 at 14:07
@Patrick - My mistake—fixed. (I thought using generic placeholders would make it easier to read.) – Andrew Cheong Dec 19 '13 at 14:08
In addition to what richard said, you removed the execute bit from the group on the html directory. You need execute when working with directories. – Patrick Dec 19 '13 at 14:09
@Patrick - Agh, that was it! And logging out and back in. I can't believe I never knew that. I guess I never paid much attention, having always learned/developed on UNIX as root. Thank you. – Andrew Cheong Dec 19 '13 at 14:14
up vote 2 down vote accepted

Add the Execute bit to your directories. As it stands, john.doe can write and read files in the directory but can't see the files in the directory. You can see this is true by having john.doe edit a file using a path that is inside the directory.

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.