Adding an entry using the changetype LDIF directive
About this task
RFC 2849 specifies LDIF directives that you can use within your LDIF files. The most commonly used directive is changetype, which follows the dn: directive and defines the operation on the entry. The main advantage of using this method in an LDIF file is that you can combine add and modify in one file.
Steps
-
Open a text editor and create an entry that conforms with your schema.
Example:
This example uses
changetype: addto add the following entry in the file and saves the file asadd-user2.ldif.dn: uid=user.2001,ou=People,dc=example,dc=com changetype: add objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson postalAddress: Seely Dorm$100 Apple Street$Cincinnati, OH 50563 postalCode: 50563 description: This is the description for Seely Dorm. uid: user.2001 userPassword: pleasantry employeeNumber: 2001 initials: SPD givenName: Seely pager: +1 596 665 3344 mobile: +1 039 686 4949 cn: Seely Dorm sn: Dorm telephoneNumber: +1 097 257 7542 street: 100 Apple Street homePhone: +1 214 521 4883 l: Cincinnati mail: user.2001@maildomain.net st: OH
-
To add the entry specified in the LDIF file, run the
ldapmodifytool.Example:
In this example, you do not need to use the
--defaultAddor its shortform-aoption with the command.$ bin/ldapmodify --filename add-user2.ldifResult:
A confirmation message displays confirming the addition.