一、安装
yum install openldap openldap-servers
二、配置LDAP主配置文件/etc/openldap/slapd.conf
database bdb #使用的资料
suffix "dc=tony,dc=com" #目录管理员#
rootdn "cn=admin,dc=tony,dc=com"#根域名#
# Cleartext passwords, especially for the rootdn,
# be avoided. See slappasswd(8) and slapd.conf(5)
# Use of strong authentication encouraged.
rootpw 123456 #设置密码#
三、生成数据的模版/usr/share/openldap/migration
vim /usr/share/openldap/migration/migrate_common.ph
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = "tony.com";
# Default base
$DEFAULT_BASE = "dc=tony,dc=com";
四、生成top domain ou
./migrate_base.pl > /tmp/tony.ldif
五、生成用户和组数据
先建立好用户和密码(分别建立了tony1,tony2,tony3)
grep tony /etc/passwd > /tmp/user
grep tony /etc/group > /tmp/group
./migrate_passwd.pl /tmp/user > /tmp/user.ldif
./migrate_group.pl /tmp/user > /tmp/group.ldif
六、导数据
/etc/init.d/ldap stop
cp /etc/openldap/DB_CONFIG.example
chown ldap.ldap DB_CONFIG
slapadd -vl /tmp/tony.ldif
slapadd -vl /tmp/user.ldif
slapadd -vl /tmp/group.ldif
/etc/init.d/ldap start
七、实验ldap客户端
在系统-->管理-->验证
su: warning: cannot change directory to /home/tony1: 没有那个文件或目录
-bash-3.2$