在 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
?您是否以可以读取该文件的用户身份运行这些命令?