I'm trying to search an LDAP for an object of a specific class, but it always returns

result: 32 No such object


I'm trying to access a PGP Universal server at keyserver.pgp.com which is a PGP server with LDAP access. It has an object of class pgpServerInfo that holds some informatione about how the PGP keys can be retrieved.

I am not well versed with LDAP, so my approach may be completely wrong.

This is what I tried:

ldapsearch -v -x -H ldap://keyserver.pgp.com "(objectclass=pgpServerInfo)"

I've also tried to add -s base and -s one, but no difference.

This works:

ldapsearch -v -x -b "cn=PGPServerInfo" -H ldap://keyserver.pgp.com "(objectClass=pgpServerInfo)"

But by doing so, I have to assume the object's name which I would like to avoid.

What's the correct query to find the object?

  • Does the "ldaps://" in your example that does not work, and the "ldap://" in your example that does work, have anything to do with the problem?
    – DericS
    Nov 19, 2020 at 20:13
  • No, it doesn't make a difference if it's ldap or ldaps. But thanks for pointing that out. I changed it in the question.
    – not2savvy
    Nov 19, 2020 at 21:13

1 Answer 1


If you want to avoid assuming a base name you can try the following:
ldapsearch -v -x -s base -H ldap://keyserver.pgp.com "(objectclass=*)" +

Note the + in the search. This will list "operational attributes".

This should provide you with a bunch of information including a number of "namingContexts". You can then choose the namingContexts until you get which one you're looking for.

  • This helps! However, I don't understand what you mean when you say "you're still making some assumptions because you still have to choose the base from a list"? I'd go through the returned list of the namingContexts one by one checking the object class. So what assumptions?
    – not2savvy
    Nov 21, 2020 at 13:57
  • 1
    Any of the namingContexts could have contained items with an objectClass of "pgpServerInfo". In the case for this key server, the base you were looking for "cn=PGPServerInfo" happen to have a name that was very similar to the objectClass (pgpServerInfo) you wanted, but that didn't have to be the case. Due to that, I felt that you were not eliminating all assumptions. However, my comment about assumptions does not add much (if anything) to the answer, so I will edit the answer. I will also add a bit more information about what makes the search I provided a bit different from what you tried.
    – DericS
    Nov 21, 2020 at 15:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .