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

I get this error when I try creating a directory:

[rex <03:57 PM> /var/tmp/pb82]$  mkdir foo
mkdir: cannot create directory `foo': Permission denied

But doesn't the following output indicate that I should be able to create directories there since I am a member of the www-data group to which that directory belongs?

[rex <03:57 PM> /var/tmp/pb82]$  ls -l ..
total 8
drwxrwxr-x 5 root www-data 4096 Aug  7 15:32 jinfo
drwxrwxr-x 3 root www-data 4096 Aug  7 20:43 pb82
[rex <03:58 PM> /var/tmp/pb82]$  whoami
[rex <03:58 PM> /var/tmp/pb82]$  groups rex
users www-data

Edit: in response to @UlrichDangel:

[rex <04:08 PM> /var/tmp/pb82/jinfo]$  id
uid=1008(rex) gid=100(users) groups=100(users)
share|improve this question
up vote 8 down vote accepted

You probably added yourself to the www-data group and didn't relogin afterwards. To change your group membership you can use

sg www-data

to get a new shell with the appropriate permissions.

groups will return the data from the database and not your effective permissions - from man groups:

Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).

share|improve this answer
That fixed it, thanks! – RexE Aug 9 '12 at 23:33

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.