Click to See Complete Forum and Search --> : obtaining a list of user in a group


Benny B
01-01-2002, 08:08 PM
I was just wondering if there is a console command that can list all the users who belong to a certain group.....I've yet to be able to find one.

Thanks...

element-x
01-01-2002, 08:35 PM
Theoretically this will work...


$ grep groupname /etc/group | cut -f4 -d:


for example:

$ grep wheel /etc/group | cut -f4 -d:

I hope this helps. (I'm not quite sure if there is an actual single-command that does this though.)

Benny B
01-02-2002, 03:22 AM
Cool, thanks muchly JAdrock

PLBlaze
01-02-2002, 01:07 PM
Take a look at id and groups commands...hopethis helps.

Benny B
01-02-2002, 10:35 PM
Yeh - I know about the id and groups commands, however unless I am missing something niether of those commands will list every user who belongs to a particular group....?

Thanks anyway tho...

Benny B
01-02-2002, 10:46 PM
Originally posted by JAdrock:
<STRONG>Theoretically this will work...


$ grep groupname /etc/group | cut -f4 -d:


</STRONG>


Thanks JAdrock, but unfortunately this doesn't work .... well it worked in redhat - but not in Mandrake - I never tried it in Debian... the /etc/group file must be a different format or something. Anyone else got any other suggestions?

Also on a side note what would be a console command that can change/give a user a real name. So say I have the user account ben, how would I go about setting my real name for that account to "Ben Lastname" ??

Thanks.

PLBlaze
01-03-2002, 02:59 AM
Maybe usermod -c "Ben Lastname" userid would...for more opts read man usermod or do it by hand in /etc/passwd :D.Hope this helps.