1 .TH LDAPSEARCH 1 "10 November 1998" "OpenLDAP LDVERSION"
3 ldapsearch \- ldap search tool
29 .BI \-d \ debuglevel\fR]
39 .BI \-w \ bindpasswd\fR]
41 .BI \-h \ ldaphost\fR]
43 .BI \-p \ ldapport\fR]
45 .BI \-P \ 2\fR\||\|\fI3\fR]
47 .BI \-b \ searchbase\fR]
49 .BI \-s \ base\fR\||\|\fIone\fR\||\|\fIsub\fR]
51 .BI \-a \ never\fR\||\|\fIalways\fR\||\|\fIsearch\fR\||\|\fIfind\fR]
53 .BI \-l \ timelimit\fR]
55 .BI \-z \ sizelimit\fR]
61 is a shell-accessible interface to the
66 opens a connection to an LDAP server, binds, and performs a search
67 using the filter \fIfilter\fP. The \fIfilter\fP should conform to
68 the string representation for LDAP filters as defined in RFC 1558.
72 finds one or more entries, the attributes specified by
73 \fIattrs\fP are retrieved and the entries and values are printed to
74 standard output. If no \fIattrs\fP are listed, all attributes are
75 returned. If * is listed, all user attributes are returned.
76 If + is listed, all operational attributes are returned.
77 If only 1.1 is listed, no attributes are listed.
81 Show what would be done, but don't actually perform the search. Useful for
82 debugging in conjunction with -v.
85 Include the User Friendly form of the Distinguished Name (DN) in the output
88 Run in verbose mode, with many diagnostics written to standard output
91 Use Kerberos authentication instead of simple authentication. It is
92 assumed that you already have a valid ticket granting ticket.
94 must be compiled with KERBEROS defined for this option to have any effect.
97 Same as \-k, but only does step 1 of the kerberos bind. This is useful
98 when connecting to a slapd and there is no x500dsa.hostname principal
99 registered with your kerberos servers.
102 Write retrieved values to a set of temporary files. This is useful for
103 dealing with non-ASCII values such as jpegPhoto or audio.
106 Retrieve attributes only (no values). This is useful when you just want to
107 see if an attribute is present in an entry and are not interested in the
111 Do not suppress display of non-ascii values. This is useful when
112 dealing with values that appear in alternate characters sets such as
113 ISO-8859.1. This option is implied by -L (see below).
116 Display search results in
118 format. This option also turns on the -B option, and causes the -F option
122 Enable manage DSA IT control.
124 makes control critical.
127 Do not automatically follow referrals returned while searching.
129 must be compiled with LDAP_REFERRALS defined for referrals to be
130 automatically followed by default, and for this option to have any effect.
133 Use \fIsep\fP as the field separator between attribute names and values.
134 The default separator is `=', unless the -L flag has been specified, in
135 which case this option is ignored.
138 Sort the entries returned based on \fIattribute\fP. The default is not
139 to sort entries returned. If \fIattribute\fP is a zero-length string (""),
140 the entries are sorted by the components of their Distingished Name. See
142 for more details. Note that
144 normally prints out entries as it receives them. The use of the
146 option defeats this behavior, causing all entries to be retrieved,
147 then sorted, then printed.
150 Set the LDAP debugging level to \fIdebuglevel\fP.
152 must be compiled with LDAP_DEBUG defined for this option to have any effect.
155 Read a series of lines from \fIfile\fP, performing one LDAP search for
156 each line. In this case, the \fIfilter\fP given on the command line
157 is treated as a pattern where the first occurrence of \fB%s\fP is
158 replaced with a line from \fIfile\fP. If \fIfile\fP is a single \fI-\fP
159 character, then the lines are read from standard input.
162 Use \fIbinddn\fP to bind to the LDAP directory. \fIbinddn\fP should be
163 a string-represented DN as defined in RFC 1779.
166 Prompt for simple authentication.
167 This is used instead of specifying the password on the command line.
170 Use \fIbindpasswd\fP as the password for simple authentication.
173 Specify an alternate host on which the ldap server is running.
176 Specify an alternate TCP port where the ldap server is listening.
179 Use \fIsearchbase\fP as the starting point for the search instead of
182 .BI \-s \ base\fR\||\|\fIone\fR\||\|\fIsub
183 Specify the scope of the search to be one of
188 to specify a base object, one-level, or subtree search. The default
192 .BI \-a \ never\fR\||\|\fIalways\fR\||\|\fIsearch\fR\||\|\fIfind
193 Specify how aliases dereferencing is done. Should be one of
199 to specify that aliases are never dereferenced, always dereferenced,
200 dereferenced when searching, or dereferenced only when locating the
201 base object for the search. The default is to never dereference aliases.
203 .BI \-P \ 2\fR\||\|\fI3
204 Specify the LDAP protocol version to use.
207 wait at most \fItimelimit\fP seconds for a search to complete. A
213 A server may impose a maximal timelimit which only
214 the root user may override.
217 retrieve at most \fIsizelimit\fP entries for a search. A sizelimit
223 A server may impose a maximal sizelimit which only
224 the root user may override.
226 If one or more entries are found, each entry is written to standard output
230 Distinguished Name (DN)
231 User Friendly Name (this line present only if the -u option is used)
238 Multiple entries are separated with a single blank line. If the -F option
239 is used to specify a separator character, it will be used instead of the
240 `=' character. If the -t option is used, the name of a temporary file
241 is used in place of the actual value. If the -A option
242 is given, only the "attributename" part is written.
244 The following command:
247 ldapsearch "cn=mark smith" cn telephoneNumber
250 will perform a subtree search (using the default search base) for entries
251 with a commonName of "mark smith". The commonName and telephoneNumber
252 values will be retrieved and printed to standard output.
253 The output might look something like this if two entries are found:
256 cn=Mark D Smith, ou="College of Literature, Science, and the Arts", ou=Students, ou=People, o=University of Michigan, c=US
261 telephoneNumber=+1 313 930-9489
263 cn=Mark C Smith, ou=Information Technology Division, ou=Faculty and Staff, ou=People, o=University of Michigan, c=US
267 telephoneNumber=+1 313 764-2277
273 ldapsearch -u -t "uid=mcs" jpegPhoto audio
276 will perform a subtree search using the default search base for entries
277 with user id of "mcs". The user friendly form of the entry's DN will be
278 output after the line that contains the DN itself, and the jpegPhoto
279 and audio values will be retrieved and written to temporary files. The
280 output might look like this if one entry with one value for each of the
281 requested attributes is found:
284 cn=Mark C Smith, ou=Information Technology Division, ou=Faculty and Staff, ou=People, o=University of Michigan, c=US
285 Mark C Smith, Information Technology Division, Faculty and Staff, People, University of Michigan, US
286 audio=/tmp/ldapsearch-audio-a19924
287 jpegPhoto=/tmp/ldapsearch-jpegPhoto-a19924
293 ldapsearch -L -s one -b "c=US" "o=university*" o description
296 will perform a one-level search at the c=US level for all organizations
297 whose organizationName begins with \fBuniversity\fP. Search results
298 will be displayed in the LDIF format.
299 The organizationName and description attribute values will be retrieved
300 and printed to standard output, resulting in output similar to this:
303 dn: o=University of Alaska Fairbanks, c=US
304 o: University of Alaska Fairbanks
305 description: Preparing Alaska for a brave new yesterday
306 description: leaf node only
308 dn: o=University of Colorado at Boulder, c=US
309 o: University of Colorado at Boulder
310 description: No personnel information
311 description: Institution of education and research
313 dn: o=University of Colorado at Denver, c=US
314 o: University of Colorado at Denver
318 description: Institute for Higher Learning and Research
320 dn: o=University of Florida, c=US
321 o: University of Florida
323 description: Warper of young minds
328 Exit status is 0 if no errors occur. Errors result in a non-zero exit
329 status and a diagnostic message being written to standard error.
340 .IR "A String Representation of Distinguished Names",
343 ISODE Consortium, March 1995.
346 .IR "A String Representation of LDAP Search Filters",
349 University of Michigan, December 1993.
352 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
354 is derived from University of Michigan LDAP 3.3 Release.