For Precise 12.04
sudo /etc/init.d/slapd stop
#Open the right OpenLDAP config file with an editor:
sudo nano /etc/ldap/slapd.d/cn\=config/olcDatabase\=\{1\}hdb.ldif
#Add new lines (after the one with olcDbIndex: objectClass eq in it) for the missing indexes. Eg.:
olcDbIndex: cn eq
olcDbIndex: gidNumber eq
olcDbIndex: memberUid eq
olcDbIndex: uid eq
olcDbIndex: uidNumber eq
olcDbIndex: uniqueMember eq
#Run the OpenLDAP indexer for your configuration:
sudo slapindex -F /etc/ldap/slapd.d/
#will get an permission error so
#Fix file permissions in your OpenLDAP database:
sudo chown -R openldap:openldap /var/lib/ldap
#Start the LDAP server:
sudo /etc/init.d/slapd start
For Karmic
from http://ilostmynotes.blogspot.com/2009/08/eliminating-openldap-uid-not-indexed.html
echo "dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcDbIndex
olcDbIndex: uid,uidNumber,gidNumber,memberUid,uniqueMember,objectClass,cn eq" > indexchanges.ldif
sudo ldapmodify -f indexchanges.ldif -D cn=admin,cn=config -x -y /etc/ldap.secret
sudo /etc/init.d/slapd stop
sudo su -s /bin/bash -c slapindex openldap
sudo /etc/init.d/slapd start
For Hardy
from https://help.ubuntu.com/community/OpenLDAP-SambaPDC-OrgInfo-Posix
/etc/ldap/slapd.conf in the database definitions section (ie. after the first database directive).
# Indices to maintain for this database
index objectClass eq,pres
index ou,cn,sn,mail,givenname eq,pres,sub
index uidNumber,gidNumber,memberUid eq,pres
index loginShell eq,pres
# I also added this line to stop warning in syslog ..
index uniqueMember eq,pres
## required to support pdb_getsampwnam
index uid pres,sub,eq
Following this, stop the LDAP server, run slapindex, and restart the LDAP server.
sudo /etc/init.d/slapd stop
sudo slapindex
# WARNING!
# Runnig as root!
# There's a fair chance slapd will fail to start.
# Check file permissions!
# Correct the ownership of the index files ..
sudo chown openldap:openldap /var/lib/ldap/*
sudo /etc/init.d/slapd start
2 comments:
Wow - it even works in Lucid like a charm! Copy-paste... the last couple of times I searched this, I spent half an hour. Thank you very much...
it worked in centos6 also. Thanks
Post a Comment