Apple Mac OS X Server Network Card User Manual


 
258 Chapter 15 Working with Open Directory
After you get that, you can search for a record with a command like this:
$ ldapsearch -LLL -x -h xtra.apple.com -b "dc=apple,dc=com"
uid=ajohnson uid cn
dn: uid=ajohnson,cn=users,dc=apple,dc=com
uid: ajohnson
cn: Anne Johnson
Using LDIF Files
Lightweight Directory Interchange Format (LDIF) is a file format used to represent LDAP
entries in text form. LDAP tools such as ldappadd, ldapmodify, and ldapsearch read and
write LDIF files.
Here is an example of an LDIF file containing three entries. Multiple entries within the
same LDIF file are separated by blank lines.
dn: cn=Mei Chen,dc=example,dc=com
cn: Mei Chen
cn: M Chen
objectclass: person
description:< file:///tmp/babs
sn: Chen
dn: cn=Anne Johnson,dc=example,dc=com
cn: Anne Johnsone
cn: A Johnson
objectclass: person
sn: Johnson
dn: cn=Tom Clark,dc=example,dc=com
cn: Tom Clark
cn: T Clark
objectclass: person
sn: Clark
To load an LDIF file into the LDAP directory, use the ldapadd tool as follows:
Replace the
appleserver.example.com
with the location of the LDAP directory and
myusers.ldif
with the name of your LDIF file:
$ ldapadd -H ldap://
appleserver.example.com
-f
myusers.ldif
Warning: Many of the LDAP tools will modify or add entries to the LDAP directory.
Changing raw data in a directory can have unexpected and undesirable
consequences. You could inadvertently incapacitate users or computers, or you could
unintentionally authorize users to access more resources.