Samba PDC (squeeze)の構築手順

提供:Samba-JP
2011年7月4日 (月) 14:47時点におけるMonyo (トーク | 投稿記録)による版
ナビゲーションに移動検索に移動

Debian GNU/Linux リリース媒体の入手

小さなCD にある 180MB 以下のイメージを入手。

  • debian-6.0.0-i386-netinst.iso を使用

VMware 仮想マシンの作成

仮想マシン作成の手順

仮想マシン作成ウィザードで以下を指定 (VMware Workstation 7.1.1 日本語版環境で構築)

  • カスタム を選択
  • ハードウェア互換性として Workstation 5 を選択(なるべく多くのバージョンで動作するように)
    • ESX Server はチェックしない
  • ゲストOSとして Linuxを選択
  • バージョンとして Debian 5 を選択
  • 仮想マシン名として sambapdc4 を指定
  • プロセッサ数として 1 を指定
  • メモリ容量を 256MB に変更
  • ネットワーク接続を NAT を使用 のまま
  • I/O コントローラタイプはLSI Logic のまま
  • 仮想ディスクの新規作成を選択
  • 仮想ディスクタイプとして SCSI を選択
  • ディスクサイズほかは規定値のまま(8.0 GB / あらかじめ割り当てない / 仮想ディスクを単一ファイル)

Squeeze インストール

インストーラでの設定

インストーラで以下を指定

  • 初期画面で「Install」を選択(Graphical Installではなく)
  • 「Choose language」で「English」を選択
  • 「Choose country」で「Japan」を選択
  • 「Default locale」で「United States」を選択
  • 「Keymap to use」で「American English」を選択
  • 「Configure network」で以下を指定
    • ホスト名「sambapdc」
    • ドメイン名「samba.local」
  • 「Set up users and passwords」で以下を指定
    • 「Root password」に「samba」を指定
    • 「Set up users and passwords」の「Full name for new user」で「Debian installer main menu」になるまで、何度か「<Go back>」を選択
これを行わずに普通にインストールを続行すると、無用なパッケージがインストールされるので注意。
  • 「Partition disks」で以下を指定
    • 「Guided - use entire disk(デフォルト)」を選択
    • パーティション構成で「All files in one partition(デフォルト)」を選択
    • 「Finish partitioning and write changes to disk」を押す
    • 「Write changes to disks?」に <Yes>を選択
  • ここで「Installing the base system」画面になり、基本的なパッケージがインストールされる
  • 「Install the GRUB boot loader on a hard disk」を選択
    • Install the GRUB boot loader to the master boot record? に <yes> を選択
  • Installation complete で <Continue>
ここで再起動が行われる

このほか聞かれた場合は、以下のように選択

  • Install the base system を選択
  • Kernel to install で「linux-image-2.6-686」を選択
  • Use a network mirror で <No>

基本的な設定

  • eth1 用の設定を追加(オプション)
仮想マシンのイメージを他で転用すると、仮想マシン起動時に「Create new identity」といったメッセージが表示される。ここで Yes を選択した場合は MACアドレスが変更されるため、 OS から認識されるインタフェース名も eth0 ではなく eth1 や eth2 などになる。そのための設定
/etc/network/interfaces に以下を追加(eth1の場合)
allow-hotplug eth1
iface eth1 inet dhcp
  • APT コマンドの設定とパッケージの更新

/etc/apt/sources.list の内容を以下に変更

deb http://ftp.jp.debian.org/debian etch main contrib
deb http://security.debian.org/ etch/updates main contrib
  • NFS クライアントのインストール

以下のコマンドを実行してNFSクライアントをインストールする

# apt-get update
# apt-get install nfs-common portmap
# apt-get clean

これは、今後のインストール作業に際して、可能な限りリモートのディスクを利用するためのもので、インストール自体に必須ではない。

カーネルがバージョンアップされた場合は、一度再起動する

  • リモートマシンの作業用ディスク領域のマウント
# mount 192.168.135.1:/export/var/cache/apt/archives /var/cache/apt/archives

