Raising the limit for number of groups

On FreeBSD a user may only have a fixed amount of groups. The maximum amount of group is set, according to setgroups(2) to NGROUPS which is defined in . Typically this value is set to 16.

If you need to have more groups per user, you need to edit the default value. You do not need to edit the FreeBSD source code, though. The NGROUPS variable is a dynamic kernel variable that can be set via the sysctl interface. You can change the value with

sysctl -w kern.ngroups=n

where _n is the desired number of groups you want to have. To make the chang permanent, you need to enter this value into your /etc/sysctl.conf.