参考:
搭建ldap:https://www.cnblogs.com/zhaijunming5/p/9522756.html
搭建phpldapadmin:https://blog.csdn.net/weiyile0829/article/details/83419148
注意:
1.登录时出现:
ldap_bind: Invalid credentials (49)
如果用户名没错,就是密码错了
修改密码:可将rootpwd.ldif文件内容中的add换成replace;
2.出现:
ldap_modify: Inappropriate matching (18)
additional info: modify/add: olcRootPW: no equality matching rule
是因为之前已经设置密码了,修改就行
可将rootpwd.ldif文件内容中的add换成replace;
只要是第一次操作属性add,第二次以后要改为replace
3.如果要修改账号信息
到这里改
[root@localhost ldap-file]# ll
-rw-r--r--. 1 root root 385 2月 19 17:54 basedomain.ldif
-rw-r--r--. 1 root root 895 2月 19 17:57 domain.ldif
-rw-r--r--. 1 root root 124 2月 19 17:12 rootpwd.ldif
4.配置ldap时,写的ldif,解释一下
配置是通过ldapmodify命令执行一系列自己写好的ldif文件,而不要修改任何OpenLDAP装好的配置文件。
5.在配置文件创建的组People,Group无法创建用户
删除了,重新创建组,就可以创建用户了。
6.贴下下配置文件:
rootpwd.ldif
dn: olcDatabase={0}config,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}5D3SOGrrHBJZFLtrIPUPpgKrS7clIB3s
domain.ldif
#权限控制
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth"
read by dn.base="cn=Manager,dc=liuzhihui,dc=com" read by * none
#定义根节点
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=liuzhihui,dc=com
#定义有superUser权限的根命名用户
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=Manager,dc=liuzhihui,dc=com
#定义root密码
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}6k1oS0G662HhnA39enTFak6H04m/BNwf
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange by
dn="cn=Manager,dc=liuzhihui,dc=com" write by anonymous auth by self write by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * by dn="cn=Manager,dc=liuzhihui,dc=com" write by * read
basedomain.ldif
#编辑组织单位名称
dn: dc=liuzhihui,dc=com
objectClass: top
objectClass: dcObject
objectclass: organization
o: liuzhihui com
dc: liuzhihui
#目录管理员
dn: cn=Manager,dc=liuzhihui,dc=com
objectClass: organizationalRole
cn: Manager
description: Directory Manager
#添加组织单元
dn: ou=People,dc=liuzhihui,dc=com
objectClass: organizationalUnit
ou: People
#添加组织单元
dn: ou=Group,dc=liuzhihui,dc=com
objectClass: organizationalUnit
ou: Group