2018年2月3日土曜日

【コピペ用Tips】ldapsearchコマンド

# vars
_ldapuri=ldap://ldap.example.com/
_binddn=cn=user01,ou=administrators,dc=example,dc=com
_basedn=dc=example,dc=com

# command
ldapsearch -v -LLL -H $_ldapuri -D $_binddn -W -b $_basedn "(objectClass=*)"

ちょっとだけ解説。

  • -v: 詳細を出力する(stderrへ出力)
  • -LLL: レスポンスをコメントなしでLDIF形式で出力する
  • -H: 接続するLDAPサーバのURIを指定
  • -D: bindユーザのDN(distinguished name)を指定
  • -W: bindユーザのパスワードをプロンプトから入力する
  • -b: サーチベースDNを指定
  • "(...)": LDAPフィルタ

Ubuntu、CentOSへのインストールについてはこちら