ldapadd/ldapmodify: clarifications needed about these commands

The ldif for ldapmodify has a different syntax than a regular ldif. For example: if you want to add the 'foo' entry with value 'bar' you should write your ldif like this:

dn: cn=ToModify,dc=example,dc=com
changetype: Modify
add: foo
foo: bar

replace: mail
mail: [email protected]

delete: unneededEntry

This ldif will add the attribute foo with value bar, update the mail attribute to [email protected] and delete the unneededEntry. then invoke the ldapmodify command.

ldapmodify -f update.ldif 

(if needed with other options like simple auth for example)


Try the -a switch

Add or modify options:
  -a         add values (default is to replace)

Goez answer seems fine.

However if you are unfamiliar with ldif it can make sense to use

ldapvi

instead. You can edit already existing entries or add new ones.

apt-get install ldapvi