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 使い方メモ(サーバはActive Directory)

Posted at

ldapsearch で Active Directory を検索します。

使い方を忘れていつもググっているので、メモしておきます。

環境

  • OpenLDAP 2.5.12

以下の使い方に出てくる固有名は、このような環境を前提にしています。

ADドメイン名
dc.example.com
ドメインコントローラホスト名
192.168.1.2
バインドDN(接続ユーザ)
CN=Administrator,CN=Users,DC=dc,DC=example,DC=com

RootDSEを取得

ldapsearch -x \
-D 'CN=Administrator,CN=Users,DC=dc,DC=example,DC=com' \
-w 'パスワード' \
-H ldap://192.168.1.2/ \
-s base

オプション説明

-x
SASLの代わりに、シンプル認証を使う
-D
接続するユーザのDN
-w
接続するユーザのパスワード
-H
LDAPサーバのURL
-s
検索範囲 base|one|sub|children のいずれか

全部一覧

ldapsearch -x \
-D 'CN=Administrator,CN=Users,DC=dc,DC=example,DC=com' \
-w 'パスワード' \
-H ldap://192.168.1.2/ \
-b 'DC=dc,DC=example,DC=com'

オプション説明

-b
取得対象の基礎となるDN

フィルタいろいろ

ldapsearchの引数に追加します。

ユーザのみ

(&(objectClass=user)(objectCategory=person))

グループのみ

(objectClass=group)

コンピュータのみ

(objectClass=computer)
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?