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

Re: get list of users in group



Mandag 21 juli 2008 09:09, skrev Petter Reinholdtsen:
> [Valerio Pachera]
>
> > Hi all, may you write me how to get (for example) the list of all
> > the teachers? I mean by bash, not by LWAT.
> > I need that for a script.
>
> Can you use 'getent group teachers'?
>
> Happy hacking,
> --
> Petter Reinholdtsen

And if you want them listed with one username on each line, this is one 
way of doing it:
getent group teachers|cut -d":" -f4-|sed 's/,/\n/g'

or just use ldapsearch:
ldapsearch -b cn=teachers,ou=Group,dc=skole,dc=skolelinux,dc=no -h 
ldap -x -LLL memberUid |awk -F" " '/^memberUid/ { print $2}'

 
-- 
Klaus Ade
67E61D18B2C44F8A3DA35C6D849F9F5F 26FA477D

Attachment: pgpPCfb3C6wKM.pgp
Description: PGP signature


Reply to: