Centos – could not stat config file “slapd.conf” to add entries to LDAP

centosldapopenldapshell

I got a problem when I adding some entries in 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

and here is the error

could not stat config file "slapd.conf": No such file or directory (2)
slapadd: bad configuration file!

and

/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

Best Answer

I'm going to assume that the -f argument expects an absolute path to the file and interprets the path as relative otherwise. Are you running those commands from in /etc/openldap? Does using slapadd -l /etc/openldap/root.ldif -f /etc/openldap/slapd.conf -d 10 work? Are you running the commands as a user that can read that file?

Related Topic