下载openLDAP for windows
安装后运行
slapadd -v -l ./test.ldif
运行前请清空 data folder
test.ldif 为
dn: o=tt,c=cn
objectClass: dcObject
objectClass: organization
o: tt
dc: com
dn: uid=sa, o=tt,c=cn
uid: sa
objectClass: inetOrgPerson
mail: [email protected]
userPassword: intec
labeledURI: http://www.nfschina.com
sn: sa-sn
cn: sa-cn
条件是必须停掉服务
增加命令
slapadd -l test1.ldif
查询, 命令
ldapsearch -x -D "cn=Manager,o=tt,c=cn" -w secret -b "o=tt,c=cn"
# extended LDIF
#
# LDAPv3
# base <o=tt,c=cn> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# tt, cn
dn: o=tt,c=cn
objectClass: dcObject
objectClass: organization
o: tt
dc: com
# sa, tt, cn
dn: uid=sa,o=tt,c=cn
uid: sa
objectClass: inetOrgPerson
mail: [email protected]
userPassword:: aW50ZWM=
labeledURI: http://www.nfschina.com
sn: sa-sn
cn: sa-cn
# search result
search: 2
result: 0 Success
# numResponses: 3
# numEntries: 2
修改命令
node1:/usr/lib/openldap # ldapmodify -x -D "cn=Manager,o=tt,c=cn" -w secret -f modify.ldif
modifying entry "uid=sa, o=tt,c=cn"
删除命令
node1:/var/lib/ldap # ldapdelete -x -D "cn=Manager,o=tt,c=cn" -w secret "uid=sa,o=tt,c=cn"
node1:/var/lib/ldap # ldapsearch -x -D "cn=Manager,o=tt,c=cn" -w secret -b "o=tt,c=cn"
# extended LDIF
#
# LDAPv3
# base <o=tt,c=cn> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# tt, cn
dn: o=tt,c=cn
objectClass: dcObject
objectClass: organization
o: tt
dc: com
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1