You can have multiple entries in your LDIF file by simply separating each DN and its entry with a blank line from the next entry.

  1. Open a text editor and create a couple of entries that conform to your schema. 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)...
  2. Use the ldapmodify tool to add the entries specified in the LDIF file. In this example, we use the short form arguments for the ldapmodify tool.
    The -h option specifies the host name, the -p option specifies the LDAP listener port, -D specifies the bind DN, -w specifies the bind DN password, -a specifies that entries that omit a changetype will be treated as add operations, and -f specifies the path to the input file. If the operation is successful, you will see commented messages (those begining with "#") for each addition.
    $ bin/ldapmodify -h server.example.com -p 389 \ 
      -D "cn=admin,dc=example,dc=com" -w password -a -f add-user3.ldif
    # 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