I keep getting an invalid syntax error when trying to create a user in OpenLDAP (CentOS 7).

This is a new install of OpenLDAP for testing purposes.

So far I've managed to create a group called "Lab Staff", and now I'm trying to add a user to it

Here is the LDIF file:

dn: uid=lsuarez,ou=Lab Staff,dc=sftest,dc=net
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
cn: Luis Suarez
sn: Suarez
givenname: Luis
uid: lsuarez
ou: Lab Staff

Then I try to add it as follows:

ldapadd -x -D "cn=Admin,dc=sftest,dc=net" -W  -f /tmp/data.ldif
Enter LDAP Password:
adding new entry "uid=lsuarez,ou=Lab Staff,dc=sftest,dc=net"

I get the error message:

ldap_add: Invalid syntax (21)
        additional info: objectclass: value #3 invalid per syntax

That looks to me like it doesn't like inetOrgPerson, but I have no idea what I'm doing wrong.

2 Answers 2


You need to import the schema for inetOrgPerson into slapd.

I have no idea about OpenLDAP installation on CentOS 7, but if you have a file /etc/ldap/schema/inetorgperson.ldif and dynamic slapd configuration (/etc/ldap/slapd.d/), it might accept the following command (run as root).

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif
  • Thanks you were essentially correct, but my whole installation was wrong from the outset. This guide I found is the correct one and invaluable! certdepot.net/…
    – Aditya K
    Jul 31, 2015 at 10:19

To fix the problem please run the below commands:

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif 

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .