Adding multiple entries in a single file
About this task
Add multiple entries in your LDIF file by separating each distinguished name (DN) and its entry with a blank line from the next entry.
Steps
-
Open a text editor and create some entries that conform to your schema.
Example:
For example, add the following entries in the file and save the file as
add-user3.ldif. Separate each entry with a blank line.dn: uid=user.2003,ou=People,dc=example,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson ...(similar attributes to previous examples)... dn: uid=user.2004,ou=People,dc=example,dc=com objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson ...(similar attributes to previous examples)...
-
To add the entries specified in the LDIF file, run the
ldapmodifytool.Example:
This example uses the short form arguments for the
ldapmodifytool.$ bin/ldapmodify -h server.example.com -p 389 \ -D "cn=admin,dc=example,dc=com" -w password -a -f add-user3.ldifThe
-hoption specifies the host name, the-poption specifies the LDAP listener port,-Dspecifies the bind DN,-wspecifies the bind DN password,-aspecifies that entries that omit a changetype are treated as add operations, and-fspecifies the path to the input file. If the operation is successful, you will see commented messages (those begining with "#") for each addition.Result:
# Processing ADD request for uid=user.2003,ou=People,dc=example,dc=com # ADD operation successful for DN uid=user.2003,ou=People,dc=example,dc=com # Processing ADD request for uid=user.2004,ou=People,dc=example,dc=com # ADD operation successful for DN uid=user.2004,ou=People,dc=example,dc=com