The LDAP Data Interchange Format (LDIF) serves as a standard plain text format for representing LDAP directory content. Each entry in the LDAP directory is represented as a record in LDIF format, facilitating the description of directory objects and any modifications that need to be made.
LDIF Fields
- DN (Distinguished Name): Uniquely identifies an entry in the directory.
- DC (Domain Component): Represents each component of the domain.
- OU (Organizational Unit): Denotes the organizational unit or user group.
- CN (Common Name): Refers to the individual object being queried.
Using Switches to Modify, Add, and Remove Entries using LDIF
Adding Entries
dn: uid=jsmith1,ou=People,dc=example,dc=com
changetype: add
objectClass: inetOrgPerson
description: John Smith from Accounting. John is the project manager of the building project, so contact him with any questions.
cn: John Smith
sn: Smith
uid: jsmith1
Modifying Entries
dn: uid=sbrown20, ou=People,dc=example,dc=com
changetype: modify
add: mail
mail: sbrown@example.com
Deleting Entries
dn: ou=othergroup,dc=example,dc=com
changetype: delete
Replacing Entry Attributes:
dn: uid=sbrown20,ou=People,dc=example,dc=com
changetype: modify
replace: mail
mail: sbrown2@example.com
Renaming Entries
dn: uid=sbrown20,ou=People,dc=example,dc=com
changetype: modrdn
newrdn: uid=sbrown200
deleteoldrdn: 0
Moving Entries
dn: uid=sbrown2,ou=People,dc=example,dc=com
changetype: modrdn
newrdn: uid=sbrown2
deleteoldrdn: 0
newsuperior: ou=superusers,dc=example,dc=com
Adding Image or Audio Files to User Accounts
dn: uid=jsmith1,ou=People,dc=example,dc=com
changetype: modify
add: jpegPhoto
jpegPhoto:< file:///tmp/john.jpgdn: uid=jsmith1,ou=People,dc=example,dc=com
changetype: modify
add: audio
audio:< file:///tmp/hellojohn.mp3