I have added the user "test" in myuser group usermod -a -G test myuser. But if I try to execute or try to cd to datadir as "test" user gives the Permission denied error. datadir is having the following privilege 770 and the user "test" belongs to myuser group and still it gives the Permission denied error.

drwxrwx--- 3 myuser myuser 4096 Feb  6 16:24 datadir

$ grep "^test" /etc/group

$ groups myuser
   myuser : myuser test
  • What does running id as testuser yield? – EEAA Feb 7 '12 at 4:30
  • How di i get the id ? – Aha Feb 7 '12 at 5:41

You did not tell us about the parent directories permissions of datadir. Even if you have full permissions to a folder, you will not be able to access it unless you have the appropriate permissions to its parents also. So, you need to look at the full path permissions. For example, if you have a hierarchy like:


You should check the permissions of subdir and /var also. This is just an illustrative example.


No, you're reading this backwards. myuser belongs to the test group, not the other way round.


Changed group membership only takes effect after logging in again. You can confirm by running groups. Logging out and logging in again solves it.

  • Tried after closing the shell, still the issue resides ? groups myuser myuser : myuser test – Aha Feb 7 '12 at 4:39
  • Closing a shell is not logging in. – JdeBP Feb 7 '12 at 11:41

see if "mysuser" shows up when the user runs groups. I'm suspect the problem is that the user doesn't have the group privileges in the shell which you are using. If you add a user to a group, existing logins won't get the group privilege. The user would have to login again to get the new privileges.

Alternatively, in an existing shell, the user can run newgrp myuser to create a subshell with this new group, however this has the effect of altering the default group for that user in that shell, so files created in that shell will by default be owned by mygroup instead of that users default group, which may or may not be desirable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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