
Using ldapsearch
594
Red Hat Directory Server Administrator’s Guide • May 2005
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
ldapsearch
command runs each search in the order in which it
appears in the file.
For example, if the file contains:
sn=Francis
givenname=Richard
then
ldapsearch
first finds all the entries with the surname
Francis
and, then, all
the entries with the givenname
Richard
. If an entry is found that matches both
search criteria, then the entry is returned twice.
For example, suppose you specified the previous search filters in a file named
searchdb
, and you set your search base using
LDAP_BASEDN
. Then the following
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
command performs both searches but returns only the DN and the
givenname
and
sn
attributes of each entry:
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.
subtree, use the following command:
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
bjensen
searching the directory using client
authentication:
ldapsearch -h mozilla -p 636 -b "dc=example,dc=com" -N
"bjensenscertname" -Z -W
certdbpassword
-P
/home/bjensen/certdb/cert.db "givenname=Richard"
Summary of Contents for DIRECTORY SERVER 7.1
Page 1: ...Administrator s Guide Red Hat Directory Server Version7 1 May 2005 Updated February 2009 ...
Page 20: ...20 Red Hat Directory Server Administrator s Guide May 2005 Glossary 619 Index 635 ...
Page 22: ...22 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 26: ...26 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 78: ...Maintaining Referential Integrity 78 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 200: ...Assigning Class of Service 200 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 488: ...488 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 528: ...PTA Plug in Syntax Examples 528 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 572: ...572 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 612: ...Examples of LDAP URLs 612 Red Hat Directory Server Administrator s Guide May 2005 ...
Page 634: ...634 Red Hat Directory Server Administrator s Guide May 2005 ...