database bdb suffix "dc=it,dc=com" #改成你自已的目录后缀, rootdn "cn=root,dc=it,dc=com" #设置root为管理员,与linux的root没有什么关系。 # Cleartext passwords, especially for the rootdn, should # be avoid. See slappasswd(8) and slapd.conf(5) for details. # Use of strong authentication encouraged. rootpw {MD5}mjkiuPt0wXhpxxkdiOOO+0000000AKq0by #设置root密码,用MD5加密。密码串用slappasswd -h {MD5}指令生成 # The database directory MUST exist prior to running slapd AND # should only be accessible by the slapd and slap tools. # Mode 700 recommended. directory /usr/local/openldap/var/openldap-data # Indices to maintain index objectClass eq #这里可根据你的需要设置相关索引,以加快查询速度。具体内容可查询官方网站管理手册。 #ACL configure以下内容定义访问控制 access to attr=userPassworduserPassword #只能由自已修改,有效验证用户查询。 by self write by anonymous auth access to attr=mail by dn="cn=root,dc=it,dc=tigerhead" writemail #只能由自已修改,有效验证用户查询。 by self write by anonymous auth access to dn=".*,dc=it,dc=tigerhead" #允许所有人查询没受控制访问限制的信息。 by self write by * read
到现在为止,服务器基本就配置完成了,可以启动了,服务器程序是位于安装目录的libexec下的slapd程序。注意,不是sldap哦。ok,到现在为止,服务器基本就配置完成了,可以启动了,服务器程序是位于安装目录的libexec下的slapd程序。注意,不是sldap哦。启动服务器执行以下命令:
# ./slapd
如果没有提示什么出错信息,直接返回shell状态,就说明服务器正常启动了,你可以查询日志或用ps -aux查看。或用以下命令查询服务器:
ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
如果命令执行成功,返回一些信息,则说明服务器正常运行了。如果启动不成功,它会提示一些出错信息,多数是slapd.conf配置出错。回头仔细核查一下配置文档。
客户端配置文档是ldap.conf。该文档相当简单,其实不用配置也能正常操作。
# $OpenLDAP: pkg/ldap/libraries/libldap/ldap.conf,v 1.9 2000/09/04 19:57:01 kurt Exp $ # # LDAP Defaults # # See ldap.conf(5) for details # This file should be world readable but not world writable. BASE dc=it, dc=com设置目录起点 #URI ldap://ldap.example.com ldap://ldap-master.example.com:666 #SIZELIMIT 12 #TIMELIMIT 15 #DEREF never









![[Note]](http://www.ringkee.com/jims/technic_folder/linux/images/note.png)