このエントリーをはてなブックマークに追加

9. ファイルサーバの追加

9.1. OSセットアップ

OS環境準備 と同じように、OSをセットアップします。今回はubuntuで行います。

9.2. sambaインストール

ADのメンバーサーバであれば、samba3系でも対応しているので、ubuntuのパケージ版をインストールします。

$ sudo apt-get install samba winbind
$ smbstatus --version
Version 3.6.6

ノート

samba 3.6.6が入ります。ubuntu12.10ではすでに4系のパッケージもあるようですが、3系を使います。

9.3. ネットワーク設定

ネットワーク設定 と同じように、ネットワークの設定を行います。今回の環境では、ubuntuを使用していますのでubuntu用の設定方法になります。

9.3.1. /etc/hostname

$ cat /etc/hostname
filesv1.example.local

9.3.2. /etc/hosts

$ head -3 /etc/hosts
127.0.0.1 localhost
10.0.0.50 filesv1.example.local filesv1

ノート

headで表示しているのは、ipv6の表示を見せたくなかったからです。

9.3.3. /etc/resolvconf/resolv.conf.d/base

$ cat /etc/resolvconf/resolv.conf.d/base
search example.local
nameserver 10.0.0.10
nameserver 10.0.0.20

ノート

旧来の/etc/resolv.confでは、上書きされてしまうためこちらのファイルを設定しております。

9.3.4. /etc/network/interfaces

$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
  address 10.0.0.50
  netmask 255.255.255.0
  network 10.0.0.0
  broadcast 10.0.0.255
  gateway 10.0.0.1

9.4. メンバーサーバとしてセットアップ

ファイルサーバをADのメンバーサーバとしてセットアップします。

9.4.1. smb.confの作成

# cat /etc/samba/smb.conf
[global]
workgroup = EXAMPLE
realm = EXAMPLE.LOCAL
security = ADS
encrypt passwords = yes
# Optional. Use only if Samba cannot determine the Kerberos server automatically.
password server = 10.0.0.10 10.0.0.20
winbind cache time = 3
winbind separator = @
winbind use default domain = yes
winbind enum users = yes
winbind enum groups = yes
idmap uid = 30000-90000
idmap gid = 30000-90000

load printers = no
printcap name = /dev/null
printing = bsd

max protocol = smb2

[全社共有]
path = /home/samba-share
read only = no
#valid user = Domain Users
create mask = 0660
directory mask = 0770

9.4.3. winbind設定

  • /etc/nsswitch.conf にwinbind追加

    $ head /etc/nsswitch.conf
    # /etc/nsswitch.conf
    #
    # Example configuration of GNU Name Service Switch functionality.
    # If you have the `glibc-doc-reference' and `info' packages installed, try:
    # `info libc "Name Service Switch"' for information about this file.
    
    passwd:         compat winbind
    group:          compat winbind
    shadow:         compat
    

    ノート

    passwd: group: のcompatの後ろにwinbindを追加

  • winbindリスタート

    $ sudo stop winbind
    $ sudo start winbind
    
  • wbinfoで確認

    $ wbinfo -u
    administrator
    krbtgt
    guest
    user1
    user2
    

    ノート

    AD上のユーザが取得出来るか確認する。

  • getentで確認

    $ getent passwd |tail
    messagebus:x:102:105::/var/run/dbus:/bin/false
    whoopsie:x:103:106::/nonexistent:/bin/false
    landscape:x:104:109::/var/lib/landscape:/bin/false
    sshd:x:105:65534::/var/run/sshd:/usr/sbin/nologin
    administrator:*:30000:30000:Administrator:/home/EXAMPLE/administrator:/bin/false
    krbtgt:*:30001:30000:krbtgt:/home/EXAMPLE/krbtgt:/bin/false
    guest:*:30002:30001:Guest:/home/EXAMPLE/guest:/bin/false
    user1:*:30003:30000:user1:/home/EXAMPLE/user1:/bin/false
    user2:*:30004:30000:user2:/home/EXAMPLE/user2:/bin/false
    
    $ getent group |tail
    domain controllers:x:30006:
    enterprise admins:x:30007:administrator
    domain computers:x:30008:
    cert publishers:x:30009:
    dnsupdateproxy:x:30010:
    domain admins:x:30011:administrator
    domain guests:x:30001:
    schema admins:x:30012:administrator
    domain users:x:30000:
    dnsadmins:x:30013:
    

    ノート

    ADのユーザ、グループが取得出来るか確認する。

9.4.4. 共有フォルダの作成

$ sudo mkdir /home/samba-share
$ sudo chmod 770 /home/samba-share/
$ sudo chgrp domain\ users /home/samba-share/
$ sudo ls -ld /home/samba-share/
drwxrwx--- 2 root domain users 4096  1月  9 11:15 /home/samba-share/

9.4.5. デーモン再起動

$ sudo restart smbd
$ sudo restart nmbd
$ sudo restart winbind

9.4.6. 共有フォルダ確認

クライアントPCから接続して、共有フォルダが見えるか確認する。

ノート

検証時正しく動作しない場合があった(パスワードを求められる)ので、クライアントとファイルサーバを一度再起動したほうが良いかもしれません。


目次

前のトピックへ

8. Active Directory各種設定

次のトピックへ

10. 拠点セットアップ

外部リンク

ブログ