HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)

s
setgroups(2) setgroups(2)
NAME
setgroups - set group access list
SYNOPSIS
#include <unistd.h>
int setgroups(int ngroups, const gid_t *gidset);
DESCRIPTION
setgroups() sets the group access list of the current user process according to the array gidset. The
parameter ngroups indicates the number of entries in the array and must be no more than
sysconf(_SC_NGROUPS_MAX)
.
Only a user with the
CHSUBJIDENT privilege can set new groups by adding to the group access list of the
current user process; any user can delete groups from it.
Security Restrictions
Some or all of the actions associated with this system call require the
CHSUBJIDENT privilege. Processes
owned by the superuser have this privilege. Processes owned by other users may have this privilege,
depending on system configuration. See privileges (5) for more information about privileged access on sys-
tems that support fine-grained privileges.
RETURN VALUE
Upon successful completion,
setgroups() returns 0; otherwise it returns 1 and sets errno to indicate
the error.
ERRORS
setgroups() fails if any of the following conditions are encountered:
[EPERM] The caller is not a user with the CHSUBJIDENT privilege and has attempted to set
new groups.
[EFAULT] The address specified for gidset is outside the process address space. The reliable
detection of this error is implementation dependent.
[EINVAL] ngroups is greater than
sysconf(_SC_NGROUPS_MAX)
or not positive.
[EINVAL] An entry in gidset is not a valid group ID.
AUTHOR
setgroups() was developed by the University of California, Berkeley.
SEE ALSO
getgroups(2), initgroups(3C), privileges(5).
STANDARDS CONFORMANCE
setgroups() : AES, SVID3
394 Hewlett-Packard Company 1 HP-UX 11i Version 3: February 2007