手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS下搭建LDAP服务器

[日期:2012-05-19] 来源:Linux社区  作者:zenir [字体:大 中 小]

1 安装 OpenLDAP

[root@openldap ~]# yum -y install openldap-servers openldap-clients
# generate password for ldap admin
[root@openldap ~]# slappasswd -s password -h {MD5}
# (1) remember
{MD5}*********************
[root@openldap ~]# vim /etc/openldap/slapd.conf
# line 86: specify suffix
suffix "dc=example,dc=com"
# line 87: specify admin suffix
rootdn "cn=Manager,dc=example,dc=com"
# line 93: specify password generated (1)
rootpw {MD5}************************
# add at the bottom
access to attrs=userPassword
by self write
by dn="cn=Manager,dc=example,dc=com" write
by anonymous auth
by * none
access to *
by dn="cn=Manager,dc=example,dc=com" write
by self write
by * read
[root@openldap ~]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
#
[root@openldap ~]# /etc/init.d/ldap start
Checking configuration files for slapd: /etc/openldap/slapd.conf: line 115: rootdn is always granted unlimited privileges.
/etc/openldap/slapd.conf: line 120: rootdn is always granted unlimited privileges.
config file testing succeeded
[ OK ]
Starting slapd: [ OK ]
[root@openldap ~]# chkconfig ldap on

2 查看状态

#show process
[root@openldap openldap]# ps aux | grep slapd | grep -v grep
ldap 9246 0.0 5.2 62960 27288 ? Ssl May03 0:00 /usr/sbin/slapd -h ldap:/// -u ldap
#show port
[root@openldap openldap]# netstat -ant | grep 389
tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN

3 迁移用户数据到目录服务数据库。

[root@openldap ~]#cd /usr/share/openldap/migration/
[root@openldap migration]# vim migrate_common.ph
#line 71 defalut DNS domain
$DEFAULT_MAIL_DOMAIN = "example.com";
#line 74 defalut base
$DEFAULT_BASE = "dc=example,dc=com";
#
[root@openldap migration]#./migrate_base.pl > /opt/openldap/base.ldif
#
[root@openldap migration]#ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f /opt/openldap/base.ldif
#enter passwd
#
[root@openldap migration]#./migrate_passwd.pl /etc/passwd /opt/openldap/passwd.ldif
[root@openldap migration]#ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f /opt/openldap/passwd.ldif
#
[root@openldap migration]#./migrate_passwd.pl /etc/group /opt/openldap/group.ldif
#
[root@openldap migration]#ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f /opt/openldap/group.ldif

linux
相关资讯       CentOS教程 
本文评论   查看全部评论 (3)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 3 楼
* 匿名 发表于 2013/9/5 15:18:13
ok
第 2 楼
* 匿名 发表于 2013/9/5 15:18:13
ok
第 1 楼
* 匿名 发表于 2013/7/11 17:35:54
ssssssssssssss