This topic has 1 reply, 2 voices, and was last updated 1 year, 3 months ago by Bill Nelson.

  • Author
  • #27369

    Hi ,

    Can anyone help with a LDAPserach command where we can get all uid’s listed under a DC DN. or a command to get duplicate uid entries in a DC.


     Bill Nelson

    Search to return all uids beneath a specific base:

    ldapsearch -h -p 1389 -D “cn=Directory Manager” -w password -b “dc=foo,dc=bar” -s sub “(uid=*)”

    if you want to just return the uids (and nothing else) you could do this:

    ldapsearch -h -p 1389 -D “cn=Directory Manager” -w password -b “dc=foo,dc=bar” -s sub “(uid=*)” | grep “uid: ”

    to put them in a sort order so that duplicate uids are next to each other:

    ldapsearch -h -p 1389 -D “cn=Directory Manager” -w password -b “dc=foo,dc=bar” -s sub “(uid=*)” | grep “uid: ” | sort

    There is no way (that I know of) to get a listing of the duplicate uid entries using simply ldapsearch. You could, however, run the results from above through some add’l creative linux commands. For instance, you could take the output of the last command, put it in a looping construct and play with the results:

    for i in ldapsearch -h -p 1389 -D "cn=Directory Manager" -w password -b "dc=foo,dc=bar" -s sub "(uid=*)" | grep "uid: " | sort
    ### do fun stuff here

    I could write the fun stuff for you too, but where is the fun in that….

    ldapsearch has limitations by itself. it is when you combine it with other linux commands or include it in some scripting that you can draw some real power out of its use.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

©2021 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?