Indrajeet Gour
Indrajeet Gour

Reputation: 4510

ldapsearch filter with dn

I wanted to search for mentioned entity from the ldapsearch:

ldapsearch -LLL -x -H ldaps://ldapserver -E pr=1000/noprompt -b "O=XXX,C=AN " "(dn=cn=firstName lastName  1231233,ou=employee,o=xxx,c=an)"

I get the output as

# pagedresults: cookie=

But when i search the same entity with its alias name, I am getting the whole object return from the command.

So, why I am not getting the return from the mentioned command.

I wanted to do the filter on the dn field from the as already mentioned and the same dn I got from the alias search field. So ideally I should get the result if I used the correct way to filter.

Please let me know if I made any mistake on the filter query.

Upvotes: 0

Views: 803

Answers (1)

EricLavault
EricLavault

Reputation: 16095

You can access the entry by its dn using the following (probably what @user207421 suggested) :

ldapsearch -LLL -x -H ldaps://ldapserver -b "cn=firstName lastName  1231233,ou=employee,o=xxx,c=an" -s base

The key is to set the searched entry as the base with the appropriate scope, that is base.

Upvotes: 2

Related Questions