Previous Topic: LDIF

Next Topic: Encryption, Special Characters, and Binary Data in LDIF

Format of Information in an LDIF File

An LDIF file consists of a series of records, separated by blank lines.

Each record describes a directory entry or a set of changes to a directory entry. These two types of records cannot be mixed in an LDIF file.

Information only

If you want to do any of the following tasks, use an information-only LDIF file:

Directives for changes

If you want to edit existing data, use an LDIF file that contains directives.

LDIF File Containing Description of an Entry

The first line of an entry is the distinguished name (dn). The rest of the entry is made up of attribute value pairs, separated by a colon (:) and a space.

Each record is separated with a blank line.

The basic form of an LDIF entry is:

dn: distinguished-name
attribute-type : attribute-value
attribute-type : attribute-value...

Example: A Simple LDIF File with Two Entries

This example shows two LDIF records. An LDIF file that contains these records could be used to load these two entries into a directory:

version: 1
dn: cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectclass: top
objectclass: person
cn: Barbara Jensen
sn: Jensen

dn: cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectclass: top
objectclass: person
cn: Barbara Jensen
sn: Jensen
LDIF File Containing Changes to Data

An LDIF file can contain instructions for changes to existing entries in a directory. LDIF lets you specify these changes:

You cannot rename an entry if that entry has children.

Example: One LDIF Change Directive

This example shows a single entry, for which the title will be replaced:

version: 1
dn: cn=Murray HORSFALL, ou=Repair,ou=Operations,o=Democorp,c=AU
changetype: modify
replace: title
title: Chief Information Officer

Example: An LDIF file Containing Many Change Directives

This example shows a single entry with a series of changes:

version: 1
dn: cn=Murray HORSFALL, ou=Repair,ou=Operations,o=Democorp,c=AU
changetype: modify
replace: title
title: Chief Information Officer
-
add: telephone
telephone: 797 8888
-
delete: description
-
replace: postalAddress
postalAddress: 173 Toorak Rd $ South Yarra
postalCode: 3066

dn: cn=Murray HORSFALL, ou=Repair,ou=Operations,o=Democorp,c=AU
changetype: add
title: Chief Information Officer
telephone: 797 8888
postalAddress: 173 Toorak Rd $ South Yarra
postalCode: 3066