ダウンロードしたdebファイルが置かれるディレクトリをマウントしておく

  • ssh のインストール(オプション)
apt-get install ssh

SSH クライアントも併せてインストールされる。

  • lv(ページャ)のインストール(オプション)
apt-get install lv
  • ACLおよび拡張属性関連のパッケージインストールと設定
apt-get install attr acl 
  • /etc/fstab で acl,user_xattr をマウントオプションに追加

errors=remount-rodefaults,acl,user_xattr,errors=remount-ro に変更する。

変更後再起動するか、remount オプションにより動的にマウントオプションを変更する。

  • /etc/fstab で /tmp を tmpfs にする
/dev/shm   /tmp   tmpfs defaults 0 0

を追加して再起動する。

Samba + LDAP 環境の設定

パッケージのインストールと基本設定

libnss-ldap / libpam-ldap のインストールと設定

apt-get install libnss-ldap libpam-ldap
  • libnss-ldap の設定
URL は ldapi:///
DN は、dc=samba,dc=local
LDAPのバージョンは3
LDAP account for root は cn=manager,dc=samba,dc=local
パスワードは ldap
  • libpam-ldap の設定
Allow LDAP admin account ... は <Yes>

:Does the LDAP database require login? は <No>

LDAP account for root は cn=manager,dc=samba,dc=local
パスワードは ldap

!-- * nscd をアンインストール !-- nscd が動作していると(なぜか)LDAP 上のユーザ情報が Linux から認識されないため、ここでは削除する。

  • /etc/nsswitch.conf ファイルに LDAP キーワードを追加
--- nsswitch.conf.org   2009-09-10 03:02:29.000000000 +0900
+++ nsswitch.conf       2009-09-07 22:10:09.000000000 +0900
@@ -4,9 +4,9 @@
 # If you have the `glibc-doc-reference' and `info' packages installed, try:
 # `info libc "Name Service Switch"' for information about this file.

-passwd:         compat
-group:          compat
+passwd:         compat ldap
+group:          compat ldap
 shadow:         compat

 hosts:          files dns
 networks:       files

Squeeze において、PAM関連ファイルは、pam-auth-update コマンドが内部的に実行されて自動で設定されるため、基本的に修正は不要。

Samba / OpenLDAP のインストール

  • slapd パッケージのインストール
# apt-get install slapd ldap-utils
Admin password には ldap を指定する。

ldap-utils パッケージは管理用。動作上は不要だが、以降の説明ではインストールされていることを前提とする。

  • Samba 関連パッケージのインストール
# apt-get install samba winbind smbclient
workgroup/domain name に SAMBADOM を指定

smbclient パッケージは管理用。動作上は不要。

  • pam_smbpass パッケージのインストール
# apt-get install libpam-smbpass
  • cracklib パッケージのインストール
  1. apt-get install libcrack2

※crackcheck コマンドが使用する。

  • Samba スキーマファイルをインストール
# apt-get install samba-doc
# apt-get clean
# zcat /usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz > /etc/ldap/schema/samba-3.2.5.schema
# apt-get remove samba-doc

LDAP の設定

Squeeze からは、設定を LDAP 中に保持する設定となっているため、注意が必要。


  • /etc/ldap/slapd.conf を設定
--- slapd.conf.org      2009-09-12 19:26:34.000000000 +0900
+++ slapd.conf  2009-09-12 19:50:27.000000000 +0900
@@ -12,6 +12,7 @@
 include         /etc/ldap/schema/cosine.schema
 include         /etc/ldap/schema/nis.schema
 include         /etc/ldap/schema/inetorgperson.schema
+include         /etc/ldap/schema/samba-3.2.5.schema

 # Where the pid file is put. The init.d script
 # will not stop the server if you change this.
@@ -57,7 +58,8 @@

 # rootdn directive for specifying a superuser on the database. This is needed
 # for syncrepl.
-# rootdn          "cn=admin,dc=samba,dc=local"
+rootdn          "cn=admin,dc=samba,dc=local"
+rootpw "ldap"

 # Where the database file are physically stored for database #1
 directory       "/var/lib/ldap"
@@ -83,7 +85,7 @@
 dbconfig set_lk_max_lockers 1500

 # Indexing options for database #1
-index           objectClass eq
+index           objectClass,uidNumber,gidNumber,uid,sambaSID,cn,memberuid eq

 # Save the time that the entry gets modified, for database #1
 lastmod         on
@@ -106,6 +108,16 @@
         by self write
         by * none

+access to attrs=loginShell
+        by dn="cn=admin,dc=samba,dc=local" write
+        by self write
+       by * read
+
+access to attrs=sambaNTPassword,sambaLMPassword,sambaPwdLastSet,sambaPwdMustChange
+        by dn="cn=admin,dc=samba,dc=local" write
+#        by self write
+        by * none
+
 # Ensure read access to the base for things like
 # supportedSASLMechanisms.  Without this you may
 # have problems with SASL not knowing what

crackcheck コマンドのインストール

開発環境のあるマシン上で以下を実施

# apt-get install cracklib2-dev
# apt-get install samba-doc
# cd /usr/share/doc/samba-doc/examples/auth/crackcheck
# make
# strip crackcheck

生成された crackcheck バイナリを、今回構築するマシンの /usr/local/sbin/crackcheck にインストール。


  • /etc/pam.d/common-account
(-は行削除、+は行追加)
+account sufficient      pam_ldap.so
 account required        pam_unix.so
  • /etc/pam.d/common-auth
(-は行削除、+は行追加)
-auth   required        pam_unix.so nullok_secure
+auth   sufficient      pam_ldap.so
+auth   required        pam_unix.so nullok_secure use_first_pass
  • /etc/pam.d/common-session
(-は行削除、+は行追加)
 session        required        pam_unix.so
+session        optional        pam_ldap.so
+session        optional        pam_mkhomedir.so skel=/etc/skel
  • /etc/pam.d/common-password
(-は行削除、+は行追加)
-password   required   pam_unix.so nullok obscure
+password   sufficient pam_unix.so nullok obscure min=4 max=8 md5
+password   required pam_ldap.so try_first_pass
+password   required pam_smbpass.so use_authtok try_first_pass

pam_smbpass 行は、次でインストールする pam_smbpass モジュールのための設定



  • リモートログイン用アカウントの作成
# useradd -m local
# passwd local

パスワードは「local」に設定。


# mkdir /tmp/a
# mount -t tmpfs /dev/shm /tmp/a
# cd /tmp/a
# wget ftp://ftp.jp.debian.org/debian/pool/main/n/nfs-utils/nfs-common_1.2.3-2_i386.deb
# dpkg -i --force-depends nfs-common_1.2.3-2_i386.deb


apt-get clean




mgrshare スクリプトのインストール

mgrshare スクリプトを作成の上、以下を実施( mgrshare は [| sambapdc-3.0.tar.gz] 内にあります)

# mv mgrshare  /usr/local/sbin/mgrshare
# chmod +x /usr/local/sbin/mgrshare

smbchsh のインストール

一般ユーザがシェルを変更できるように以下のスクリプトを /usr/local/bin/smbchsh としてインストール

#!/bin/sh

SHELL=$1

echo "dn: uid=${USER},ou=users,dc=samba,dc=local
changetype: modify
replace: loginShell
loginShell: $1
" | ldapmodify -x -D "uid=${USER},ou=users,dc=samba,dc=local" -W

ホームディレクトリの作成

pam_mkhomedir を用いる関係上、パーミッションの設定が必須

# mkdir /home/SAMBADOM
# chmod 1777 /home/SAMBADOM

Samba ドメインで使用するディレクトリの作成

# mkdir /var/lib/samba/shares
# mkdir /var/lib/samba/shares/netlogon
# mkdir /var/lib/samba/shares/profiles
# chmod 1777 /var/lib/samba/shares/profiles

