Install on ubuntu: 

sudo apt-get install slapd ldap-utils

sudo apt-get install phpldapadmin

sudo service apache2 restart


One correction: please quote the binding dn below in bash.


How to change RootDN 


olcDatabase={1}hdb.ldif:olcRootDN: cn=admin,dc=example,dc=com

How to change RootPWD

  • generate hash with slappasswd  
  • change RootPwd using the above generated hash.
  • sudo service slapd restart

Clean Import 

  • service stop slapd
  • clean slapd db: rm -f /var/lib/ldap/*
  • slapadd -l .ldif
  • /var/lib/ldap$ sudo chown openldap:openldap * (make sure the ownership belongs to openldap)
  • service start slapd

Add entries

sudo ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f 
(it will prompt for password)


  • ldapsearch -x -b ” -s base ‘(objectclass=*)’ namingContexts
  • ldapsearch -x -b ‘dc=example,dc=com’ ‘(objectclass=*)’

Install python-ldap
  • sudo apt-get install build-essential python-dev libldap2-dev libssl-dev libsasl2-dev
  • pip install python-ldap


This entry was posted in ldap and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s