Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


setgroups — set group access list


#include <unistd.h>

int setgroups(int ngroups, const gid_t *gidset);


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 systems that support fine-grained privileges.


Upon successful completion, setgroups() returns 0; otherwise it returns -1 and sets errno to indicate the error.


setgroups() fails if any of the following conditions are encountered:


The caller is not a user with the CHSUBJIDENT privilege and has attempted to set new groups.


The address specified for gidset is outside the process address space. The reliable detection of this error is implementation dependent.


ngroups is greater than sysconf(_SC_NGROUPS_MAX) or not positive.


An entry in gidset is not a valid group ID.


setgroups() was developed by the University of California, Berkeley.


setgroups(): AES, SVID3

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.