错误描述:
[root@AY140516110421750f8eZ bin]# ./ldapadd -x
-D "cn=Manager,dc=example,dc=com" -w secret -f
init.ldif
ldapadd: attributeDescription "dn": (possible missing newline
after line 7, entry "dc=example,dc=com"?)
adding new entry "dc=example,dc=com"
ldap_add: Undefined attribute type (17)
additional info: dn: attribute type
undefined
解决方法:
1.遇见的两个错误及其原因
ldap_add: Invalid syntax (21)
additional info: objectclass: value #0 invalid
per syntax
原因:ldif文件中存在空格
ldap_add: Undefined attribute type (17)
additional info: dn: attribute type undefined
原因:should put an empty line in the ldif file between two
entries
2.正确书写格式:
(1空行)
dn:(空格) dc=mail,dc=kaspersky,dc=com(结尾无空格)
objectclass: (空格)dcObject(结尾无空格)
objectclass: (空格)organization(结尾无空格)
o: (空格)kaspersky(结尾无空格)
dc:(空格) test(结尾无空格)
(1空行)
dn: (空格)cn=test,dc=mail,dc=kaspersky,dc=com(结尾无空格)
objectclass: (空格)organizationalRole(结尾无空格)
cn: (空格)test(结尾无空格)
(结尾无空行)
[root@AY140516110421750f8eZ bin]# cat -A
init.ldif
dn: dc=example,dc=com$
objectClass: dcObject$
objectClass: organization$
dc: example$
o: Example Company$
$
dn: cn=Manager,dc=example,dc=com$
objectClass: organizationalRole$
objectClass: top$
cn: Manager$
$
dn: ou=it,dc=example,dc=com$
objectClass: top$
objectClass: organizationalUnit$
ou: it$
$
dn: ou=hr,dc=example,dc=com$
objectClass: top$
objectClass: organizationalUnit$
ou: it$
看到空行前的空格了吧?删掉就可以了!!!
加载中,请稍候......