89 lines
2.0 KiB
Plaintext
89 lines
2.0 KiB
Plaintext
'\"macro stdmacro
|
|
.TH INITGROUPS 3c
|
|
.UC 5
|
|
.SH NAME
|
|
initgroups \- initialize group access list
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.ti -2
|
|
.SM
|
|
.IR POSIX :
|
|
.B #include <sys/types.h>
|
|
.PP
|
|
.B int initgroups\|(char \(**name, gid_t basegid);
|
|
.PP
|
|
.ti -2
|
|
.SM
|
|
.IR BSD :
|
|
.PP
|
|
.B int BSDinitgroups\|(char \(**name, int basegid);
|
|
.fi
|
|
.SH DESCRIPTION
|
|
.I initgroups
|
|
and
|
|
.I BSDinitgroups
|
|
read through the group file (\f3/etc/group\fP) and set up,
|
|
using the appropriate version of the
|
|
.I setgroups
|
|
call, the group access list for the user
|
|
specified in
|
|
.IR name .
|
|
The
|
|
.I basegid
|
|
is automatically included in the groups list.
|
|
Typically this value is
|
|
the group number from the password file.
|
|
.PP
|
|
The difference between
|
|
.I initgroups
|
|
and
|
|
.I BSDinitgroups
|
|
is the type of the
|
|
.I basegid
|
|
parameter.
|
|
Both of these routines use the
|
|
.I sysconf(\|\f3\s-1_SC_NGROUPS_MAX\s+1\fP\|)
|
|
system call to determine the maximum
|
|
number of groups at run-time.
|
|
.SH FILES
|
|
.nf
|
|
/etc/group
|
|
/etc/passwd
|
|
.fi
|
|
.SH SEE ALSO
|
|
multgrps(1), getgroups(2), setgroups(2), sysconf(3C)
|
|
.SH DIAGNOSTICS
|
|
.I initgroups
|
|
returns 0 if successful. If the calling routine doesn't have
|
|
superuser privileges, it returns \-1 and an error code is stored
|
|
in global integer
|
|
.IR errno .
|
|
If the specified user is a member of too many groups, the process
|
|
is initialized with the maximum-allowed groups: the remaining groups
|
|
are silently discarded by the system. A special situation occurs when
|
|
.I initgroups
|
|
is called on systems with multiple groups disabled (i.e., \f2ngroups_max\fP
|
|
in <\f3/var/sysgen/master.d/kernel\fP> set to 0): in this case
|
|
.I initgroups
|
|
returns \-1 and \f2errno\fP is set to \f3\s-1EINVAL\s+1\fP.
|
|
.SH "ERRORS
|
|
The
|
|
.I initgroups
|
|
call will fail if:
|
|
.TP 15
|
|
.SM
|
|
\%[EPERM]
|
|
The caller is not the super-user.
|
|
.TP 15
|
|
.SM
|
|
\%[EINVAL]
|
|
The multiple-group facility is disabled on the system.
|
|
.SH BUGS
|
|
.I initgroups
|
|
uses the routines based on
|
|
.IR getgrent (3).
|
|
If the invoking program uses any of these routines,
|
|
the group structure will
|
|
be overwritten in the call to
|
|
.IR initgroups .
|