I know Linux has some limitations for the number of groups a user can be part of. I found out that it is 16 groups for each user, and depends on the Linux kernel. However, is there any restriction for the number of users that can be part of a single group? For example, if I create a "book" group in Debian 10, how many users I can add to this group --or-- how many users can I share this group between at the same time?


The 16-group limit isn’t related to the kernel, but to NFS. On Linux, since kernel 2.6.3, processes can have up to 65,536 supplementary groups.

Going in the other direction, there isn’t any limit on the number of users in a group set by the kernel or the C library, apart from the limit imposed by the maximum group identifier (so 232 different groups in the kernel, where gids are represented by unsigned ints). The library functions and data structures used to access groups support an unlimited number of users. There can be limits set by the underlying data storage (e.g. in LDAP), but I’m not aware of any (other than disk storage, and perhaps reduced performance with large numbers of users) in /etc/passwd//etc/group.

In both cases, applications can have bugs when faced with users with lots of groups, or groups with lots of users. See this example in LXC, which meant that, when too many users were part of the same group, no rootless container could get network access (thanks to A.B for the reminder and pointer).

| improve this answer | |
  • There is a limit at 2^32 groups, because thats the max number of unique group ids on most linux kernels. – user1937198 Oct 13 at 9:40
  • 1
    Also, the limit doesn't affect all of NFS, but just the AUTH_SYS mechanism (sec=sys) and NFSv3 locking. Presumably, most people in an environment with more than 16 supplementary groups per user already run NFSv4.x with Kerberos (sec=krb5*) anyway. – TooTea Oct 13 at 11:29
  • @TooTea right, I didn’t mean to imply that any use of NFS resulted in a limit of 16 groups, I only wanted to clarify that it wasn’t kernel-related, but NFS-related. – Stephen Kitt Oct 13 at 11:46

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.