LDIF directives

LDIF format to modify LDAP directories.

Contents

Formating

Begin a line with pound sign (#) for commenting. The first line should be the distinguished name (DN). The next line is the changetype and a directive. Finally, next lines are the directive's required parameters (one per line). You could change directives by adding a line with just a dash (-).

Example:

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: modify
delete: aliases
-
add: aliases
othernames: belmin

If you want to modify a different record, use an empty blank line as a delimiter.

Modify a record

To modify attributes of an existing record use changetype: modify.

Add attributes

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: modify
add: aliases
aliases: belmin

If the attribute exists, the new value(s) will simply be appended to the existing ones.

To add multiple values:

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: modify
add: aliases
aliases: belmin
aliases: bel

And you could replace all the values already set in the attribute by using the replace directive.

Delete attributes

The following deletes all values of an attribute:

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: modify
delete: aliases

And to delete just a single value of an attribute:

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: modify
delete: aliases
aliases: belmincito

Replace attributes

This will replace all the values of an attribute:

dn: uid=belmin,ou=users,dc=bfworks,dc=com
changetype: modify
replace: aliases
aliases: belminf

If you want to replace a single value of an attribute, you could use a delete directive and then add directive:

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: modify
delete: aliases
aliases: belmstr
-
add: aliases
aliases: belmeister

Create a record

To create a new record, use changetype: add.

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: add
objectclass: top
objectclass: person
cn: Belmin Fernandez
givenName: Belmin
sn: Fernandez
uid: belminf

Deleting a record

To delete a record, the changetype: delete directive is used:

dn: uid=belminf,ou=users,dc=bfworks,dc=com
changetype: delete

Moving a record

changetype: moddn/modrn

Resources

http://tools.ietf.org/html/draft-ietf-asid-ldif-00