Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

lsuser ALL / lsgroup ALL in C

27 views
Skip to first unread message

Miguel Sanders

unread,
Nov 12, 2008, 3:04:47 PM11/12/08
to
Hello

I am unable to find a method/function in libc which allows me to list
all known users and groups on a partition (similar to lsuser ALL /
lsgroup ALL).
All functions that I see in libc provide additional information on a
group based on either the GID or the name.
But what if I don't know the GID/name? There must be someway to list
all known groups...

Thanks for the help!

jpro...@gmail.com

unread,
Nov 12, 2008, 6:57:24 PM11/12/08
to

If I'm understanding your issue, all you are trying to do is list the
groups. If so, you can just use this

lsgroups -a ALL

That will list all of the group names with none of the extended
attributes.

Likewise, you can list all of the user names.

lsuser -a ALL

If this isn't what you are looking for, please elaborate.

J.

Miguel Sanders

unread,
Nov 13, 2008, 1:35:45 AM11/13/08
to

Yes that's exactly what I am looking for.
However, unfortunately, I has to be coded in C (and I don't really
like the "system" systemcall to obtain this information :-) ).
So I need something out of the libc library to obtain this.
F.e. methods/functions in libc:
getgroupattr
getgrgid
...

But nothing really about just listing the groups without knowledge of
the existing group names.

Thanks for the help!

Mark Taylor

unread,
Nov 13, 2008, 6:35:16 AM11/13/08
to
Try tracing or truss'ing it .. it probably does an open and a read or /
etc/group and thern formats the output ..

Rgds
Mark Tyalor

Alberto 'JCN-9000' Varesio

unread,
Nov 17, 2008, 4:05:54 AM11/17/08
to
Miguel Sanders wrote:

> But nothing really about just listing the groups without knowledge of
> the existing group names.
>
> Thanks for the help!

getgrent ??

--
* Alberto Varesio * - /IBM eServer Certified Specialist/
/S&N Competence Center Application Engineer/
* SPAZIOSYSTEM S.p.A. * - http://www.spaziosystem.com/
Tel.: +39 011 19756013 - Cell.: 335 1811324

Confidential notice: This message and its attachments may contain
confidential information that is addressed solely to the above person.
If you have received this message without authorization, delete it
along with any other copy and inform the sender.
Please consider your environmental impact before printing this e-mail
==
Nimmistica: "Il senso sviluppato nei polpastrelli". Lu...dito".

0 new messages