ldap - 将 ldif 文件导入 OpenLDAP 服务器

标签 ldap openldap

我刚刚安装了 OpenLDAP,并尝试将 ldif 文件导入到我的 LDAP 服务器,但收到此消息错误:

5369fd49 hdb_db_open: database "dc=04": database already in use.
5369fd49 backend_startup_one (type=hdb, suffix="dc=04"): bi_db_open failed! (-1)
slap_startup failed

这是我的 ldif 文件:

dn:dc=tpw,dc=uca,dc=ma
dc: uca
objectClass: dcObject
objectClass: top
objectClass: domain
structuralObjectClass: domain
entryUUID: 1857816a-1f80-1032-852e-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312164613Z
entryCSN: 20130312164613.519557Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312164613Z

dn: ou=people,dc=tpw,dc=uca,dc=ma
ou: people
objectClass: organizationalUnit
objectClass: top
structuralObjectClass: organizationalUnit
entryUUID: 2d4d29b2-1f80-1032-852f-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312164648Z
entryCSN: 20130312164648.683888Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312164648Z

dn: ou=groupes,dc=tpw,dc=uca,dc=ma
ou: groupes
objectClass: organizationalUnit
objectClass: top
structuralObjectClass: organizationalUnit
entryUUID: 42a4d12a-1f80-1032-8530-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312164724Z
entryCSN: 20130312164724.490529Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312164724Z

dn: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
uid: admin
sn: Admin
cn: Admin
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
structuralObjectClass: inetOrgPerson
entryUUID: 6b1ddf48-1f80-1032-8531-4da7bdf172d2
creatorsName: cn=Manager,dc=uca,dc=ma
createTimestamp: 20130312164832Z
userPassword:: e1NIQX0wRFBpS3VOSXJyVm1EOElVQ3V3MWhReE5xWmM9
mail: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="95f4f1f8fcfbd5e0f6f4bbf8f4" rel="noreferrer noopener nofollow">[email protected]</a>
givenName: admin
entryCSN: 20130312165133.498240Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165133Z

dn: cn=GI,ou=groupes,dc=tpw,dc=uca,dc=ma
uniquemember: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
cn: GI
objectClass: groupOfUniqueNames
objectClass: top
structuralObjectClass: groupOfUniqueNames
entryUUID: a165e4ec-1f80-1032-8532-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312165003Z
entryCSN: 20130312165003.461713Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165003Z

dn: cn=GP,ou=groupes,dc=tpw,dc=uca,dc=ma
uniquemember: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
cn: GP
objectClass: groupOfUniqueNames
objectClass: top
structuralObjectClass: groupOfNames
entryUUID: aaf44eb8-1f80-1032-8534-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312165019Z
entryCSN: 20130312165019.494529Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165019Z

dn: cn=GT,ou=groupes,dc=tpw,dc=uca,dc=ma
uniquemember: uid=admin,ou=people,dc=tpw,dc=uca,dc=ma
cn: GT
objectClass: groupOfUniqueNames
objectClass: top
structuralObjectClass: groupOfNames
entryUUID: b09d6660-1f80-1032-8536-4da7bdf172d2
creatorsName: cn=Manager,dc=tpw,dc=uca,dc=ma
createTimestamp: 20130312165028Z
entryCSN: 20130312165028.991299Z#000000#000#000000
modifiersName: cn=Manager,dc=tpw,dc=uca,dc=ma
modifyTimestamp: 20130312165028Z

这是我的 slapd.conf 文件:

# Allow LDAPv2 binds
allow bind_v2

# Allow LDAPv2 binds
# allow bind_v2

# This is the main slapd configuration file. See slapd.conf(5) for more
# info on the configuration options.

#######################################################################
# Global Directives:

# Features to permit
#allow bind_v2


modulepath      /usr/lib/ldap
moduleload back_hdb
#moduleload refint
#moduleload rwm

# Schema and objectClass definitions
include         /etc/ldap/schema/core.schema
include         /etc/ldap/schema/cosine.schema
include         /etc/ldap/schema/nis.schema
include         /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/openldap.schema



# Schema check allows for forcing entries to
# match schemas for their objectClasses's
#schemacheck     off

# Where the pid file is put. The init.d script
# will not stop the server if you change this.
pidfile         /var/run/slapd/slapd.pid

# List of arguments that were passed to the server
argsfile        /var/run/slapd/slapd.args

# Read slapd.conf(5) for possible values
#loglevel        65389


#######################################################################
# Specific Backend Directives for bdb:
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
backend     hdb

#######################################################################
# Specific Backend Directives for 'other':
# Backend specific directives apply to this backend until another
# 'backend' directive occurs
#backend        <other>

#######################################################################
# Specific Directives for database #1, of type bdb:
# Database specific directives apply to this databasse until another
# 'database' directive occurs
database        hdb

# The base of your directory in database #1
suffix          "dc=tpw,dc=uca,dc=ma"
checkpoint 512 30
rootdn      "cn=Manager,dc=tpw,dc=uca,dc=ma"
rootpw      "admin"



# Where the database file are physically stored for database #1
directory       "/var/lib/ldap"

# Indexing options for database #1
index           objectClass eq
index       cn eq
index       ou eq

# Save the time that the entry gets modified, for database #1
lastmod         on

# Where to store the replica logs for database #1
# replogfile    /var/lib/ldap/replog

# The userPassword by default can be changed
# by the entry owning it if they are authenticated.
# Others should not be able to see it, except the
# admin entry below
# These access lines apply to database #1 only
access to attrs=userPassword
        by dn="cn=Manager,dc=tpw,dc=uca,dc=ma" write
        by anonymous auth
        by self write
        by * none

# Ensure read access to the base for things like
# supportedSASLMechanisms.  Without this you may
# have problems with SASL not knowing what
# mechanisms are available and the like.
# Note that this is covered by the 'access to *'
# ACL below too but if you change that as people
# are wont to do you'll still need this if you
# want SASL (and possible other things) to work 
# happily.
access to dn.base="" by * read

# The admin dn has full write access, everyone else
# can read everything.
access to *
        by dn="cn=Manager,dc=tpw,dc=uca,dc=ma" write
        by * read

# For Netscape Roaming support, each user gets a roaming
# profile for which they have write access to
#access to dn=".*,ou=Roaming,o=morsnet"
#        by dn="cn=Manager,dc=localdomain" write
#        by dnattr=owner write

如何解决这个问题?

最佳答案

在您尝试使用 slapadd 导入 LDIF 时,LDAP 服务似乎正在运行。关闭 LDAP,然后重试。

关于ldap - 将 ldif 文件导入 OpenLDAP 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23514178/

相关文章:

java - 使用用户名使用 UnboundID 对 Active Directory 用户进行身份验证

java - BeanCreationException : Invocation of init method failed

JAVA : How to add more than one member to a group in LDAP

linux - Apache 目录工作室的 Openldap 命名上下文问题?

ubuntu - 如何使用 OpenLDAP 启用 SASL 身份验证 - 缺少 nsContainer objectClass

linux - 比较两个 LDAP 服务器的内容

php ldap-bind 密码过期

ldap - 向 OpenLDAP 添加条目

openldap - ldap_add : Insufficient access (50)

java - 使用 Java 从 LDAP 检索所有用户及其角色