分类: LINUX
2008-08-23 11:11:44
rpm -qa |grep ldap
rpm -e --nodeps 显示的组件 |
tar zxvf db-4.5.20.tar.gz
cd db-4.5.20/build_unix ../dist/configure --prefix=/usr/local/BerkeleyDB make make install echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf ldconfig -v |
tar zxvf cyrus-sasl-2.1.21.tar.gz
cd cyrus-sasl-2.1.21 ./configure --prefix=/usr/local/sasl --enable-cram --enable-plain \ --enable-digest --disable-anon --enable-krb4 --enable-ntlm make make install echo "/usr/local/sasl/lib/" >> /etc/ld.so.conf ldconfig -v ln -sv /usr/local/sasl/include/sasl/* /usr/local/include/ ln -sv /usr/local/sasl/lib/* /usr/local/lib/ ln -sv /usr/local/sasl/lib/sasl2/* /usr/local/lib/ |
gunzip -c openldap-2.4.9.tgz | tar xvfB -
cd openldap-2.4.9 env CPPFLAGS="-I/usr/local/BerkeleyDB/include" LDFLAGS="-L/usr/local/BerkeleyDB/lib" \ ./configure --prefix=/usr/local/openldap --sysconfdir=/etc --enable-ldbm \ --enable-lmpasswd --enable-spasswd --enable-bdb --enable-ldap make depend make make install echo /usr/local/openldap/lib >> /etc/ld.so.conf ldconfig -v |
/usr/local/openldap/sbin/slappasswd -h {md5}
{MD5}X03MO1qnZdYdgyfeuILPmQ== ##此密码是LDAP管理密码,和系统密码无关 |
echo "127.0.0.1 ldap.test.com" >> /etc/hosts
echo "127.0.0.1 ldap-master.test.com" >> /etc/hosts |
vi /etc/openldap/slapd.conf
include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/nis.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args database bdb suffix "dc=test,dc=com" rootdn "cn=Manager,dc=test,dc=com" rootpw {MD5}X03MO1qnZdYdgyfeuILPmQ== directory /var/lib/ldap |
vi /etc/openldap/ldap.conf
HOST 127.0.0.1 BASE dc=test,dc=com URI SIZELIMIT 12 TIMELIMIT 15 DEREF nerver |
/usr/local/openldap/libexec/slapd |
vi test.ldif
#root node ##建立DN dn:dc=test,dc=com dc:test objectclass:dcObject objectclass:organizationalUnit ou:test Dot com #login top ##建立RDN dn:ou=login,dc=test,dc=com ou:login objectclass:organizationalUnit #user,uid,password dn:ou=user,ou=login,dc=test,dc=com ou:user objectclass:organizationalUnit #group dn:ou=group,ou=login,dc=test,dc=com ou:group objectclass:organizationalUnit #company organization top dn:ou=company,dc=test,dc=com ou:company objectclass:organizationalUnit #for company organization(unit) dn:ou=unit,ou=company,dc=test,dc=com ou:unit objectclass:organizationalUnit #human resource(under unit) dn:ou=hr,ou=unit,ou=company,dc=test,dc=com ou:hr objectclass:organizationalUnit #MIS(under unit) dn:ou=mis,ou=unit,ou=company,dc=test,dc=com ou:mis objectclass:organizationalUnit #Editorial(under unit) dn:ou=editorial,ou=unit,ou=company,dc=test,dc=com ou:editorial objectclass:organizationalUnit vi user.ldif ##建立用户数据 #User-Ben Chan dn:cn=ben,ou=editorial,ou=unit,ou=company,dc=test,dc=com cn:ben sn:chan objectclass:organizationalUnit givenName:ben mail:ming@test.com telephoneNumber:1234678 mobile:98765432 postalAddress:dongguan postalCode:86 ou:editorial o:test Corp labeledURL:http://waringid.blog.51cto.com title:Editor postalCode: 区号 ou:部门 o:机构 title:职位 |
dos2unix user.ldif
iconv -f gb2312 -t UTF-8 -o user.ldif.utf8 user.ldif file user.ldif.utf8 ldapmodify -D "cn=Manager,dc=test,dc=com" -w secret -x -a -f user.ldif.utf8 |
ldapsearch -x -b "ou=unit,ou=company,dc=test,dc=com" |