我在 centos7 上设置 OpenLDAP,并且在添加第一个用户时似乎遇到错误。
[root@web1 ~]# ldapadd -x -W -D "cn=Manager,dc=web1,dc=com" -f /root/rootuser.ldif
Enter LDAP Password:
adding new entry "uid=ldapuser,ou=People,dc=web1,dc=com"
ldap_add: No such object (32)
matched DN: dc=web1,dc=com
我已成功添加 base.ldif 文件,现在需要添加人员和组文件。
[root@web1 ~]# ldapadd -x -W -D "cn=Manager,dc=web1,dc=com" -f /root/base.ldif
Enter LDAP Password:
adding new entry "dc=web1,dc=com"
ldap_add: Already exists (68)
基础文件:
[root@web1 ~]# cat base.ldif
dn: dc=web1,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: web1 com
dc: web1
dn: cn=Manager,dc=web1,dc=com
objectClass: organizationalRole
cn: Manager
Description: Directory Manager
dn: ou=People,dc=web1,dc=com
objectClass: organizationalUnit
ou: People
dn: ou=Group,dc=web1,dc=com
objectClass: organizationalUnit
ou: Group
根用户.ldif
[root@web1 ~]# cat rootuser.ldif
dn: uid=ldapuser,ou=People,dc=web1,dc=com
uid: ldapuser
cn: ldapuser
sn: ldapuser
mail: [email protected]
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}$1$0ck/7MvX$VkTriVqcFOnsoIhF1TzTt1
shadowLastChange: 17223
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1003
gidNumber: 1004
homeDirectory: /home/ldapuser
根组.ldif
[root@web1 ~]# cat rootgroup.ldif
dn: cn=ldapuser,ou=Group,dc=web1,dc=com
objectClass: posixGroup
objectClass: top
cn: ldapuser
userPassword: {crypt}x
gidNumber: 1004
dc 的 Ldap 搜索结果
[root@web1 ~]# ldapsearch -hlocalhost -x -sbase | grep '^dn:'
dn: dc=web1,dc=com
我无法确定导致此错误的原因。