首页 > 代码库 > php ldap
php ldap
参考链接:
http://blog.csdn.net/guoyuqi0554/article/details/11015403
http://blog.csdn.net/qk1992919/article/details/51249099
1.安装
sudo apt install slapd ldap-utils
2.配置
#dpkg-reconfigure slapd
大致如下:
代码:
Omit OpenLDAP server configuration? ... No
DNS domain name: ... debuntu.local //根据自己需要输入,但必须和后面的相关地方保持一致
Name of your organization: ... Whatever & Co
Admin Password: XXXXX
Confirm Password: XXXXX
OK
BDB
Do you want your database to be removed when slapd is purged? ... No
Move old database? ... Yes
Allow LDAPv2 Protocol? ... No
DNS domain name: ... debuntu.local //根据自己需要输入,但必须和后面的相关地方保持一致
Name of your organization: ... Whatever & Co
Admin Password: XXXXX
Confirm Password: XXXXX
OK
BDB
Do you want your database to be removed when slapd is purged? ... No
Move old database? ... Yes
Allow LDAPv2 Protocol? ... No
3.查询配置情况
ldapsearch -x -LLL -H ldap:/// -b dc=debuntu,dc=local dn
输出结果:
dn: dc=debuntu,dc=local
dn: cn=admin,dc=debuntu,dc=local
4.编辑文件add_content.ldif
内容如下:
dn: ou=People,dc=debuntu,dc=local
objectClass: organizationalUnit
ou: People
dn: ou=Groups,dc=debuntu,dc=local
objectClass: organizationalUnit
ou: Groups
dn: cn=miners,ou=Groups,dc=debuntu,dc=local
objectClass: posixGroup
cn: miners
gidNumber: 5000
dn: uid=john,ou=People,dc=debuntu,dc=local
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: john
sn: Doe
givenName: John
cn: John Doe
displayName: John Doe
uidNumber: 10000
gidNumber: 5000
userPassword: johnldap
gecos: John Doe
loginShell: /bin/bash
homeDirectory: /home/john
5.执行命令
ldapadd -x -D cn=admin,dc=debuntu,dc=local -W -f add_content.ldif
结果如下:
dn: dc=debuntu,dc=local
dn: cn=admin,dc=debuntu,dc=local
dn: ou=People,dc=debuntu,dc=local
dn: ou=Groups,dc=debuntu,dc=local
dn: cn=miners,ou=Groups,dc=debuntu,dc=local
dn: uid=john,ou=People,dc=debuntu,dc=local
注意:上面的输出都有了,就表明安装配置成功
php ldap
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。