Create the following script, and these files. Note that
you need to put some real passwords in there, change the
country code from NZ to (whatever) and change YOUR ORGANIZATION
to your organisation name.
This is with OpenLDAP 1.2 on RedHat 5.2 using the contrib.redhat.com
RPMs.
--------------------- runme ------------------------
#!/bin/sh
echo "Stopping LDAP and trashing database ..."
/etc/rc.d/init.d/ldap stop
rm -f /var/ldap/*
echo "Rebuilding database ..."
ldif2ldbm -f /etc/ldap/slapd.conf -i firstdb.txt
echo "Starting LDAP ..."
/etc/rc.d/init.d/ldap start
sleep 5
echo "Querying database ..."
ldapsearch -b 'o=YOUR ORGANIZATION,c=NZ' 'objectClass=*'
--------------------- firstdb.txt ------------------------
dn: o=YOUR ORGANIZATION,c=NZ
objectClass: organization
dn: ou=Members,o=YOUR ORGANIZATION,c=NZ
objectClass: organizationalUnit
dn: cn=Del,ou=Members,o=YOUR ORGANIZATION,c=NZ
cn: Del
sn: Elson
ou: Members
mail: del@babel.com.au
objectClass: person
userPassword: DoILookStupid?
dn: uid=root,ou=Members,o=YOUR ORGANIZATION,c=NZ
uid: root
ou: Members
description: System Administrator account
host: nz.babel.com.au
seeAlso: cn=Del,ou=Members,o=YOUR ORGANIZATION,c=NZ
objectClass: account
--------------------- /etc/ldap/slapd.conf ---------------
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/ldap/slapd.at.conf
include /etc/ldap/slapd.oc.conf
schemacheck off
#referral ldap://ldap.itd.umich.edu
pidfile /var/run/slapd.pid
argsfile /var/run/slapd.args
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
suffix "o=YOUR ORGANIZATION,c=NZ"
index cn,sn,ou pres,eq,approx
index objectclass pres,eq
index default none
directory /var/ldap
rootdn "uid=root,ou=Members,o=YOUR ORGANIZATION,c=NZ"
rootpw DontAskMeThat
# cleartext passwords, especially for the rootdn, should
# be avoid. See slapd.conf(5) for details.
--------------------- /etc/ldap/ldap.conf ---------------
HOST localhost
BASE o=YOUR ORGANIZATION,c=NZ
--------------------- /etc/ldap/ud.conf ---------------
HOST localhost
BASE o=YOUR ORGANIZATION,c=NZ del@babel.com.au |