0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ldapsearchコマンドについて

Posted at

LDAPでは、情報はDIT(Directory Information Tree:ディレクトリ情報ツリー)と呼ばれる階層構造で管理される。DIT内のエントリ(情報)は、DN(Distinguished Name:識別名)を使用して識別。DNはツリーの末尾から、エントリの属性名とその値のペアを「,」でつないで記述。

LDIF(LDAP Data Interchange Format)ファイルもしくはLDIF形式のファイルとは、LDAPのディレクトリ情報をテキスト形式で記載しているファイル。LDAPサーバにディレクトリ情報を登録、変更する場合に使用される。

これらの形式で登録されたLDAPサーバのエントリを検索するためにはldapsearchコマンドを利用。

●ldapsearchコマンドの書式とオプション

ldapsearch [オプション] 検索条件 [出力属性]

オプション
・-h ホスト名|IPアドレス 検索を行うLDAPサーバを指定(指定しない場合はローカルホストを検索)
・-H URI 検索を行うLDAPサーバをldapuriで指定。ldap://~ またはldaps://~
・-x SASLを使用せずに簡易認証を行う
・-b 識別名 検索を開始する位置を指定
・-L 検索結果をLDIFv1形式で表示
・-LL 検索結果をコメントなしで表示
・-LLL 検索結果をコメントとLDAPバージョンの表記なしで表示

●検索条件は"(属性名=値)"のように指定し、条件指定には以下の演算子が使用できる。

・= 等しい
・* 任意の文字列(ワイルドカード)
・& かつ
・| または
・! ではない

検索条件を複数組み合わせるときには演算子を先に記述し、続けて計算対象の値を記述するポーランド記法(前置記法)で記述。例えば「1 + 2」は「+ 1 2」のように記述。

例)属性名cnの値がtestかつ属性名telephoneNumberの値が03で始まるエントリを検索する場合
【書式:(&(条件1)(条件2))】
"(&(cn=test)(telephoneNumber=03*))"

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?