使用nsswitch compat的缺点是什么?

在我当前的LDAP设置中,“getent passwd”显示LDAP中存在的所有600多个用户,而不是仅枚举有权访问此networking组/服务器的20个LDAP用户。

这可以通过compat模式来解决,以过滤用户:

nsswitch.conf passwd: files compat passwd_compat: ldap in passwd file, add +@netgroup. 

我想知道,使用这个nsswitch compat模式有什么缺点?

许多东西会认为你使用NIS(坏因为几个原因),这是compat真正的意思(你可以使用NIS语法像+ @ netgroup等)。 我假设你实际上并没有在这些盒子上使用YP,而是手动(或使用木偶或其他)创build相关文件。 在这种情况下,我没有看到一个主要的缺点,只是一些额外的configuration,你需要留意可兼容性(没有双关语意图)。 你可能会得到相同的结果,在你的ldap.conf中设置一个filter,它应该更加向前兼容。

与+/-语法的交互(compat模式)

没有NYS的Linux libc5没有名称服务切换,但允许用户进行一些策略控制。 在/ etc / passwd中,可以使用+ user或+ @ netgroup(从NIS passwd映射包含指定的用户),-user或 – @ netgroup(不包括指定的用户)和+(包括每个用户,除了被排除的那些,从NIS passwd映射)。 由于大多数人只在/ etc / passwd末尾加上+来包含NIS的所有内容,因此交换机为这种情况提供了一个更快的select( passwd: files nis') which doesn't require the single + entry in /etc/passwd, /etc/group, and /etc/shadow. If this is not sufficient, the NSS passwd: files nis') which doesn't require the single + entry in /etc/passwd, /etc/group, and /etc/shadow. If this is not sufficient, the NSS compat的服务提供完整的+/-语义。 默认情况下,源是nis', but this may be overriden by specifying nisplus'作为伪数据库passwd_compat,group_compat和shadow_compat的源nis', but this may be overriden by specifying 。 这个伪数据库仅在GNU C库中可用。