Using ldapsearch
Specifying Search Filters Using a File
You can enter search filters into a file instead of entering them on the
command-line. When you do this, specify each search filter on a separate line in
the file. The
appears in the file.
For example, if the file contains:
sn=Francis
givenname=Richard
then
the entries with the givenname
search criteria, then the entry is returned twice.
For example, suppose you specified the previous search filters in a file named
searchdb
returns all the entries that match either search filter:
ldapsearch -h mozilla -f searchdb
You can limit the set of attributes returned here by specifying the attribute names
that you want at the end of the search line. For example, the following
ldapsearch
givenname
ldapsearch -h mozilla -f searchdb sn givenname
Specifying DNs That Contain Commas in Search Filters
When a DN within a search filter contains a comma as part of its value, you must
escape the comma with a backslash (\). For example, to find everyone in the
example.com Bolivia, S.A.
ldapsearch -h mozilla -s base -b "o=example.com Bolivia\,
S.A.,dc=example,dc=com" "objectclass=*"
Using Client Authentication When Searching
This example shows user
authentication:
ldapsearch -h mozilla -p 636 -b "dc=example,dc=com" -N
"bjensenscertname" -Z -W certdbpassword -P
/home/bjensen/certdb/cert.db "givenname=Richard"
594
Red Hat Directory Server Administrator's Guide • May 2005
command runs each search in the order in which it
ldapsearch
first finds all the entries with the surname
ldapsearch
, and you set your search base using
command performs both searches but returns only the DN and the
and
attributes of each entry:
sn
bjensen
. If an entry is found that matches both
Richard
LDAP_BASEDN
subtree, use the following command:
searching the directory using client
and, then, all
Francis
. Then the following
Need help?
Do you have a question about the DIRECTORY SERVER 7.1 - ADMINISTRATOR and is the answer not in the manual?
Questions and answers