[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: enumeratin all ldap objects in a LDAP ?

I don't think it's a good approach using the root account to run such a simple script.

Maybe it would be better to perform a search operation against the server. The code below might work for you:

ldapsearch -Hldaps://your.server.com -x -b dc=yourDITroot "objectclass=*" dn -D cn=yourRootDN,dc=yourDITroot -W | grep numEntries


On Fri, May 30, 2008 at 3:50 AM, Adrian Overbury <adrian@inomial.com> wrote:
Well, I don't know necessarily what the *best* way is, but I can tell you what the simplest way in.  As root on whatever server the openLDAP database is on, run this command:

slapcat | grep "^dn: " | wc -l

That will dump the entire ldap database, grab every "dn: ..." line, which every object will have exactly one of, and run it through wc (the word-counter) and tell it to count the number of lines.



Michael Arndt wrote:
Hello *,

what is a "good" way to enumerate all objects in an open ldap
in order to get a total count of defined objects ?
( how many objects ..)


PS: Sorry if i should know this by reading basic infos

Andre Augusto da Silva Pereira
Linux Certified Professional - LPIC-1
+55 91 8112-6691