5

This question already has an answer here:

I was trying to experiment with users, groups, and permissions. The results can be seen below:

vagrant@cats:/$ ls -l | grep home
drwxr-xr-x   5 root    admin    4096 Sep 28 05:49 home
vagrant@cats:/$ cat /etc/group | grep "^admin"
admin:x:1002:vagrant
vagrant@cats:/$ cd home
vagrant@cats:/home$ pwd
/home
vagrant@cats:/home$ cd ..
vagrant@cats:/$ sudo chmod 770 home
vagrant@cats:/$ ls -l | grep home
drwxrwx---   5 root    admin    4096 Sep 28 05:49 home
vagrant@cats:/$ cd home
-bash: cd: home: Permission denied
vagrant@cats:/$ ?

I don't understand why I can't get in. The user vagrant is in the group admin, the group admin owns the directory home and only the owner and or group members can read, write or execute files in home. But for some reason I'm locked out. What am I missing here?

marked as duplicate by Gilles permissions Sep 28 '16 at 16:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

13

If you have done changes to your user (adding or changing groups etcetera), you need to log out and then in again for them to take effect. Or you can change to your own user in a subshell (su vagrant) and try again.

  • There's also newgrp command. – TNW Sep 28 '16 at 16:15
  • And exec newgrp will replace the current shell, saving you the extra exit or control-d when you go to log out. – Blacklight Shining Oct 1 '16 at 17:24

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