getgrent(3) Library Functions Manual getgrent(3)Name
getgrent, getgrgid, getgrnam, setgrent, endgrent - get group entry
Syntax
#include <grp.h>
struct group *getgrent()
struct group *getgrgid(gid)
gid_t gid;
struct group *getgrnam(name)
char *name;
void setgrent()
void endgrent()
Description
The and subroutines each return pointers to an object with the following structure containing the broken-out fields of a line in the group
database:
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
and
Restrictions
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-
tion.
Return Values
A null pointer (0) is returned on EOF or error.
FilesSee Alsogroup(5), svc.conf(5)
Guide to the BIND/Hesiod Service
Guide to the Yellow Pages Service
getgrent(3)
Check Out this Related Man Page
GETGRENT(3) Linux Programmer's Manual GETGRENT(3)NAME
getgrent, setgrent, endgrent - get group file entry
SYNOPSIS
#include <grp.h>
#include <sys/types.h>
struct group *getgrent(void);
void setgrent(void);
void endgrent(void);
DESCRIPTION
The getgrent() function returns a pointer to a structure containing the group information from /etc/group. The first time it is called it
returns the first entry; thereafter, it returns successive entries.
The setgrent() function rewinds the file pointer to the beginning of the /etc/group file.
The endgrent() function closes the /etc/group file.
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 getgrent() function returns the group information structure, or NULL if there are no more entries or an error occurs.
ERRORS
ENOMEM Insufficient memory to allocate group information structure.
FILES
/etc/group
group database file
CONFORMING TO
SVID 3, BSD 4.3
SEE ALSO fgetgrent(3), getgrnam(3), getgrgid(3)GNU 1993-04-04 GETGRENT(3)
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)
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)
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)