In Oracle VM Virtualbox I installed a fresh new copy of Ubuntu Server 14.04.1 64 bit version, with OpenSSH installed as well. Steps I done:

  1. sudo apt-get install slapd ldap-utils

  2. nano /etc/ldap/ldap.conf Here I entered BASE dc=elemer,dc=local URI ldap://

  3. sudo apt-get install phpldapadmin

  4. sudo nano /etc/phpldapadmin/config.php and replaced all the "dc=example,dc=com" with "dc=elemer,dc=local"

  5. From the physical machine I bring up a webbrowser and type in It brings up the webpage and I type in my password (I set the LDAP password the same as the root).

  6. LDAP laughs at me and says

"Unable to connect to LDAP server My LDAP Server

Error: Invalid credentials (49) for user

Failed to Authenticate to server

Invalid Username or Password"

The password is deffinetly right, I even created other virtual machines and repeated the process from scrath, used different approach at times but never managed to get it right.

  1. If I run ldapsearch -x it gives me: "Result: 32 No such object

  2. If I run ldapadd and put in my password it says:

ldap_sasl_interactive_bind_s: INvalid credentials (49) additional info: SASL(-13): user not found: no secret in database

  1. ldapsearch -x -LLL -H ldap:/// -b dc=example,dc=com dn will give No such object (32)

5 Answers 5


