samba のインストール
|
ここでは,OS(redhat5.2)インストール時にsambaのオプション指定をし,設定ファイル
のみを変更することでsambaを活かす方法を示します.sambaを個別にインストール
された方は,設定ファイルやsamba関連コマンドのディレクトリが異なることがあります.
おおよその手順は以下の通りです.
(1)設定ファイル(/etc/smb.conf)の編集
(2)設定の確認
(3)sambaの再起動
(4)sambaパスワードファイルの生成
(5)sambaパスワードの設定
(1)設定ファイルの編集
作業はルート権限で行います.samba.confのオリジナルファイルをコピーした後に
テキストエディタで/etc/smb.confファイルを修正します.
sambaには,さまざまなオプションがあるのですが,ここでは,Windows環境のマスター
サーバとして動作させる設定とします.すなわち,マスタードメインコントローラとして
設定をします.WINS(Windows上のネームサーバ)としても動作できるのですが,ここ
では設定をしていません.
[papa@svr0 papa]$ su -
Password:
[root@svr0 /root]# cd /etc
[root@svr0 /etc]# vi
smb.conf
修正のポイントとなる箇所を以下に書き出します.
#======== Global Settings
===========================
[global]
# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = familys ドメイン名です.
# server string is the equivalent of the NT Description field
server string = Family's Server via Samba
# if you want to automatically load your printer list rather
# than setting them up individually then you'll need this
printcap name = /etc/printcap
load printers = yes
# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.
password level = 8
; username level = 8
# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
encrypt passwords = yes
smb passwd file = /etc/smbpasswd
# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
interfaces = 192.213.1.1/24 127.0.0.1/8
# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
local master = no
# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
domain master = yes
# Enable this if you want Samba to be a domain logon server for
# Windows95 workstations.
domain logons = yes
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
wins support = yes
# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# this has been changed in version 1.9.18 to no.
dns proxy = no
# Case Preservation can be handy - system default is _no_
# NOTE: These can be set on a per share basis
preserve case = yes
short preserve case = yes
# Default case is normally upper case for all DOS files
; default case = lower
# Be very careful with case sensitivity - it can break things!
; case sensitive = no
create mode = 0664 ←ファイルを作成した場合のデフォルト属性
coding system = euc
#============================ Share Definitions ==============================
[familys] ← 共通フォルダの定義
comment = For family
path = /home/familys
valid users = papa,mama,sato,yuka ←この4ユーザの共通フォルダ
guest ok = no
read only = no
writable = yes
[papa] ←個人フォルダの定義
comment = For papa
path = /home/papa
guest ok = no
read only = no
writable = yes
[cdrom] ← CD-ROMの共有定義
comment = CD-ROM on svr0
path = /cdrom
guest ok = yes
read only = yes
writable = no
[printers] ←プリンタの共有定義
comment = All Printers
path = /var/spool/samba
browseable = no
public = yes
guest ok = no
writable = no
printable = yes
|
(2)設定の確認
作成したファイルのチェッカー(testparmコマンド)があります.エラーがあれば,
メッセージが出力されます.以下は,成功した場合の画面です.
[root@svr0 /etc]# testparm
Load smb config files from /etc/smb.conf
Processing section "[homes]"
Processing section "[sakainos]"
Processing section "[papa]"
Processing section "[cdrom]"
Processing section "[printers]"
Loaded services file OK.
Press enter to see a dump of your service definitions
※ここでキー入力待ちになるので,何かキーを押す.
# Global parameters
debuglevel = 2
syslog = 1
|
|
[IPC$]
comment = IPC Service (Sakainos Server via Samba)
path = /tmp
status = No
guest ok = Yes
|
(3)sambaの再スタート
sambaの設定が正しそうでしたら,sambaの再スタートをします.一度sambaをkillした
後に,サイドsambaを起動します.sambaの実体は,smbdとnmbdという2つのプロセス
です.
[root@svr0 /etc]#
ps ax |grep mbd
362 ? S 0:00 smbd -D
371 ? S 0:22 nmbd -D
376 ? S 0:00 nmbd -D
4938 p0 S 0:00 grep mbd
↓↓↓↓ smbdとnmbdに該当するPIDを全て殺す.
[root@svr0 /etc]#
kill -9 362 371 376
↓↓↓↓ smbdとnmbdを再スタートする.
[root@svr0 /etc]#
/usr/sbin/nmbd -D
[root@svr0 /etc]# /usr/sbin/smbd -D
|
(4)sambaパスワードファイルの生成
sambaが使用するパスワードファイルを用意します.Linuxのユーザパスワード
ファイル(/etc/passwd)からsamba用のパスワードファイルを生成するスクリプトが
予め用意されていますので,これを用います.
[root@svr0 /etc]# /usr/bin/mksmbpasswd.sh
[root@svr0 /etc]# chmod 700 /usr/bin/mksmbpasswd.sh
[root@svr0 /etc]# cat ./passwd |usr/bin/mksmbpasswd.sh
>smbpasswd
[root@svr0 /etc]# chmod 600 smbpasswd
|
(5)sambaパスワードの設定
各ユーザごとのsambaパスワードを設定します.通常のパスワード設定と同様にして
行います.例えば,ユーザpapaのパスワードを変更したければ,以下のとおりにタイ
プします.なお,各ユーザは自分のパスワードに限り変更できます.
(UNIXと同様です.コマンドプロンプトから単にsmbpaswdとタイプすればOKです.)
[root@svr0 /etc]# smbpasswd papa
New SMB password:
Retype new SMB password:
Password changed
|