How can I do a ldapsearch to find a DN for a user when I know the exact cn for that user out of active directory.
I have tried several different commands (hundreds) but need the -b with the full dn to perform the search using ldapsearch from AIX. I am trying to find the OU for a user and the sAMAccountName. Our user are in several different OU's.
How about something like this... it searches from the TOP of the
tree (i.e. dc=something,dc=acorp,dc=com) and searches for a
"user" with a same samaccountname equal to "$search_name":
maybe I am missing something. I do not want to put in a DN in the search portion, I am looking for the DN . Or I am at least looking for OU portiton that is part of the DN, and that part is different for each user.
Also running your query in AIX I get this error:
scope is required for a null based search.
Sends a search request to an LDAP server.
usage:
ldapsearch [-b basedn] [options] filter [attributes...]
where:
basedn: base dn for search
(optional if LDAP_BASEDN set in environment)
filter: LDAP search filter
attributes: whitespace-separated list of attributes to retrieve
(if no attribute list is specified, all are retrieved)