Samba で Active Directory を使った認証を実現するには

2008-8-13 13:20
このエントリーをはてなブックマークに追加

Samba 3.0 で Active Directory の認証をする方法です。試したのは CentOS 5.2 の samba-3.0.28 です。Samba のバージョンによっては設定方法が異なることもあります。また最新版ではこの方法は使えないかもしれません。

以下の設定例では、Samba を動作させる Linux ホストを linux1、Active Directory のドメインは example.local、ドメインコントローラは ads1.example.local の場合として記述しています。

smb.conf の設定

    [global]
        workgroup = EXAMPLE
        smb ports = 445
        netbios name = LINUX1
        hosts allow = 127. 192.168.0.0/24

        security = ads
        realm = EXAMPLE.LOCAL
        passdb backend = tdbsam
        password server = ads1
        encrypt passwords = Yes

        domain master = no
        domain logons = no
        wins support = no
        wins proxy = no
   -------------------------------------------------------------

krb5.conf の設定

続いて /etc/krb5.conf を設定します。

   [libdefaults]
    default_realm = EXAMPLE.LOCAL
    ……
   [realms]
    EXAMPLE.LOCAL = {
     kdc = ads1.example.local
     admin_server = ads1.example.local
     default_domain = example.local
    }
   [domain_realm]
    .example.local = EXAMPLE.LOCAL
    example.local = EXAMPLE.LOCAL

Active Directory への参加

まず kinit コマンドで初期化。

# kinit administrator@EXAMPLE.LOCAL
Password for administrator@EXAMPLE.LOCAL: ←ドメイン管理者のパスワードを入力

パスワードを入力してエラーがでなければ OK です。次に AD に参加します。

# net ads join -U administrator
administrator's password: ←ドメイン管理者のパスワード
Using short domain name -- EXAMPLE
Joined 'linux1' to realm 'EXAMPLE.LOCAL'

Active Directory に登録されました。Samba サービスを再起動します。

# service smb restart

これで、共有フォルダに Active Directory のログオン名・パスワードで入れるようになるはずです。ログオン名(ユーザ名)は username@EXAMPLE の形で指定します。

上記はいろいろ試行錯誤した結果なので何か抜けていたら済みません。

コメントはまだありません

No comments yet.

Sorry, the comment form is closed at this time.

32 queries. HTML convert time: 0.079 sec. Powered by WordPress. Valid XHTML
Copyright © 2003-2017 @ futuremix.org ログイン