Ldap – How to modify/add a new objectClass to an entry in OpenLDAP

ldapopenldap

I recently setup centralized authentication system using OpenLDAP. Now I need to extend the users that are defined in the database to include a new object class that contains some security related data about them.
How can I modify the existing entries to add this new object class?
I'm pretty new to LDAP so don't bite my head off if I managed to ask a stupid question 😛 Thanks!

Best Answer

You can run ldapmodify to modify one or more entries, you just need to feed to the program the credentials and a file containing all the changes you want to do

As an example (taken straight from openldap manual), if your file contains this it'll add/modify all those fields

dn: uid=john.doe,ou=People,dc=example,dc=com
changetype: add
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: john.doe
givenName: John
sn: Doe
cn: John Doe
mail: john.doe@example.com
userPassword: password