I must add an organizationalunit
like this into a freshly installed OpenLDAP (on Ubuntu 12.04) :
dn: ou=MYREGION, ou=MYAPP, ou=GROUPS, o=myorganization, c=fr
ou: MYREGION
objectClass: top
objectClass: organizationalunit
So as it's a new LDAP, I think I must first add the fr
country, and I create that file :
dn: c=fr
c: fr
objectClass: top
objectClass: country
Now I try to import it with that command (I have no domain for that server) :
ldapadd -x -D cn=admin,dc=nodomain -W -f country_fr.ldif
but OpenLDAP rejects that command with :
adding new entry "c=fr"
ldap_add: Server is unwilling to perform (53)
additional info: no global superior knowledge
Any hint?
The error
no global superior knowledge
means thatslapd
doesn't know where to put your new entry. This typically means that you have not defined an appropriate database. With newer systems (ones usingcn=config
instead ofslapd.conf
), you would typically first add a new database or modify an existing database entry usingldapadd
orldapmodify
. For example, on my Fedora 17 system, the default install sets up a database like this for hostingdc=my-domain,dc=com
:To host your organization (
o=myorganization, c=fr
), I would need to create the following LDIF file:And I would then load these modifications like this:
This works because of the following
olcAccess
lines already present in the configuration:This grants
root
, contactingslapd
over theldapi:///
socket, password-free access to thecn=config
tree.I would then load in my top-level entry:
By running:
This works because I've added a similar ACL to this database. Note that I didn't need to start with
c=fr
here, because the database is defined to holdo=myorganization,c=fr
Thanks to larsks answer, here is what I did.
First here is an extract of the default configuration with Ubuntu 12.04 (file
/etc/ldap/slapd.d/cn=config/olcDatabase={1}hdb.ldif
):So I created the following
change_suffix.ldif
:and added it to my ldap with the following command:
Now I had to create the organization node with the following
myorganization.ldif
:And finally add it with the following command (the first one didn't work due to
Insufficient access (50)
):Now I could add the organizational units: