17

We've recently run into a situation at a group-happy site where some group memberships are not being picked up. I seem to remember that there is an upper limit to the number of groups that a user can be a member of.

While I am specifically interested in modern Linux systems, I also remember that for some older versions of some OSs that number is lower?

19

The specific answer seems to be:

...which explains our problem, we've recently crossed the 16-group boundary for some users.

| improve this answer | |
  • 1
    Interesting, wasn't aware of that limitation. – theotherreceive Aug 21 '09 at 3:22
  • 1
    The 16 groups per user limit is part of the sunRPC mechanism used for NFS (<4?). See RFC1057 "9.2 UNIX Authentication" – ikrabbe Jun 2 '16 at 5:45
  • 1
    link to nfs group limit is broken – Tagar Sep 26 '16 at 15:55
9

For Linux Kernel 2.6.3 and above the limit is 64k groups per user.

If you are using NFSv4 the limit is higher than 16, too. (not sure about exact numbers here)

| improve this answer | |
4

Look for NGROUPS_MAX in limits.h to find the value on your system.

I think this is a tunable parameter in a modern Linux kernel. (Used to be 16 on Solaris, I don't know if they have fixed that yet.)

| improve this answer | |
  • Just checked a Solaris 11 server, not it is not fixed there - still 16 :-( – Tagar Sep 27 '16 at 18:04
  • 1
    You can also use getconf NGROUPS_MAX to receive this value from a shell. – MaPePeR Oct 31 '18 at 7:47
2

You can overcome the 16 group limit for NFS on RHEL/CentOS/Fedora by updating the following setting in /etc/sysconfig/nfs:

RPCMOUNTDOPTS="--manage-gids"
| improve this answer | |
0

According to this: sysconf(3)

#include <stdio.h>
#include <unistd.h>

int main(int argc, char** argv) {
    long max_group = 0;
    max_group = sysconf(_SC_NGROUPS_MAX);
    printf("Max group : %ld\n", max_group);
    return 0;
}

in the shell :

gcc -Wall -pedantic-errors -o maxgroup maxgroup.c
| improve this answer | |
  • Can you explain why someone needs to compile a C program to get these values? – Giacomo1968 Jul 8 at 0:18
  • Because it's system-specific and subject to change? – Mikel yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.