• Contact Us
  • Home
  • Reference

How to use ldapdelete in OpenLDAP

Written by Maryanne Normann

Updated at January 29th, 2026

  • Quick Start
  • Installation
    Best Practices Configuration Troubleshooting Design Performance Platform
  • Maintenance
    Releases Upgrade
  • Reference
+ More

Table of Contents

What ldapdelete Does Basic Syntax Common options: Example Command Access Control & Privileges Integration With Replication

Deleting entries in OpenLDAP requires care — especially in production environments where replication, access control and referential integrity come into play. This guide explains the correct, safe ways to use the ldapdelete command.

What ldapdelete Does

ldapdelete is part of the standard OpenLDAP client utilities. It performs LDAP Delete operations against a directory server to remove one or more entries identified by their Distinguished Names (DNs.)

It connects to an LDAP server using a URI (e.g., ldap://, ldaps://, or ldapi:///) and deletes the entries specified either directly on the command line or from a file or STDIN.

Basic Syntax

ldapdelete [options] [DN...]

Common options:

Option Description
-x Use simple authentication instead of SASL
-H ldap://host Server URI
-D "cn=admin,dc=example,dc=com" Bind DN
-W Prompt for password
-w secret Specify password directly (not recommended)
-r Recursively delete entries below a DN (dangerous — use carefully!)
-f filename Read list of DNs to delete from a file
-v Verbose output
-ZZ StartTLS (when using ldap://)

Example Command

This prompts for the admin password, binds, and deletes the uid=jdoe entry.

ldapdelete -x -H ldap://localhost -D "cn=admin,dc=example,dc=com" -W "uid=jdoe,ou=People,dc=example,dc=com"

Access Control & Privileges

To successfully delete an entry the bound DN must have write or manage ACL access to the parent entry and the target entry. The rootDN for the database always bypasses ACLs and can delete anything.

Integration With Replication

If you’re running syncrepl, deletions performed on the provider will be replicated to consumers automatically.

Never manually delete data on consumers — it breaks replication consistency unless you’re intentionally decommissioning a replica.

For more information on ldapdelete, here is a link to the man page:  https://linux.die.net/man/1/ldapdelete

 

Copyright © 2020-2024 Symas Corporation. All rights reserved.
remove directory

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Understanding OpenLDAP Logs
  • How To Use Debug Logging
  • Symas Log Reduction Tools
  • Symas Blog RSS Feed
  • Symas on Facebook
  • Symas on Twitter
  • Symas Blog
  • Symas on LinkedIn
  • Symas YouTube Channel

Copyright © 2025, Symas Corporation. All rights reserved. Privacy Statement (updated July 31, 2023)

Phone:

Main Office: +1.650.963.7601
Fax: +1.650.390.6284

Email:

Sales: sales@symas.com
Support: support@symas.com

Office Hours:

8:00 AM - 5:00 PM ET

Office Location:

Symas Corporation
PO Box 391
Grand Junction, CO 81507 USA

Expand