ngroups_max.5 (2010 09)

m
ngroups_max(5) ngroups_max(5)
(Tunable Kernel Parameters)
Dont associate users with more than 20 groups if they must run older applications.
An individual user may require more than 20 groups, but have some applications which fail with more
than 20 groups.
One workaround is to start those applications with a wrapper program which truncates the list of sup-
plementary group IDs to the first 20 groups and then invokes the application.
An example of such a wrapper program follows:
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
main (int argc, char **argv)
{
gid_t *list;
int ngroups;
int ret;
ngroups = getgroups(0, NULL);
if (ngroups > NGROUPS_MAX) {
list = (gid_t *)malloc(ngroups * sizeof(gid_t));
ngroups = getgroups(ngroups, list);
ret = setgroups(NGROUPS_MAX, list);
if (ret == -1) {
perror("setgroups");
exit(-1);
}
}
execvp(argv[1], &argv[1]);
perror("execvp");
exit(-1);
}
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its
meaning changed in future releases of HP-UX.
Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parame-
ter values. After installation, some tunable parameters may no longer be at the default or recommended
values. For information about the effects of installation on tunable values, consult the documentation for
the kernel software being installed. For information about optional kernel software that was factory
installed on your system, see HP-UX Release Notes at
http://www.hp.com/go/hpux-core-docs
.
AUTHOR
ngroups_max was developed by HP.
SEE ALSO
getconf(1), groupadd(1M), groupmod(1M), kctune(1M), useradd(1M), usermod(1M), getaccess(2), get-
groups(2), setgroups(2), sysconf(2), group(4), limits(5), glossary(9).
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010