Linux 中的群组容量

Linux 中的群组容量

Linux(Ubuntu/Red Hat)中可以将多少用户添加到特定组?在实验室中设置的 NFS 网络中,当用户数量超过一定数量时,文件/所有权权限就会变得混乱,组成员无法访问相应的文件。我们可以扩展此限制吗?应该做些什么来增加该组的容量?

答案1

Linux 系统上用户可以加入的组数量确实是有限的NGROUPS_MAX。但这是一个可调设置;在中查找limits.h。Linux 内核 2.6.3+ 将其设置为 65536。

/usr/include/linux$ grep NGROUP limits.h
#define NGROUPS_MAX    65536    /* supplemental group IDs are available */

但是 NFS(v4) 还有另一个限制,而且这个限制要低得多:16这不是 NFS 的限制auth_sys

我们可以延长这个限制吗?

来自链接:

有史以来最好的解决方案!:NFS 服务器的新选项

我希望这是您第一次遇到此问题后阅读的第一件事。我希望您不必阅读本页上的任何其他“解决方案”。我希望您没有浪费时间做其他解决方法。我希望您处于能够使用此解决方案的环境中:

rpc.mountd --manage-gids

rpc.mountd 是实际为 nfs 服务的程序。–manage-gids 选项允许服务器完全忽略来自客户端的传入虚假 16 个组,并允许 nfs 服务器自行查找。直接来自手册页:

   -g  or  --manage-gids
          Accept requests from the kernel to  map  user  id  numbers  into
          lists  of  group  id  numbers for use in access control.  An NFS
          request will normally (except when using Kerberos or other cryp-
          tographic  authentication)  contains  a  user-id  and  a list of
          group-ids.  Due to a limitation in the NFS protocol, at most  16
          groups ids can be listed.  If you use the -g flag, then the list
          of group ids received from the client will be replaced by a list
          of  group ids determined by an appropriate lookup on the server.

您必须拥有现代版本 (2007 年以后) (>1.0.12) 的 Linux NFS 服务器才能使用此选项,并且必须拥有与之配合使用的最新内核 (>2.6.21)。大多数现代发行版都可以做到这一点,但如果您使用的是 Solaris 或某种嵌入式 NFS 设备,那么您可能就没那么幸运了。

在现代 Ubuntu 服务器上,此选项默认启用。查看发行版上的文档,了解如何正确启用它。然后开派对。我可以停止写这篇博文了,因为每个人都在为他们的 NFS 服务器运行现代版本的 Linux,对吧?:)

相关内容