Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getgrent(3) [ultrix man page]

getgrent(3)						     Library Functions Manual						       getgrent(3)

       getgrent, getgrgid, getgrnam, setgrent, endgrent - get group entry

       #include <grp.h>

       struct group *getgrent()

       struct group *getgrgid(gid)
       gid_t gid;

       struct group *getgrnam(name)
       char *name;

       void setgrent()

       void endgrent()

       The  and subroutines each return pointers to an object with the following structure containing the broken-out fields of a line in the group

       struct  group { /* see getgrent(3) */
	       char    *gr_name;
	       char    *gr_passwd;
	       int     gr_gid;
	       char    **gr_mem;

       struct group *getgrent(), *getgrgid(), *getgrnam();

       The members of this structure are:

       gr_name	  The name of the group.
       gr_passwd  The encrypted password of the group.
       gr_gid	  The numerical group-ID.
       gr_mem	  Null-terminated vector of pointers to the individual member names.

       A call to has the effect of rewinding the group file to allow repeated searches.  The may be called to close the group database	when  pro-
       cessing is complete.

       The  subroutine	simply reads the next line while and search until a matching gid or name is found (or until EOF is encountered).  The sub-
       routine keeps a pointer in the database, allowing successive calls to be used to search the entire file.

       A call to must be made before a loop using in order to perform initialization and an must be used after the loop.  Both and make  calls	to

       All information is contained in a static area so it must be copied if it is to be saved.

       If YP is running, does not return the entries in any particular order.  See the Guide to the Yellow Pages Service for setup information.

       The  group database may also be distributed via the BIND/Hesiod naming service.	See the Guide to the BIND/Hesiod Service for more informa-

Return Values
       A null pointer (0) is returned on EOF or error.

See Also
       group(5), svc.conf(5)
       Guide to the BIND/Hesiod Service
       Guide to the Yellow Pages Service


Check Out this Related Man Page

GETGRNAM(3)						     Linux Programmer's Manual						       GETGRNAM(3)

getgrnam, getgrgid - get group file entry SYNOPSIS
#include <grp.h> #include <sys/types.h> struct group *getgrnam(const char *name); struct group *getgrgid(gid_t gid); DESCRIPTION
The getgrnam() function returns a pointer to a structure containing the group information from /etc/group for the entry that matches the group name name. The getgrgid() function returns a pointer to a structure containing the group information from /etc/group for the entry that matches the group gid gid. The group structure is defined in <grp.h> as follows: struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ gid_t gr_gid; /* group id */ char **gr_mem; /* group members */ }; RETURN VALUE
The getgrnam() and getgrgid() functions return the group information structure, or NULL if the matching entry is not found or an error occurs. ERRORS
ENOMEM Insufficient memory to allocate group information structure. FILES
/etc/group Group database file CONFORMING TO
fgetgrent(3), getgrent(3), setgrent(3), endgrent(3) GNU
1993-04-04 GETGRNAM(3)
Man Page

5 More Discussions You Might Find Interesting

1. Programming

to obtain users of each group in c

Hello They have ordered to me that makes several small utilities in C/C++ for the servants, among them a small program in C/C++ to generate a file HTML with the groups of that servant and in addition that is the corresponding users of that group. For example of a group: Group: Sys Members:... (2 Replies)
Discussion started by: cybermeis
2 Replies

2. SCO

Authentication problems with Active Directory/Samba/Winbind/Pam

Hi all. I'm having real trouble authenticating users against active directory for my SCO UnixWare 7.1.4 box running samba 3.0.24 (installed via Maintenance pack 4). I can list AD users/groups (after overcoming several hiccups) with wbinfo -g / wbinfo -u. I can use id to get a view an ad user ie:... (0 Replies)
Discussion started by: silk600
0 Replies

3. Programming

scandir() and threads

I couldn't find anywhere informations about it. Is scandir() thread-safe? (4 Replies)
Discussion started by: dawwin
4 Replies

4. Red Hat

Shadow file password policy

Today i was going through some of security guides written on linux . Under shadow file security following points were mentioned. 1)The encrypted password stored under /etc/shadow file should have more than 14-25 characters. 2)Usernames in shadow file must satisfy to all the same rules as... (14 Replies)
Discussion started by: pinga123
14 Replies

5. Programming

getgroups usage on linux

hi , I have a problem about getgroups usage on linux. getgroups can get supplementary groups of a process but if i run a process with root account and I want to get supplementary groups of nobody then what i should do to realize that. (4 Replies)
Discussion started by: fatshaw
4 Replies