4

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.

slm
  • 15,396
  • 12
  • 109
  • 124
Baini.Marouane
  • 579
  • 2
  • 8
  • 18
  • Please see if this helps - https://access.redhat.com/documentation/en-US/Red_Hat_Directory_Server/8.0/html/Administration_Guide/Managing_Entries_from_the_Command_Line-Deleting_Entries_Using_ldapdelete.html – Rao Jun 20 '17 at 13:10
  • This error means you provided the wrong user/password to the `ldapdelete` command to connect to the directory. In your case : user is `uid=user,dc=tuleap,dc=local` password is `userpassword`. If what you wanted is to delete the entry `uid=user,dc=tuleap,dc=local`, it is the wrong syntax to use the `ldapdelete` command. – Esteban Jun 20 '17 at 13:43
  • I execute : 'ldapdelete -D "cn=user,ou=people,dc=tuleap,dc=local" -w xxxxxxx -h 90e9692f8380 -p636' and this is the result : ldap_result: Can't contact LDAP server (-1) , it's about the server now. I replace 90e9692f8380 using tuleap_ldap_1 , localhost and it's the same output – Baini.Marouane Jun 21 '17 at 06:03
  • -p 636 indicates that you are trying to connect to the LDAPS port and you should you SSL, pass the proper options to the ldapdelete command. Please check the syntax of the ldapdelete command. – Ludovic Poitou Jun 21 '17 at 06:39
  • As @LudovicPoitou said, `636` is the standard port fort SSL connection. As your `ldapsearch` command does not use SSL, make sure you are using the right connection informations – Esteban Jun 21 '17 at 06:41
  • There is the port 389, when i use it , i get the same result! – Baini.Marouane Jun 21 '17 at 07:30
  • When I execute: **ldapdelete -v -c -D "uid=user,ou=people,dc=tuleap,dc=local" -W** I got this : ldap_initialize( ) Enter LDAP Password: I put the user password and i got nothing No output – Baini.Marouane Jun 21 '17 at 08:28
  • Did you try providing to your `ldapdelete` command the entry you actually try to delete? something like : `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 `user2` – Esteban Jun 21 '17 at 10:53

2 Answers2

3

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

Esteban
  • 1,752
  • 1
  • 8
  • 17
2

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

Dharman
  • 30,962
  • 25
  • 85
  • 135
Baini.Marouane
  • 579
  • 2
  • 8
  • 18