linuxubuntucommand-linechmodrights

Linux command line: id, group and getent group not returning the same results


I'm wondering why I get different results from id and group on one hand, and getent group on the other. Steps to reproduce:

$ sudo usermod -a -G libvirt eric
$ groups
eric adm cdrom sudo dip plugdev lpadmin sambashare
$ id
uid=1000(eric) gid=1000(eric) groups=1000(eric),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),119(lpadmin),128(sambashare)
$ getent group | grep libvirt
libvirt:x:136:eric
libvirt-qemu:x:64055:libvirt-qemu
libvirt-dnsmasq:x:137:

The user eric is clearly a member of libvirt. Why doesn't this show up with id and group? Thanks.

System: Ubuntu Budgie 18.04 4.15.0-34-generic


Solution

  • If I remember correctly, you'd need to either log out and back in or run newgrp libvirt to make the new group ownership effective.