Setup LDAP on Ubuntu 10.04
I attempted to set up and LDAP server on Ubuntu, but apparently I skipped a step or missed part of the instructions because I could not get it to work. After researching many websites, I was finally able to come up with a solution that got it to work. All of the instructions are based upon the use of a Linux command prompt (or terminal)
- Connect to your server
sudo apt-get purge slapdThis will clear your existing slapd configuration if you have one.
sudo apt-get install slapd ldap-utils php5-ldapThis will re-install slapd with the initial configuration and install ldap-utils and php5-ldap packages if you do not already have them
- Accept any dependencies necessary.
- Copy the script located at http://www.blackboxitech.com/it_help/ldap_script.txt to your server. When saving the file, name it ldap_script.sh and save it in a directory that you have access. ( I don't know who initially created it, so I don't know who give credit to)
- Give the script executable permissions by running the command
chmod u+x ldap_script.sh
- Edit the file look for and edit the following lines:
In my instance, I changed the lines to
- If you wish, you may change the lines towards the end of the script so that the first user that is added, has all the necessary fields of your choosing. I chose to not modify the fields so that at least one user is added correctly.
- After you have finished making all of the changes, run the command sudo ./ldap_script You will see the script run and it may prompt you for your password.
- Enter the command
ldapsearch -x -h localhost -b "dc=EXAMPLE,dc=COM" "(objectClass=*)"where EXAMPLE and COM match the entries that you included in the file. You should see the results of your LDAP server.