How to add an organizational unit (OU) to OpenLDAP

Home > Search > How-to
  by

This assumes you have already installed OpenLDAP and configured OpenLDAP to use your domain name, such as example.com.

 

Create an LDIF file for the new organizational units (OU).

~]# touch /etc/openldap/slapd.d/OU.ldif

 

In this example, an OU named Group will be added to OpenLDAP. You can replace Groups with any other text, such as Users or myCustomOU. 

cn: ou=Group,dc=example,dc=com
ou: Group
objectClass: top
objectclass: organizationalunit

 

Add the OU into OpenLDAP.

~]# ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f /etc/openldap/slapd.d/OU.ldif
Enter LDAP password: ******
adding new entry "ou=Group,dc=example,dc=com"

 

The ldapsearch command can be used to verify that the OU has been added to OpenLDAP.

~]# ldapsearch -x -b dc=example,dc=com
dn: ou=Group,dc=example,dc=com
ou: Group
objectClass: top
objectclass: organizationalunit

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments