Re: How do I list all users in a group?
On 7 Mar, 17:10, Cédric Lucantis <o...@no-log.org> wrote:
> > It seems that there's no simple solution... This method is good, but I
> > can't know if a user is in a group and is not listed because he "owns"
> > the group or if no such user is present because there is none...
> > Thanks anyway!
>
> hmm, interesting :) Here's the simplest I could find (call it with group name
> as first param) :
>
> list_group_users()
> {
> ( grep "^${1}:" /etc/group | awk -F ':' '{print $4}' |
> sed -e 's/,/\n/g';
> grep "^${1}:" /etc/passwd | awk -F ':' '{print $1}';
> ) | sort -u
>
> }
>
> sorry if I misunderstood what you want...
>
> --
> Cédric Lucantis
Thank you guys! And any misunderstanding is my fault, no dubt!
Thank you all again,
Matteo
Reply to: