Linux
-
下载
OpenLDAP
:sudo apt update sudo apt install slapd ldap-utils sudo apt install ldap-utils
-
配置
OpenLDAP
:sudo dpkg-reconfigure slapd
DNS domain name:
example.org
Password:
root
-
创建
user.ldif
:# ldap是username dn: uid=ldap,dc=example,dc=org objectClass: inetOrgPerson objectClass: posixAccount uid: ldap sn: LDAP givenName: LDAP cn: LDAP User displayName: LDAP User uidNumber: 10000 gidNumber: 10000 homeDirectory: /home/ldap loginShell: /bin/bash
-
把
user
加入OpenLDAP
服务器:ldapadd -x -D "cn=admin,dc=example,dc=org" -W -f user.ldif
-
启动和查看
OpenLDAP
的状态:sudo systemctl start slapd sudo systemctl status slapd
-
查看当前已有的用户:
ldapsearch -x -LLL -b "dc=example,dc=org" "(objectclass=inetOrgPerson)" uid userPassword
-
修改用户密码:
ldappasswd -x -D "cn=admin,dc=example,dc=org" -W -S "uid=ldap,dc=example,dc=org"