openldap add mail attribute to users

cparfon picture cparfon · Feb 1, 2015 · Viewed 13.7k times · Source

I'm trying to add 'mail' attribute to users on my openldap server but somehow it fails. I tried using ldapmodify but I get this:

ldap_modify: Object class violation (65)
additional info: attribute 'mail' not allowed

Here's how my schema looks like:

# LDIF Export for ou=users,dc=mydomain,dc=com
# Server:  (ldap.mydomain.com)
# Search Scope: sub
# Search Filter: (objectClass=*)
# Total Entries: 63

version: 1

# Entry 1: ou=users,dc=mydomain,dc=com
dn: ou=users,dc=mydomain,dc=com
objectclass: organizationalUnit
objectclass: top
ou: users

# Entry 2: uid=tom.hanks,ou=users,dc=mydomain,dc=com
dn: uid=tom.hanks,ou=users,dc=mydomain,dc=com
cn: tom.hanks
description: User account
gecos: tom.hanks
gidnumber: 100
homedirectory: /home/tom.hanks
loginshell: /bin/bash
objectclass: account
objectclass: posixAccount
uid: tom.hanks
uidnumber: 1005
userpassword: blahblah

Answer

Dave Bennett picture Dave Bennett · Feb 1, 2015

Include objectclass: iNetOrgPerson to add the mail attribute.