Re: How to list what users are in a group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Once upon a time, Karl-Olov Serrander <m11172@xxxxxx> said:
> On Wed, 21 Apr 2010, Natxo Asenjo wrote:
> > On Wed, Apr 21, 2010 at 12:39 AM, David Bartmess <dingodave@xxxxxxxxxx> wrote:
> >> This is a basic linux question, but how do I find out what users are
> >> included in a given group?
> >>
> >> Thanks!
> >
> > getent group <groupname> should do the trick.
> 
> But that doeas not show users which has groupname as the primary group.

No, for that you have to list all users and look at the primary group
field.

getent passwd | grep "^[^:]*:[^:]*:[^:]*:$(getent group <groupname> | cut -d: -f3):"

Primary/aux groups in Unix are set up in a less-than-efficient way for
searching.
-- 
Chris Adams <cmadams@xxxxxxxxxx>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux