23.2. 使用组条目创建 LDIF 文件
使用 dsctl ldifgen groups 命令创建带有示例组条目的 LDIF 文件。例如,要创建一个名为
/tmp/groups.ldif
的 LDIF 文件,它将 500 个组添加到 ou=groups,dc=example,dc=com 条目,并且每个组都有 100 个成员,请输入:
dsctl instance_name ldifgen groups --number 500 --suffix "dc=example,dc=com" --parent "ou=groups,dc=example,dc=com" --num-members 100 --create-members --member-parent "ou=People,dc=example,dc=com" --ldif-file /tmp/group.ldif example
# dsctl instance_name ldifgen groups --number 500 --suffix "dc=example,dc=com" --parent "ou=groups,dc=example,dc=com" --num-members 100 --create-members --member-parent "ou=People,dc=example,dc=com" --ldif-file /tmp/group.ldif example
请注意,该命令还会创建 LDIF 语句,以添加 ou=People,dc=example,dc=com 中的用户条目。
重要
如果您创建大型组并使用
ldapmodif
工具添加组,您可以超过最大基本编码规则(BER)大小限制,导入会失败。在本例中,增加 cn=config 条目中的 nsslapd-maxbersize
参数的值。
有关创建 LDIF 文件后可以使用的详情和其他选项,请输入:
dsctl instance_name ldifgen groups --help
# dsctl instance_name ldifgen groups --help