in Linux

RHEL6 LDAP server configuration issue and solve

Summary

Encountered quite a few problems when configure LDAP simple server on RHEL6, resolved all the issues through the internet. Refer to the reference link for more detail.

Problem and resolve

no DB_CONFIG file

bdb_db_open: warning - no DB_CONFIG file found in directory /var/lib/ldap: (2).
By copy the DB file to the relative folder, solved this issue.

[root@www openldap]# rm -rf /etc/openldap/slapd.d/*
[root@www openldap]# ls /etc/openldap/slapd.d/
[root@www openldap]# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@www openldap]# chown -R ldap:ldap /var/lib/ldap/
[root@www openldap]# chown -R ldap:ldap /etc/openldap/slapd.d

db_open(/var/lib/ldap/id2entry.bdb) failed: No such file or directory (2)

[root@www openldap]# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/
bdb_db_open: DB_CONFIG for suffix "dc=xionghuilin,dc=com" has changed.
Performing database recovery to activate new settings.
bdb_db_open: database "dc=xionghuilin,dc=com": recovery skipped in read-only mode. Run manual recovery if errors are encountered.
bdb_db_open: database "dc=xionghuilin,dc=com": db_open(/var/lib/ldap/id2entry.bdb) failed: No such fileor directory (2).
backend_startup_one (type=bdb, suffix="dc=xionghuilin,dc=com"): bi_db_open failed! (2)
slap_startup failed (test would succeed using the -u switch)

At least run slapd once, this issue will be resolved.

[root@www openldap]# /etc/init.d/slapd start
Starting slapd:                                            [  OK  ]

See the result:

[root@www openldap]# ls /etc/openldap/slapd.d/
cn=config  cn=config.ldif
[root@www openldap]# ls /var/lib/ldap/
alock     __db.002  __db.004  __db.006   dn2id.bdb     log.0000000001
__db.001  __db.003  __db.005  DB_CONFIG  id2entry.bdb

Permission denied for “/etc/openldap/slapd.d/cn=config.ldif”

[root@www openldap]# /etc/init.d/slapd start
Checking configuration files for slapd:                    [FAILED]
ldif_read_file: Permission denied for "/etc/openldap/slapd.d/cn=config.ldif"
slaptest: bad configuration file!

Refer to this Link and this Link, change the ownership of the /etc/openldap/slapd.d

[root@www openldap]# chown -R ldap.ldap /etc/open
openct.conf  openldap/
[root@www openldap]# chown -R ldap.ldap /etc/openldap/slapd.d
[root@www openldap]# /etc/init.d/slapd start
Starting slapd:                                            [  OK  ]

Successful result

[root@www openldap]# slaptest -f /etc/openldap/slapd.conf
config file testing succeeded
[root@www openldap]# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/
config file testing succeeded

Reference

ldap安装配置过程中遇到的错误,以及解决方法
[网络配置] [已解决]===配置LDAP的问题===
RHEL6配置简单LDAP服务器-基于TLS加密和NFS的用户家目录自动挂载
RHCE6 中 openLDAP服务器简易配置


Write a Comment

Comment