Install OpenLDAP Server and Administer with phpLDAPadmin in Debian/Ubuntu

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

26 Responses

  1. sanjeevi says:

    Hi Ravi,

    We would like to install LDAP on Centos 7 and it should integration with windows 2012 R2 Active Directory OU’s please suggest to me how to configure it

    • Ravi Saive says:


      Sorry not idea about Windows integration with LDAP, actually I never get chance to work on..

  2. TDG says:

    could you please help me with I want a shell script that will lock a machine after certain idle time in the openLdap server.

    Thank you

  3. manoj says:

    Hi Ravi Saive,
    above ldap configuration is very good . but can you confirm how to login ldap user on ubuntu machine with GUI mode

  4. David Lee says:

    I struggled with this piece. So to help future readers here is the fix that I had to apply to get the LDAP entries Sheldon, Leonard, Howard, and Rajesh to add.

    Here is my Linux information…
    Operating System Linux Mint 16 Cinnamon 64-bit
    Cinnamon Version 2.0.14
    Linux Kernal 3.11.0-12-generic

    Here is the error message that I received when trying to add LDAP entries for the first time.
    adding new entry “cn=Sheldon Cooper,ou=People,dc=homestead,dc=localdomain”
    ldap_add: No such object (32)
    matched DN: dc=homestead,dc=localdomain
    (repeated three more times)

    The fix is to add the missing and needed DN level for the “People”…
    dn: ou=People,dc=homestead,dc=localdomain
    objectClass: top
    objectClass: organizationalUnit
    ou: People

    Save the above four lines, and put them into another separate LDIF file. Like the below example.
    / $ ldapadd -x -W -D “cn=admin,dc=homestead,dc=localdomain” -f ~/Add_DN_Level.ldif
    Enter LDAP Password:
    adding new entry “ou=People,dc=homestead,dc=localdomain”

    With the DN level added the four People can now be added to LDAP.

  5. Dave Dhakal says:

    LDAP installation & Configuration on CentOS 6.5
    [[email protected] ~]# yum -y install openldap-servers.x86_64 0:2.4.23-34.el6_5.1
    [[email protected] ~]# yum -y install openldap-clients.x86_64 0:2.4.23-34.el6_5.1
    [[email protected] ~]# yum -y install portreserve.x86_64 0:0.0.4-9.el6
    Packages Installed: openldap-clients.x86_64 0:2.4.23-34.el6_5.1
    openldap-servers.x86_64 0:2.4.23-34.el6_5.1
    Dependency Installed: portreserve.x86_64 0:0.0.4-9.el6
    [[email protected] ~]# yum -y update
    Updated: cpio.x86_64 0:2.10-12.el6_5
    [[email protected] ~]# slappasswd -s 123dhakal

    [[email protected] ~]# cd /etc/openldap/slapd.d/cn\=config/
    [[email protected] cn=config]# ll

    [[email protected] cn=config]# vi olcDatabase={1}monitor.ldif

    [[email protected] cn=config]# vi olcDatabase={2}bdb.ldif

    [[email protected] ~]# cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
    [[email protected] ~]# vi /etc/openldap/slapd.conf

    [[email protected] ~]# chkconfig slapd on

    [[email protected] run]# vi vastika.ldif

    [[email protected] run]# ldapadd -x -D “cn=Dhakal,dc=vastika,dc=com” -W -f vastika.ldif

    [[email protected] run]# ldapsearch -x -LLL -b dc=vastika,dc=com

    [[email protected] run]#


  6. Lars Fischer says:

    Would be a nice tutorial if it actually would work. No luck with Linux Mint.

  7. Amitesh says:

    Hi Ravi,

    I have installed openldap with phpldapadmin as you instructed on my ubuntu 12.0.4 box. But I can not login via phpldapadmin page. I can login there only as anonymous user.Could you please help me out?

    • teglas says:

      Hi Amitesh!

      I had the same problem with Linux Mint 17.
      So the key is, when you configure the /etc/ldap/ldap.conf file you need to modify the URI row as well:
      URI ldap://

      The phpldapadmin config file (/etc/phpldapadmin/config.php) needs to be fixed as well.
      The base DNS should be the same as you entered after executed this command: “sudo dpkg-reconfigure slapd”.
      Actually what you typed in at the second picture, that DNS needs to be typed into the phpldapadmin config file too.
      eg.: $servers->setValue(‘server’,’base’,array(‘dc=test,dc=tecmint,dc=com’))

      Restart the apache at the end:
      sudo service apache2 restart

      Good luck!

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *