# ldap_add: Object class violation (65)

## sneak147

Hi,

Im tryin 2 add user infomation to my directory but get the following error,

 *Quote:*   

> adding new entry "uid=jdoe,ou=people,dc=gmsg,dc=co,dc=za"
> 
> ldapadd: update failed: uid=jdoe,ou=people,dc=gmsg,dc=co,dc=za
> 
> ldap_add: Object class violation (65)
> ...

 

Below is the ldif im trying to import and after that is what my

current directory looks like, and from what I can see I dont know why

im getting that error.  Anybody got any Ideas?

I have included all schema's being nis.schema and cosine.schema.

```
dn: uid=jdoe,ou=people,dc=gmsg,dc=co,dc=za

uid: jdoe

cn: Jane Doe

uidNumber: 1001

gidNumber: 100

homeDirectory: /home/jdoe

userPassword: password

loginShell: /bin/bash

objectClass: posixAccount

```

```

# extended LDIF

#

# LDAPv3

# base <> with scope sub

# filter: objectClass=*

# requesting: ALL

#

# gmsg.co.za

dn: dc=gmsg,dc=co,dc=za

objectClass: dcObject

objectClass: organization

o: Global Mining Support Group

dc: gmsg

# Manager, gmsg.co.za

dn: cn=Manager,dc=gmsg,dc=co,dc=za

objectClass: organizationalRole

cn: Manager

# people, gmsg.co.za

dn: ou=people,dc=gmsg,dc=co,dc=za

ou: people

objectClass: top

objectClass: organizationalUnit

# admin, gmsg.co.za

dn: cn=admin,dc=gmsg,dc=co,dc=za

cn: admin

objectClass: top

objectClass: organizationalRole

objectClass: simpleSecurityObject

# search result

search: 2

result: 0 Success

# numResponses: 5

# numEntries: 4

```

[/quote]

----------

## bigsmoke

 *sneak147 wrote:*   

> Hi,
> 
> Im tryin 2 add user infomation to my directory but get the following error,
> 
> ```
> ...

 

Try adding a structural objectclass like person, organizationalPerson or inetOrgPerson. To add person or organizationalperson you need to add core.schema. For inetOrgPerson you need to add inetorgperson.schema.

OpenLDAP is overly strict (in my opinion) when it comes to structural and auxiliary objectclasses. I've been having troubles when trying to create aliases of inetOrgPerson (Both alias and inetOrgPerson are STRUCTURAL). I eventually had to modify the schema file to get around this. To solve your problem, you can also change posixAccount from AUXILIARY to STRUCTURAL, but this will grant you problems when you later want to use posixAccount together with another STRUCTURAL object class.

The easiest solution will be to simply add another object class to your entry, like:

```
dn: uid=jdoe,ou=people,dc=gmsg,dc=co,dc=za

uid: jdoe

cn: Jane Doe

# sn is required for person

sn: Doe

uidNumber: 1001

gidNumber: 100

homeDirectory: /home/jdoe

userPassword: password

loginShell: /bin/bash

objectClass: posixAccount

# additional objectclass

objectClass: person

# One which you forgot

objectClass: top

```

Hope this helps ...

 - Rowan Rodrik

----------

