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
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).