How do I delete specific attributes in LDAP using ldap-utils command-line?

I'm trying to remove two attributes from LDAP user.

Pseudo command:

ldapdelete -D "uid=username,attribute1,attribute2" -w my_pass -h localhost

How do I do that?


Note: When searching I'm using the following working command:

ldapsearch -D "cn=my-test,ou=Services,dc=foo,dc=com" -w my_pass -h localhost -b "ou=Non-Enterprise,ou=People,dc=foo,dc=com" -s sub -x -ZZ "(uid=username)"

Related:

How do I delete one attribute in LDAP with LDIF?

Sun Java System Directory Server Enterprise Edition 6.0 Administration Guide

Examples on GitHub

1 Answer

ldapdelete is to remove entries, you need to use ldapmodify to delete attributes.

This command should remove attribute1 and attribute2 from the username entry:

$ ldapmodify -D "uid=..." -w ... -h ... <<%EOF%
dn: uid=username,ou=Non-Enterprise,ou=People,dc=foo,dc=com
changetype: modify
delete: attribute1
-
delete: attribute2
%EOF%
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like