ダミーの printcap ファイルの作成

printing = bsd を指定し、/etc/printcap ファイルを作成することで、CUPS サーバに接続できないというエラー表示を抑止する。

# touch /etc/printcap

Samba + LDAP 環境の設定

初期スキーマの作成

  • samba.local.ldif ファイルの作成
dn: ou=users,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: users

dn: ou=groups,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: groups

dn: ou=idmap,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: idmap

dn: ou=computers,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: computers
  • ldapadd コマンドで上記 LDIF ファイルの内容を登録
# cat samba.local.ldif | ldapadd -h localhost -D cn=admin,dc=samba,dc=local -W -x

Enter LDAP Password: 
adding new entry "ou=users,dc=samba,dc=local"

adding new entry "ou=groups,dc=samba,dc=local"
...


Samba の設定

  • Samba の停止
# /etc/init.d/samba stop
# /etc/init.d/winbind stop
  • smb.conf のインストール

smb.conf ファイルを作成( smb.conf は [| sambapdc-3.0.tar.gz] 内にあります)の上、以下を実施

# mv /etc/samba/smb.conf /etc/samba/smb.conf.org
# mv smb.conf /etc/samba/smb.conf
  • LDAP パスワードの格納
# smbpasswd -w ldap
Setting stored password for "cn=admin,dc=samba,dc=local" in secrets.tdb
  • Samba の基本ユーザ情報を LDAP に格納

net sam provision コマンドを実行する前に、あらかじめ winbindd (のみ)を起動しておく必要がある。

# /etc/init.d/winbind start
Starting the Winbind daemon: winbind.
# net sam provision
Checking for Domain Users group.
Adding the Domain Users group.
Checking for Domain Admins group.
Adding the Domain Admins group.
Check for Administrator account.
Adding the Administrator user.
Checking for Guest user.
Adding the Guest user.
Checking Guest's group.
Adding the Domain Guests group.
  • Administrator アカウントの初期設定
パスワードを「samba」に設定
# smbpasswd Administrator
New SMB password:
Retype new SMB password:
ユーザ権利を付与
# net sam rights grant administrator SeMachineAccountPrivilege
Granted SeMachineAccountPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeTakeOwnershipPrivilege
Granted SeTakeOwnershipPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeBackupPrivilege
Granted SeBackupPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeRestorePrivilege
Granted SeRestorePrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeRemoteShutdownPrivilege
Granted SeRemoteShutdownPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SePrintOperatorPrivilege
Granted SePrintOperatorPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeAddUsersPrivilege
Granted SeAddUsersPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeDiskOperatorPrivilege
Granted SeDiskOperatorPrivilege to SAMBADOM\administrator

共有ディレクトリの作成

Domain Usersグループに所属するユーザであれば、誰でも読み書き可能な共有ディレクトリを作成しておく。

# mkdir /home/shared
# chgrp domusers /home/shared
# chmod g+ws /home/shared

共有内に、あらかじめ URL ファイルをいくつか設置しておく。

動作確認

以下のコマンドを実行
# apt-get update

apt-get clean
apt-get upgrade security
apt-get clean
カーネルがバージョンアップされた場合は、一度再起動する
  • ssh パッケージのインストール
apt-get install openssh-server
apt-get clean

クライアントも併せてインストールされる。

  • lv(ページャ)をインストール
apt-get install lv
apt-get clean
  • リモートログイン用アカウントの作成
# useradd -m local
# passwd local

パスワードは「local」に設定。

  • ACLおよび拡張属性関連のパッケージインストールと設定
apt-get install attr acl 
apt-get clean
/etc/fstab で acl,user_xattr をマウントオプションに追加
errors=remount-rodefaults,acl,user_xattr,errors=remount-ro に変更
再起動せずに、マウントオプションを変更
mount -o remount,defaults,acl,user_xattr,errors=remount-ro /dev/sda1 /

Samba + LDAP 環境の設定

パッケージのインストールと基本設定

libnss-ldap / libpam-ldap のインストールと設定

apt-get install libnss-ldap libpam-ldap
  • libnss-ldap の設定
URL は ldap://localhost/
DN は、dc=samba,dc=local
LDAPのバージョンは3
LDAP account for root は cn=admin,dc=samba,dc=local
パスワードは ldap
  • libpam-ldap の設定
Make local database admin... はデフォルトのまま
Does the LDAP database require login はデフォルトのまま(No)
LDAP account for root は cn=admin,dc=samba,dc=local
パスワードは ldap
  • nscd をアンインストール

nscd が動作していると(なぜか)LDAP 上のユーザ情報が Linux から認識されないため、ここでは削除する。

# apt-get remove nscd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  nscd
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 274kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 14825 files and directories currently installed.)
Removing nscd ...
Stopping Name Service Cache Daemon: nscd.
Processing triggers for man-db ...
  • /etc/nsswitch.conf ファイルに LDAP キーワードを追加
--- nsswitch.conf.org   2009-09-10 03:02:29.000000000 +0900
+++ nsswitch.conf       2009-09-07 22:10:09.000000000 +0900
@@ -4,9 +4,9 @@
 # If you have the `glibc-doc-reference' and `info' packages installed, try:
 # `info libc "Name Service Switch"' for information about this file.

-passwd:         compat
-group:          compat
-shadow:         compat
+passwd:         compat ldap
+group:          compat ldap
+shadow:         compat ldap

 hosts:          files dns
 networks:       files
  • /etc/pam.d/common-account
(-は行削除、+は行追加)
+account sufficient      pam_ldap.so
 account required        pam_unix.so
  • /etc/pam.d/common-auth
(-は行削除、+は行追加)
-auth   required        pam_unix.so nullok_secure
+auth   sufficient      pam_ldap.so
+auth   required        pam_unix.so nullok_secure use_first_pass
  • /etc/pam.d/common-session
(-は行削除、+は行追加)
 session        required        pam_unix.so
+session        optional        pam_ldap.so
+session        optional        pam_mkhomedir.so skel=/etc/skel
  • /etc/pam.d/common-password
(-は行削除、+は行追加)
-password   required   pam_unix.so nullok obscure
+password   sufficient pam_unix.so nullok obscure min=4 max=8 md5
+password   required pam_ldap.so try_first_pass
+password   required pam_smbpass.so use_authtok try_first_pass

pam_smbpass 行は、次でインストールする pam_smbpass モジュールのための設定

Samba / OpenLDAP のインストール

  • slapd パッケージのインストール
apt-get install slapd ldap-utils
apt-get clean
Admin password には ldap を指定する。

ldap-utils パッケージは管理用。動作上は不要。

  • Samba 関連パッケージのインストール
# apt-get install samba winbind smbclient
# apt-get clean
workgroup/domain name に SAMBADOM を指定
WINS settings from DHCP? に No(デフォルト)を指定

smbclient パッケージは管理用。動作上は不要。

  • pam_smbpass パッケージのインストール
# apt-get install libpam-smbpass
  • cracklib パッケージのインストール
  1. apt-get install libcrack2

※crackcheck コマンドが使用する。

  • Samba スキーマファイルをインストール
# apt-get install samba-doc
# apt-get clean
# zcat /usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz > /etc/ldap/schema/samba-3.2.5.schema
# apt-get remove samba-doc
  • /etc/ldap/slapd.conf を設定
--- slapd.conf.org      2009-09-12 19:26:34.000000000 +0900
+++ slapd.conf  2009-09-12 19:50:27.000000000 +0900
@@ -12,6 +12,7 @@
 include         /etc/ldap/schema/cosine.schema
 include         /etc/ldap/schema/nis.schema
 include         /etc/ldap/schema/inetorgperson.schema
+include         /etc/ldap/schema/samba-3.2.5.schema

 # Where the pid file is put. The init.d script
 # will not stop the server if you change this.
@@ -57,7 +58,8 @@

 # rootdn directive for specifying a superuser on the database. This is needed
 # for syncrepl.
-# rootdn          "cn=admin,dc=samba,dc=local"
+rootdn          "cn=admin,dc=samba,dc=local"
+rootpw "ldap"

 # Where the database file are physically stored for database #1
 directory       "/var/lib/ldap"
@@ -83,7 +85,7 @@
 dbconfig set_lk_max_lockers 1500

 # Indexing options for database #1
-index           objectClass eq
+index           objectClass,uidNumber,gidNumber,uid,sambaSID,cn,memberuid eq

 # Save the time that the entry gets modified, for database #1
 lastmod         on
@@ -106,6 +108,16 @@
         by self write
         by * none

+access to attrs=loginShell
+        by dn="cn=admin,dc=samba,dc=local" write
+        by self write
+       by * read
+
+access to attrs=sambaNTPassword,sambaLMPassword,sambaPwdLastSet,sambaPwdMustChange
+        by dn="cn=admin,dc=samba,dc=local" write
+#        by self write
+        by * none
+
 # Ensure read access to the base for things like
 # supportedSASLMechanisms.  Without this you may
 # have problems with SASL not knowing what

crackcheck コマンドのインストール

開発環境のあるマシン上で以下を実施

# apt-get install cracklib2-dev
# apt-get install samba-doc
# cd /usr/share/doc/samba-doc/examples/auth/crackcheck
# make
# strip crackcheck

生成された crackcheck バイナリを、今回構築するマシンの /usr/local/sbin/crackcheck にインストール。

mgrshare スクリプトのインストール

mgrshare スクリプトを作成の上、以下を実施( mgrshare は [| sambapdc-3.0.tar.gz] 内にあります)

# mv mgrshare  /usr/local/sbin/mgrshare
# chmod +x /usr/local/sbin/mgrshare

smbchsh のインストール

一般ユーザがシェルを変更できるように以下のスクリプトを /usr/local/bin/smbchsh としてインストール

#!/bin/sh

SHELL=$1

echo "dn: uid=${USER},ou=users,dc=samba,dc=local
changetype: modify
replace: loginShell
loginShell: $1
" | ldapmodify -x -D "uid=${USER},ou=users,dc=samba,dc=local" -W

ホームディレクトリの作成

pam_mkhomedir を用いる関係上、パーミッションの設定が必須

# mkdir /home/SAMBADOM
# chmod 1777 /home/SAMBADOM

Samba ドメインで使用するディレクトリの作成

# mkdir /var/lib/samba/shares
# mkdir /var/lib/samba/shares/netlogon
# mkdir /var/lib/samba/shares/profiles
# chmod 1777 /var/lib/samba/shares/profiles

ダミーの printcap ファイルの作成

printing = bsd を指定し、/etc/printcap ファイルを作成することで、CUPS サーバに接続できないというエラー表示を抑止する。

# touch /etc/printcap

Samba + LDAP 環境の設定

初期スキーマの作成

  • samba.local.ldif ファイルの作成
dn: ou=users,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: users

dn: ou=groups,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: groups

dn: ou=idmap,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: idmap

dn: ou=computers,dc=samba,dc=local
objectClass: top
objectClass: organizationalUnit
ou: computers
  • ldapadd コマンドで上記 LDIF ファイルの内容を登録
# cat samba.local.ldif | ldapadd -h localhost -D cn=admin,dc=samba,dc=local -W -x

Enter LDAP Password: 
adding new entry "ou=users,dc=samba,dc=local"

adding new entry "ou=groups,dc=samba,dc=local"
...


Samba の設定

  • Samba の停止
# /etc/init.d/samba stop
# /etc/init.d/winbind stop
  • smb.conf のインストール

smb.conf ファイルを作成( smb.conf は [| sambapdc-3.0.tar.gz] 内にあります)の上、以下を実施

# mv /etc/samba/smb.conf /etc/samba/smb.conf.org
# mv smb.conf /etc/samba/smb.conf
  • LDAP パスワードの格納
