'sudo id -G <username>' vs 'id -G' issue

Karl Auer kauer at biplane.com.au
Wed Nov 2 22:07:54 UTC 2016


On Wed, 2016-11-02 at 22:19 +0100, Ralf Mardorf wrote:
> Is there a way to get the real state?
> 
> Or is there a way to 'activate' the group by something less obtrude
> than restarting the display manger, so that the script doesn't need
> to check if it should offer an option, but instead always could runs
> this less obtrude process, that doesn't terminate possible important
> processes, the user needs at this moment?

This doesn't activate a new group for the user, but you can find out
what groups the user is in by looking in /etc/groups or by running the
"groups" command as root for that user ("sudo groups fred").

Or use newgrp?

kauer at kt:~$ sudo addgroup test
Adding group `test' (GID 1002) ...
Done.

kauer at kt:~$ groups
kauer adm cdrom sudo dip plugdev lpadmin sambashare wireshark vboxusers
kauer at kt:~$ sudo usermod -a -G test kauer
kauer at kt:~$ groups
kauer adm cdrom sudo dip plugdev lpadmin sambashare wireshark vboxusers
kauer at kt:~$ newgrp - test
kauer at kt:~$ groups
test adm cdrom sudo dip plugdev lpadmin sambashare wireshark vboxusers kauer

That only works for the current login though, so not sure how useful it
is for you.

Regards, K.

PS: The verb is "obtrude", the adjective is "obtrusive". Excellent
word, nice choice!

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: E00D 64ED 9C6A 8605 21E0 0ED0 EE64 2BEE CBCB C38B
Old fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4







More information about the ubuntu-users mailing list