[CentOS6][samba4] CentOS6.5 で ActiveDirectory のドメインに参加する


Create: 2014/10/01
LastUpdate: 2014/10/01
メニューに戻る

[CentOS6][samba4] samba4 で ActiveDirestoryサーバの構築 (Windows2008R2互換)」で構築したActiveDirectory のドメインに CentOS6.5 を参加させて、ActiveDirectory に登録したユーザでログインできるか確認してみます。
なお、CentOS6.5 は、ActiveDirectory サーバと同様にインターネット上のNTPサーバと時刻同期させています。

1.hosts の変更


/etc/hosts に ActiveDirectory サーバを登録します。
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.85 samba.blue21.local
試しに /etc/resolv.conf にはActiveDirectory以外のDNSサーバを指定してみます。
# cat /etc/resolv.conf
nameserver 192.168.1.10

2.追加パッケージ


ActiveDirectory 認証に必要なパッケージをインストールします。
# yum -y install nscd pam_krb5 samba-winbind

3.認証の設定


テキストコンソール用のツールを使って認証設定を行います。
日本語だと画面が崩れるので、英語環境で動くようにしてコマンドを実行します。
# env LANG=C authconfig-tui
下図のように画面が表示されます。



下図のように、[User Information] と [Authentication] を変更します。
矢印キーで移動してスペースキーを押下すると"*"がついたり、消えたりします。
TABキーで[Nexy]に移動してENTERします。



下図のようにActiveDirectory の情報を入力します。
ActiveDirectoryに接続するために、TABキーで [JoinDomain]に移動し、ENTERします。



[Yes] をENTERして、設定を保存します。



[Password] に ActiveDirectory の Administratorユーザのパスワードを入力し、[OK]をENTERします。



下図の画面に戻るので、[OK]をENTERします。



ActiveDirectory への接続結果(赤字)が以下のように表示されていればOKです。
# env LANG=C authconfig-tui
[/usr/bin/net join -w BLUE21 -S samba.blue21.local -U Administrator]
Enter Administrator's password:<...>

Using short domain name -- BLUE21
Joined 'DEVHOST01' to dns domain 'blue21.local'
No DNS domain configured for devhost01. Unable to perform DNS Update.
DNS update failed!
Winbind サービスを起動中:                                  [  OK  ]
nscd を起動中:                                             [  OK  ]

4.ログインの確認


自分自身に ActiveDirectory ユーザ(blue21\test_user01)でログインしてみます。
# ssh -l 'blue21\test_user01' localhost
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is 0b:03:f5:44:f8:ff:1d:d5:eb:57:5f:0b:f7:e8:38:06.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
blue21\test_user01@localhost's password:
Could not chdir to home directory /home/BLUE21/test_user01: No such file or directory
-bash-4.1$
上記のように表示されたらログイン成功です。
ホームディレクトリは /home/BLUE21/test_user01 となっていますが、作成していないので not found になっています。
root ユーザで以下のようにディレクトリをつくります。
# mkdir -p /home/BLUE21/test_user01
# chmod 1777 /home/BLUE21/test_user01
ユーザID、グループを確認すると以下のとおり。
$ id
uid=16777216(BLUE21\test_user01) gid=16777216(BLUE21\domain users) 所属グループ=16777216(BLUE21\domain users)

一応、自分自身に root でログインできることを確認します。
# ssh -l root localhost
root@localhost's password:
Last login: Wed Oct  1 10:56:24 2014 from pc01.blue21.ddo.jp
#

ログイン成功の確認ができたら、念のためサーバを再起動します。