Building an LDAP Server on Linux, Part 3 - Page 3

By Carla Schroder | Posted Nov 11, 2003
Page 3 of 4   |  Back to Page 1
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn

Adding Users

Ok, now we're rolling. Let's add some actual users, with a users.ldif file:

#Tux Entry
dn: cn=Tux P Tuxedo,dc=carlasworld,dc=net
cn: Tux P Tuxedo
cn: Tux Tuxedo
objectClass: person
sn: Tuxedo

# ldapadd -x -D "cn=Manager,dc=carlasworld,dc=net" -W -f users.ldif
Enter LDAP Password:
adding new entry "cn=Tux P Tuxedo,dc=carlasworld,dc=net"

# ldapsearch -x -b 'dc=carlasworld,dc=net' '(objectclass=*)'

# extended LDIF
#
# LDAPv3
# base with scope sub
# filter: (objectclass=*)
# requesting: ALL
#

# carlasworld.net
dn: dc=carlasworld,dc=net
objectClass: top
objectClass: dcObject
objectClass: organization
o: Tuxcomputing, Inc.

# Tux P Tuxedo, carlasworld.net
dn: cn=Tux P Tuxedo,dc=carlasworld,dc=net
cn: Tux P Tuxedo
cn: Tux Tuxedo
objectClass: person
sn: Tuxedo

Hurrah! It works, it works! Note that you cannot append new entries to your .ldif file, as it must contain only new entries. If ldapadd finds any existing entries, it will stop and not process any more entries.

The Debian Difference

If you use apt-get to install OpenLDAP, dpkg will automatically configure it and set up the root domain, company, and the authorized LDAP admin and password. You can also create another LDAP admin/password combo in slapd.conf, as we did above, and use either one.

Page 4: Schema

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter