Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   ldapsearch    ( 1 )

инструмент поиска LDAP (LDAP search tool)

  Name  |  Synopsis  |  Description  |  Options  |  Output format  |    Examples    |  Diagnostic  |  See also  |

Примеры (Examples)

The following command:

ldapsearch -LLL "(sn=smith)" cn sn telephoneNumber

will perform a subtree search (using the default search base and other parameters defined in ldap.conf(5)) for entries with a surname (sn) of smith. The common name (cn), surname (sn) and telephoneNumber values will be retrieved and printed to standard output. The output might look something like this if two entries are found:

dn: uid=jts,dc=example,dc=com cn: John Smith cn: John T. Smith sn: Smith sn;lang-en: Smith sn;lang-de: Schmidt telephoneNumber: 1 555 123-4567

dn: uid=sss,dc=example,dc=com cn: Steve Smith cn: Steve S. Smith sn: Smith sn;lang-en: Smith sn;lang-de: Schmidt telephoneNumber: 1 555 765-4321

The command:

ldapsearch -LLL -u -t "(uid=xyz)" jpegPhoto audio

will perform a subtree search using the default search base for entries with user id of "xyz". The user friendly form of the entry's DN will be output after the line that contains the DN itself, and the jpegPhoto and audio values will be retrieved and written to temporary files. The output might look like this if one entry with one value for each of the requested attributes is found:

dn: uid=xyz,dc=example,dc=com ufn: xyz, example, com audio:< file:///tmp/ldapsearch-audio-a19924 jpegPhoto:< file:///tmp/ldapsearch-jpegPhoto-a19924

This command:

ldapsearch -LLL -s one -b "c=US" "(o=University*)" o description

will perform a one-level search at the c=US level for all entries whose organization name (o) begins with University. The organization name and description attribute values will be retrieved and printed to standard output, resulting in output similar to this:

dn: o=University of Alaska Fairbanks,c=US o: University of Alaska Fairbanks description: Naturally Inspiring description: leaf node only

dn: o=University of Colorado at Boulder,c=US o: University of Colorado at Boulder description: No personnel information description: Institution of education and research

dn: o=University of Colorado at Denver,c=US o: University of Colorado at Denver o: UCD o: CU/Denver o: CU-Denver description: Institute for Higher Learning and Research

dn: o=University of Florida,c=US o: University of Florida o: UFl description: Warper of young minds

...