Charlie_Melega
asked on
Running an LDAP Query from command line in Linux
Hello,
I want to run an LDAP query from a command line on a linux system?.
i.e., I want to run the following query to look up a user's DN:
(&(objectCategory=Person)( objectClas s=user)(sA MAccountNa me=usernam e))
How can I run this LDAP query from a linux command line and have it return query results for the provided username?
Thank You
I want to run an LDAP query from a command line on a linux system?.
i.e., I want to run the following query to look up a user's DN:
(&(objectCategory=Person)(
How can I run this LDAP query from a linux command line and have it return query results for the provided username?
Thank You
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are correct with YourADDN.
inetOrgPerson is the list of attributes to retrieve (equivalent to person)
inetOrgPerson is the list of attributes to retrieve (equivalent to person)
ASKER
Hello sweefta2,
I have one final question:
I am sure I have a syntax error as when I typed what I believed to be relevant command, it simply returned a syntax page as if i typed -help.
My DC machine is named ac2.cm.loc.
My Domain is cm.loc
Based on your guidance, I attempted the following:
ldapsearch -V -h ac2.cm.loc -b 'DC=cm,DC=loc' -x -s base -z 1 -l 1 '(&(objectCategory=Person) (objectCla ss=user)(s AMAccountN ame=userna me))' @inetOrgPerson
Thanks for any guidance
I have one final question:
I am sure I have a syntax error as when I typed what I believed to be relevant command, it simply returned a syntax page as if i typed -help.
My DC machine is named ac2.cm.loc.
My Domain is cm.loc
Based on your guidance, I attempted the following:
ldapsearch -V -h ac2.cm.loc -b 'DC=cm,DC=loc' -x -s base -z 1 -l 1 '(&(objectCategory=Person)
Thanks for any guidance
I presume you have found your answer as you have marked this as solved.
If not, try "man ldapsearch" for other possible options.
Alternatively do a google search on ldapsearch syntax examples to give you other examples of how to do what you wish.
If not, try "man ldapsearch" for other possible options.
Alternatively do a google search on ldapsearch syntax examples to give you other examples of how to do what you wish.
ASKER
I've bolded a couple of variables below that I would kindly ask clarification. YourADDN is your Active Directory DN? Not sure what the reference to @inetOrgPerson is;
ldapsearch -V -h ldapserver.host.name -b 'YourADDN' -x -s base -z 1 -l 1 '(&(objectCategory=Person)
__________________________