So first of all ubuntu manage to create a long how to (https://help.ubuntu.com/14.04/serverguide/openldap-server.html) about LDAP which omits an important phase:

You would have to run sudo dpkg-reconfigure slapd after you installed slapd and select : NO - your.domain.com - Organisation name - password - password - HDB - YES - YES - NO

I found the solution at Where is the dc=example,dc=com ldap dit?

Thank's for muru

  • 1
    Followed the howto and it does not work. I have reset the ldap password twice using dpkg-reconfigure, that's what's written in the solution. No luck thus. I have also restarted Apache and the slapd twice to force it to reread the documentation. Intriguing. I'll of course post a solution it I find one... even it is changing the LDAP admin GUI ;)
    – runlevel0
    Mar 14, 2016 at 19:20
  • That first link is dead now. Oct 16, 2020 at 18:31

Edit: Apparantly this is a very wide spread issue and it has been reported in many other forums without a viable soloution. while ago I solved and reported the soloution here but after awhile when I wanted to redo the steps I reslised that i can't replicate sucessfully. so after some try and error again I succeed so I will put the instructions here, this time not omting any details. hopefully it helps. before starting the steps please make sure you have the IP address of your maching (e.g. using ifconfig, for example

  1. knowing/changing your hostname: open the file /etc/hostname. you may delete everything there and replace it with your domain (e.g. myserver.org).

  2. installing OpenLDAP packages: you need 3 packages slapd, ldap-utils and phpldapadmin. installing slapd you will be asked to enter admin password.

  3. configuring OpenLDAP: open /etc/ldap/ldap.conf uncomment the lines below (remove the # from the beginning of the lines)

    BASE dc=example,dc=com

    URI ldap://ldap.example.com ldap://ldap-master.example.com:666

    and change them to

    BASE dc=myserver,dc=org

    URI ldap:// ldap://

    please remember that you have to replace the example IP with your IP adress.

  4. configuring phpldapadmin: open /etc/phpldapadmin/config.php in editor. Look for the lines having $servers->setValue, change to the server IP address. change all examples and coms to the terms you have set in step a

  5. Reconfigure the OpenLDAP Server: you need to Reconfigure the OpenLDAP Server (I don't know why really!) sudo dpkg-reconfigure slapd then select : NO -> myserver.com -> OrganisationName -> password -> password -> HDB -> NO -> YES -> NO

  6. the problem should be solved by now. but when you go forward there is another problem as described here in this post. you can solve it by the instructions in the link

I should thanks Anandd Nayyar and refer to his youtube video which helped me a lot to solve these issues.


So I made a tutorial after reading this post + another post + watching a few youtube videos and finally getting it down pat. Having an esxi server makes trail and error trivial time wise



Hostname     : ldap.freesoftwareservers.com
[DOMAIN]     : freesoftwareservers
[LDAPIP]     :

Copy Text then Find & Replace

[LDAPIP]    = Ldap Servers IP Address
[DOMAIN]    = Root domain without .com IE: freesoftwareservers
[COMNETORG] = .com or .net or .org or .whatever

sudo su
apt-get update
apt-get install -y apache2 slapd ldap-utils phpldapadmin
sh -c 'echo "BASE dc=[DOMAIN],dc=[COMNETORG]\nURI ldap://[LDAPIP]" >> /etc/ldap/ldap.conf'

dpkg-reconfigure slapd

Enter the Following :

Admin PWD (Note this is the Ldap User "Admin" PWD, doesn't have to be root/sudo users PWD)
Admin PWD

Replace all instances of “127.0.01” with [LDAPIP] & replace all instances of dc=example with dc=[DOMAIN]

sed -i -e 's/[LDAPIP]/g' /etc/phpldapadmin/config.php 
sed -i -e 's/dc=example/dc=[DOMAIN]/g' /etc/phpldapadmin/config.php

Not using .com? Then run the following as well

sed -i -e 's/dc=com/dc=[COMNETORG]/g' /etc/phpldapadmin/config.php

Change default shell to /bin/bash and default home dir to /home/$username :

nano /etc/phpldapadmin/templates/creation/posixAccount.xml

<attribute id="homeDirectory">
        <display>Home directory</display>
        <!-- <onchange>=autoFill(homeDirectory;/home/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->

<attribute id="loginShell">
        <display>Login shell</display>
        <!-- <value><![CDATA[=php.PickList(/;(&(objectClass=posixAccount));loginShell;%loginShell%;;;;loginShell)]]></value> -->
        <value id="/bin/sh">/bin/sh</value>
        <value id="/bin/csh">/bin/csh</value>
        <value id="/bin/tsh">/bin/tsh</value>
        <value id="/bin/bash">/bin/bash</value>

Adding User causes weird PWD Glitch :

sed -i -e 's/password_hash/password_hash_custom/g' /usr/share/phpldapadmin/lib/TemplateRender.php

Using this in a Dedicated VM? Redirect the root domain.com to domain.com/phpldapadmin via:

sh -c 'echo "RedirectMatch ^/$ /phpldapadmin/" >> /etc/apache2/apache2.conf'
service apache2 restart

Open UFW

ufw allow 389
ufw allow 80

Enable Public Key Attribute :

cat << EOL >~/openssh-lpk.ldif
dn: cn=openssh-lpk,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: openssh-lpk
olcAttributeTypes: ( NAME 'sshPublicKey'
  DESC 'MANDATORY: OpenSSH Public key'
  EQUALITY octetStringMatch
olcObjectClasses: ( NAME 'ldapPublicKey' SUP top AUXILIARY
  DESC 'MANDATORY: OpenSSH LPK objectclass'
  MAY ( sshPublicKey $ uid )

Add ldif for RSA Key Support :

ldapadd -Y EXTERNAL -H ldapi:/// -f ~/openssh-lpk.ldif

Check everything is working :

ldapsearch -x

If you don’t get something similar, its not working!

root@ldap:# ldapsearch -x
# extended LDIF
# LDAPv3
# base <dc=freesoftwareservers,dc=com> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL

# freesoftwareservers.com
dn: dc=freesoftwareservers,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: FreeSoftwareServers
dc: freesoftwareservers

# admin, freesoftwareservers.com
dn: cn=admin,dc=freesoftwareservers,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2

After installing a full package OpenLdap, I noticed that the process doesn't restart correctly after a service slapd restart.

You need to find the process by running the command

sudo ps -aux | grep [s]lapd

and then kill it

kill -9 <PID>

and sudo service slapd start. Everything worked for me after that.


I followed these steps. This worked for me.

First remove all the packages (all means ldap packages you have installed) by using sudo apt-get remove <package> then follow these steps:

Step 1: Install OpenLDAP

  1. sudo apt-get install slapd ldap-utils
  2. Give the administrator password/root password
  3. Re-enter the password of administrator/root

Step 2: Configure OpenLDAP

  1. Open the file /etc/ldap/ldap.conf in Gedit

  2. Make sure the file looks as follows:

    #LDAP Defaults
    #See ldap.conf for details
    #This file should be world readable but not world writable.
    BASE dc=ldap,dc=com
    URI ldap://localhost:389
    #TLS certificates (needed for GnuTLS)
    TLS_CACERT /etc/ssl/certs/ca-certificates.crt*
  3. Save the file and exit

Step 3: Reconfigure the slapd with the updated values

  1. sudo dpkg-reconfigure slapd
  2. Select "No" and Press Enter
  3. Enter the DNS Domain Name ldap.com
  4. Enter the Organization Name: Enter any name, e.g. Anagh Software
  5. Enter the LDAP Admin Password
  6. Select the Backend Database
  7. Choose the Default Only
  8. On the next screen select "No"
  9. Click Yes to Move the Old Database
  10. Select "No" under LDAPv2 Protocol

Step 4: Test the openLDAP

  1. ldapsearch -x

  2. PART-B LDAP Server Administration

  3. Install phpldapadmin package

    sudo apt-get install phpldapadmin
  4. sudo gedit /etc/phpldapadmin/config.php

  5. Edit the following values

    1. Set your LDAP server name

      $servers->setValue('server','name', Anagh LDAP Server');
    2. Set your LDAP server IP address

    3. Set Server domain name

    4. Set Server domain name again

  6. The below line will be commented. Uncomment it and then set it to true

    $config->custom->appearance['hide_template_warning'] = true;
  7. Save and exit the file

  8. Restart apache2

  9. Open web browser

  10. Then IP-Address/phpldapadmin

  • I fixed up this answer, but I don't know anything about networking/servers, so someone should probably check my edit to make sure everything's OK.
    – wjandrea
    Feb 17, 2017 at 1:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .