![Netscape NETSCAPE DIRECTORY SERVER 6.02 Administrator'S Manual Download Page 509](http://html1.mh-extra.com/html/netscape/netscape-directory-server-6-02/netscape-directory-server-6-02_administrators-manual_1674673509.webp)
Using ldapsearch
Appendix
B
Finding Directory Entries
509
Using LDAP_BASEDN
To make searching easier, you can set your search base using the
LDAP_BASEDN
environment variable. Doing this allows you to skip specifying the search base
with the
-b
option (for information on how to set environment variables, see the
documentation for your operating system).
Typically, you set
LDAP_BASEDN
to your directory’s suffix value. Since your
directory suffix is equal to the root, or topmost, entry in your directory, this causes
all searches to begin from your directory’s root entry.
For example, suppose you have set
LDAP_BASEDN
to
dc=example,dc=com
. Then to
search for
cn=babs jensen
in your directory use the following command-line call:
ldapsearch -h mozilla "cn=babs jensen"
In this example, the default scope of
sub
is used because the
-s
option was not
used to specify the scope.
Displaying Subsets of Attributes
The
ldapsearch
command returns all search results in LDIF format. By default,
ldapsearch
returns the entry’s distinguished name and all of the attributes that
you are allowed to read (you can set up the directory access control such that you
are allowed to read only a subset of the attributes on any given directory entry).
Only operational attributes are not returned. If you want operational attributes
returned as a result of a search operation, you must explicitly specify them in the
search command.
Suppose you do not want to see all of the attributes returned in the search results.
You can limit the returned attributes to just a few specific attributes by specifying
the ones you want on the command line immediately after the search filter. For
example, to show the
cn
and
sn
attributes for every entry in the directory, use the
following command-line call:
ldapsearch -h mozilla "objectclass=*" sn cn
This example assumes you set your search base with
LDAP_BASEDN
.
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
Summary of Contents for NETSCAPE DIRECTORY SERVER 6.02
Page 1: ...Administrator s Guide Netscape Directory Server Version6 02 May 2002 ...
Page 16: ...16 Netscape Directory Server Administrator s Guide May 2002 ...
Page 20: ...20 Netscape Directory Server Administrator s Guide May 2002 ...
Page 74: ...Maintaining Referential Integrity 74 Netscape Directory Server Administrator s Guide May 2002 ...
Page 138: ...Using Referrals 138 Netscape Directory Server Administrator s Guide May 2002 ...
Page 432: ...Miscellaneous Tuning Tips 432 Netscape Directory Server Administrator s Guide May 2002 ...
Page 434: ...434 Netscape Directory Server Administrator s Guide May 2002 ...
Page 468: ...PTA Plug In Syntax Examples 468 Netscape Directory Server Administrator s Guide May 2002 ...
Page 488: ...488 Netscape Directory Server Administrator s Guide May 2002 ...
Page 528: ...Examples of LDAP URLs 528 Netscape Directory Server Administrator s Guide May 2002 ...