Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
test:x:503:myuser

$ groups myuser
   myuser : myuser test
share|improve this question
    
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

4 Answers 4

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:

/var/subdir/datadir/

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

share|improve this answer

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

share|improve this answer

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

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

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.