Using ldapsearch
592
Red Hat Directory Server Administrator’s Guide • May 2005
ldapsearch Examples
In the next set of examples, suppose the following are true:
• You want to perform a search of all entries in the directory.
• You have configured your directory to support anonymous access for search
and read. You do not have to specify any bind information in order to
perform the search. For more information on anonymous access, see
“Defining User Access - userdn Keyword,” on page 221.
• The server is located on hostname
mozilla
.
• The server uses port number
389
. Since this is the default port, you do not
have to identify the port number on the search request.
• SSL is enabled for the server on port
636
(the default SSL port number).
• The suffix under which all data is stored is
dc=example,dc=com
.
Returning All Entries
Given the previous information, the following call will return all entries in the
directory:
ldapsearch -h mozilla -b "dc=example,dc=com" -s sub
"objectclass=*"
"objectclass=*"
is a search filter that matches any entry in the directory.
Specifying Search Filters on the Command-Line
You can specify a search filter directly on the command-line. If you do this, be
sure to enclose your filter in quotation marks (“filter”)
.
Also, do not specify the
-f
option. For example:
ldapsearch -h mozilla -b "dc=example,dc=com" "cn=babs jensen"
Searching the Root DSE Entry
The root DSE is a special entry that contains a list of all the suffixes supported by
the local Directory Server. You can search this entry by supplying a search base of
“”. You must also specify a search scope of
base
and a filter of
"objectclass=*"
.
For example:
ldapsearch -h mozilla -b "" -s base "objectclass=*"
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 ...