DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

initgroups(S)


initgroups -- initialize the supplementary group access list

Syntax

cc ...-lc

#include <grp.h>

int initgroups (const char *name, gid_t basegid);

Description

initgroups(S) reads the group file, using getgrent(S), to get the group membership for the user specified by name, and then initializes the supplementary group access list of the calling process using setgroups(S).

The group ID basegid is also included in the supplementary group access list. This is typically the real group ID from the password file.

While the routine is scanning the group file, if the number of groups, including basegid, exceeds {NGROUPS_MAX}, any further group entries are ignored.

Return values

Upon successful completion, initgroups( ) returns 0. Otherwise, it returns -1 and errno is set to indicate the error.

Diagnostics

Diagnostic codes for this function are described below.

[EPERM]
The calling process does not have the needed privileges.

See also

getgrent(S), getgroups(S)

Standards conformance

initgroups(S) is not part of any currently supported standard; it was developed by UNIX System Laboratories, Inc. and is maintained by The SCO Group.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003