# smbpasswd -w ldap
Setting stored password for "cn=admin,dc=samba,dc=local" in secrets.tdb
  • Samba の基本ユーザ情報を LDAP に格納

net sam provision コマンドを実行する前に、あらかじめ winbindd (のみ)を起動しておく必要がある。

# /etc/init.d/winbind start
Starting the Winbind daemon: winbind.
# net sam provision
Checking for Domain Users group.
Adding the Domain Users group.
Checking for Domain Admins group.
Adding the Domain Admins group.
Check for Administrator account.
Adding the Administrator user.
Checking for Guest user.
Adding the Guest user.
Checking Guest's group.
Adding the Domain Guests group.
  • Administrator アカウントの初期設定
パスワードを「samba」に設定
# smbpasswd Administrator
New SMB password:
Retype new SMB password:
ユーザ権利を付与
# net sam rights grant administrator SeMachineAccountPrivilege
Granted SeMachineAccountPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeTakeOwnershipPrivilege
Granted SeTakeOwnershipPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeBackupPrivilege
Granted SeBackupPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeRestorePrivilege
Granted SeRestorePrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeRemoteShutdownPrivilege
Granted SeRemoteShutdownPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SePrintOperatorPrivilege
Granted SePrintOperatorPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeAddUsersPrivilege
Granted SeAddUsersPrivilege to SAMBADOM\administrator
# net sam rights grant administrator SeDiskOperatorPrivilege
Granted SeDiskOperatorPrivilege to SAMBADOM\administrator

共有ディレクトリの作成

Domain Usersグループに所属するユーザであれば、誰でも読み書き可能な共有ディレクトリを作成しておく。

# mkdir /home/shared
# chgrp domusers /home/shared
# chmod g+ws /home/shared

共有内に、あらかじめ URL ファイルをいくつか設置しておく。

動作確認

Windows NT Workstation 4.0 SP6a(以下 NTWS40) から Samba ドメインに参加

  • ドメインに参加
  • Administrator としてログオン

試験用ユーザを作成

  • ldap01 ユーザを作成
    • パスワード ldap01
    • ホームディレクトリ \\sambapdc\ldap01 を H: にマウント
    • ユーザ名「LDAP User 01」
    • パスワードを無期限にする

動作確認

  • 初期状態で
    • ldap01 として ssh でリモートマシンからログインが成功する
    • smbchsh コマンドによりシェルを変更できる
ldap01@sambapdc:~$ /usr/local/bin/smbchsh /bin/sh
Enter LDAP Password:
modifying entry "uid=ldap01,ou=users,dc=samba,dc=local"

ldap01@sambapdc:~$ getent passwd ldap01
ldap01:*:10002:10000:ldap01:/home/SAMBADOM/ldap01:/bin/sh
    • ldap01 として NTWS40 にログオンできる (パスワード ldap01)
  • smbpasswd コマンドによりパスワードを変更できる
その際、crackcheck コマンドにより、簡単なパスワードは設定できない
    • ldap01 として NTWS40 にログオンできる (パスワードは変更後)
    • ldap01 として ssh でリモートマシンからログインが成功する(パスワードは変更後)
  • passwd コマンドによりパスワードを変更できる
    • ldap01 として NTWS40 にログオンできる (パスワードは変更後)
    • ldap01 として ssh でリモートマシンからログインが成功する(パスワードは変更後)
  • Windows 2000 以降で Ctrl+Alt+Del した画面のパスワードの変更、からパスワードが変更できる
その際、crackcheck コマンドにより、簡単なパスワードは設定できない
    • ldap01 として NTWS40 にログオンできる (パスワードは変更後)
    • ldap01 として ssh でリモートマシンからログインが成功する(パスワードは変更後)
  • Windows 2000 に Administrator としてログオンして、「コンピュータ管理」ツールから
    • ファイル共有が作成できる
    • 作成したファイル共有にアクセスできる
    • ファイル共有が削除できる

※Windows NT Workstation 4.0 からの共有の作成は、なぜかうまく動作していません。