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

Re: How do I list all users in a group?




> 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



Reply to: