Baini.Marouane
Baini.Marouane

Reputation: 599

How to delete a user from the LDAP container

I need to delete a user from the LDAP container.

First of all I searched for the user using :

$ ldapsearch -x -b "dc=tuleap,dc=local" -s sub "objectclass=*"

I found the user and than I execute :

$ ldapdelete  -v -D "uid=user,dc=tuleap,dc=local" -w userpassword

I get this :

ldap_initialize( DEFAULT )
ldap_bind: Invalid credentials (49)

Any one can help to resolve this issue.

Upvotes: 5

Views: 25507

Answers (2)

Baini.Marouane
Baini.Marouane

Reputation: 599

After a long period of researching, I found a solution for that.

First I searched for the user using ldapsearch

ldapsearch -x -b "uid=user,ou=people,dc=tuleap,dc=local" -s sub "objectclass=*"

After that I deleted the user using ldapdelete

ldapdelete  -v -c -D "cn=Manager,dc=tuleap,dc=local" -w ladap-manager-password "uid=user,ou=people,dc=tuleap,dc=local"

Executing tuleap]# cat .env I found the ladap-manager-password

Upvotes: 3

Esteban
Esteban

Reputation: 1815

From what you put in your comments, the error Invalid credentials (49) comes from the incorrect DN you provided for your user :

uid=user,dc=tuleap,dc=local instead of uid=user,ou=people,dc=tuleap,dc=local

Now for the syntax of your command, you have to specify which entry you want to delete from the directory.

From the documentation :

If one or more DN arguments are provided, entries with those Distinguished Names are deleted. Each DN should be provided using the LDAPv3 string representation as defined in RFC 4514

For example :

ldapdelete -v -D "uid=user,ou=people,dc=tuleap,dc=local" -W "uid=user2,ou=people,dc=tuleap,dc=local"

Which will try to delete the entry : uid=user2,ou=people,dc=tuleap,dc=local

Upvotes: 3

Related Questions