27
$ id
uid=1000(kev) gid=1000(kev) groups=1000(kev),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),124(sambashare)

$ ls -l /etc/sudoers
-r--r----- 1 root root 723 Jan 31  2012 /etc/sudoers

$ sudo adduser kev root
Adding user `kev' to group `root' ...
Adding user kev to group root
Done.

$ cat /etc/sudoers
cat: /etc/sudoers: Permission denied

After adding myself(kev) to group root, I still cannot read /etc/sudoers.

I don't know why. Thanks for your help.

29

You need to log out and back in again for the change to take effect.

| improve this answer | |
  • 1
    If you'd prefer refreshing groups w/o logging out, then check harayz's answer. – David your friend Nov 11 '16 at 12:21
15

To refresh group membership of the user kev without logging out:

exec su -l kev

To make groupname your default group for the entire session:

newgrp groupname

To print current groups you're a member of (source):

groups
| improve this answer | |

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.