LDAP - mwicat/personal GitHub Wiki

Search directory

sudo apt-get install ldapscripts

ldapsearch -x -LLL -D "$user" -b "$base" -w "$passw" -h "$host"($query)" samaccountname

Import ldif into server

Download DEB file from http://directory.apache.org/apacheds/2.0/download/download-linux-deb.html

sudo apt-get install ldap-utils
ldapadd -f test/test.ldif -x -h 127.0.0.1 -p 10389

Serve

sudo apt-get install python-ldaptor
python /usr/share/pyshared/ldaptor/protocols/ldap/ldapserver.py < test.ldif

Example LDIF

dn: dc=example,dc=com
dc: example
description: My wonderful company as much text as you want to place 
objectClass: dcObject
objectClass: organization
o: Example, Inc.

dn: ou=people, dc=example,dc=com
ou: people
description: All people in organisation
objectclass: organizationalunit

dn: cn=Robert Smith,ou=people,dc=example,dc=com
objectclass: inetOrgPerson
cn: Robert Smith
givenName: Robert
sn: Smith
telephoneNumber: 1234
ou: Sales