![无法统计配置文件“slapd.conf”以将条目添加到 LDAP](https://linux22.com/image/614215/%E6%97%A0%E6%B3%95%E7%BB%9F%E8%AE%A1%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E2%80%9Cslapd.conf%E2%80%9D%E4%BB%A5%E5%B0%86%E6%9D%A1%E7%9B%AE%E6%B7%BB%E5%8A%A0%E5%88%B0%20LDAP.png)
在 LDAP 中添加一些条目时遇到问题
slapadd -l /etc/openldap/root.ldif -f slapd.conf -d 10
slapadd -l /etc/openldap/people.ldif -f slapd.conf -d 10
slapadd -l /etc/openldap/testuser.ldif -f slapd.conf -d 10
这是错误
无法统计配置文件“slapd.conf”:没有此文件或目录 (2) slapadd:坏的配置文件!
和
/etc/openldap/slapd.conf
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/eduperson.schema
include /etc/openldap/schema/schac.schema
include /etc/openldap/schema/iris.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
database bdb
suffix "dc=example,dc=com"
rootdn "cn=admin,dc=example,dc=com"
rootpw <secretpassword>
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory /var/lib/ldap
# Indices to maintain for this database
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
答案1
我假设 -f 参数需要文件的绝对路径,否则将路径解释为相对路径。您是否在 /etc/openldap 中运行这些命令?使用有效吗slapadd -l /etc/openldap/root.ldif -f /etc/openldap/slapd.conf -d 10
?您是否以可以读取该文件的用户身份运行这些命令?