Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wanted to add myself to a group called vboxusers while the following situation occured:

At first let's see how it looks before we do anything:

$ id
uid=1001(me) gid=1001(me) groups=1001(me),4(adm),27(sudo),109(lpadmin),124(sambashare)
$ cat /etc/group | grep me
adm:x:4:me
sudo:x:27:me
lpadmin:x:109:me
me:x:1001:

Then I added myself to the group and checked again:

$ sudo usermod -aG vboxusers me
$ id
uid=1001(me) gid=1001(me) groups=1001(me),4(adm),27(sudo),109(lpadmin),124(sambashare)
$ cat /etc/group | grep me
adm:x:4:me
sudo:x:27:me
lpadmin:x:109:me
me:x:1001:
vboxusers:x:126:me

id still doesn't list me as being part of the group, while I definitely wrote the correct stuff into /etc/groups. What happened and what can I do that id also recognises it?

(just starting a new shell didn't change anything)

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

id shows information about the process that invokes it (or more precisely, it shows information about itself, which it inherits from the process that invokes it). The group database is only consulted at login time, and it only affects processes descended from that login session. The login process is granted the groups listed in the group database, and all other processes inherit from their parent.

Starting a new shell doesn't make a difference, you need to log out and back in. You can test your changes by logging in in another console or with ssh localhost or with su me.

You can query the group database with getent group vboxusers. Unless your machine uses NIS or LDAP to obtain user and group information from a network server, this will give the same information as grep '^vboxusers:' /etc/group. Again, this information tells you what happens at login time, it is not consulted afterwards.

share|improve this answer
add comment

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.