How to delete a subtree that contains entries which have the LDAPSubEntry objectclass?

Solution Verified - Updated -

Issue

One needs to delete an LDAP subtree that contains entries which have the LDAPSubEntry objetClass.
An easy option would be to use the recursive option ( -r ) of the ldapdelete tool.
Nonetheless the command fails with LDAP error 66 ( LDAP_NOT_ALLOWED_ON_NONLEAF ):

$ ldapdelete -x -D "cn=Directory Manager" -W -h <HOST> -p <PORT> -r "ou=MyGroup,dc=example,dc=com"
Enter LDAP Password: 
ldap_delete: Operation not allowed on non-leaf (66)
$

Environment

Red Hat Enterprise Linux 8
Red Hat Directory Server 11
Red Hat Enterprise Linux 7
Red Hat Directory Server 10

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content