はじめての自宅サーバ構築 - Fedora/CentOS - Last Update 2008/05/16
It opened to 2004/09/19.
当サイトはFedora9で運用しています
Visitors
Pageviews
Today(IP/PV)
3,251,430
12,002,622
1,899/11,279
動作確認 [ FC1 / FC2 / FC3 / FC4 / FC5 / FC6 / Fedora7 / Fedora8 / CentOS4 / CentOS5 ]
  1. sambaとは・・・
  2. sambaのインストール
  3. sambaの設定
    sambaサーバへアクセスするユーザーの設定
    全ユーザがアクセス可能な共有パスの作成
    samba設定ファイルの編集
  4. sambaの起動
  5. OSの再起動を行なった時にsambaを自動的に起動するように設定する
  6. sambaの動作確認

■ sambaとは・・・

sambaとは、LINUX/UNIX上で稼働し、WindowsNT/2000互換のファイル/プリントサービス機能を提供するオープンソースソフトウェアです。

■ sambaのインストール

# yum -y install samba

■ sambaの設定

ここでの設定は、ファイルサーバでの設定とします。
sambaでプリントサーバを構築することも可能ですが、当サイトでのプリントサーバはプリントサーバの構築(cups)で構築します。

■ sambaサーバへアクセスするユーザーの設定

ユーザ"linux"をsambaアクセスユーザにする
# smbpasswd -a linux
sambaアクセスのパスワードを入力する
New SMB password:
確認の為、上記で入力したsambaアクセスのパスワードを入力する
Retype new SMB password:
startsmbfilepwent_internal: file /etc/samba/smbpasswd did not exist. File successfully created.
Added user linux.
# smbpasswd -a linux
New SMB password:
Retype new SMB password:
startsmbfilepwent_internal: file /etc/samba/smbpasswd did not exist. File successfully created.
account_policy_get: tdb_fetch_uint32 failed for field 1 (min password length), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 2 (password history), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 3 (user must logon to change password), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 4 (maximum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 5 (minimum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 6 (lockout duration), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 7 (reset count minutes), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 8 (bad lockout attempt), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 9 (disconnect time), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 10 (refuse machine password change), returning 0
Added user linux.

■ 全ユーザがアクセス可能な共有パスの作成

/networkパスを共有パスとして作成
# mkdir /network
アクセス権を変更する
# chmod 777 /network

■ samba設定ファイルの編集

設定ファイルの編集
# vi /etc/samba/smb.conf
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors.
#
#======================= Global Settings =====================================
globalセクションの編集
[global]
Linux側の日本語文字コード
   unix charset = eucJP
   display charset = eucJP
Windows側の日本語文字コード
   dos charset = CP932

ファイル作成時のパーミッション(誰でも読み書き・削除できる様にする)
   create mask = 0777
   force create mode = 0777
   security mask = 0777
   force security mode = 0777
ディレクトリ作成時のパーミッション(誰でも読み書き・削除できる様にする)
   directory mask = 0777
   force directory mode = 0777
   directory security mask = 0777
   force directory security mode = 0777
ファイル・ディレクトリ作成時の所有者を「root」にする
   force user = root

# workgroup = NT-Domain-Name or Workgroup-Name
ワークグループ名の指定(Windowsのネットワークのドメイン名またはワークグループと同じにする)
   workgroup = WORKGROUP

# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
内部からのアクセスを可能とする(外部からはアクセスさせない)
   hosts allow = 192.168.1. 127.


ServerDirectory セクションの作成
セクション名がWindowsから見える共有名になります
[ServerDirectory]
   comment = Server Directories
   path = /network
   public = yes
   writable = yes

■ sambaの起動

sambaを起動する
# /etc/rc.d/init.d/smb start
SMBサービスを起動中:                                       [  OK  ]
NMBサービスを起動中:                                       [  OK  ]

■ OSの再起動を行なった時にsambaを自動的に起動するように設定する

起動時にsambaを起動する
# chkconfig smb on
設定内容を確認
# chkconfig --list smb
smb             0:オフ  1:オフ  2:オン  3:オン  4:オン  5:オン  6:オフ

■ sambaの動作確認

  1. クライアント(Windows)より、『マイネットワーク』→『ネットワーク全体』→『Microsoft Windows Network』→『Workgroup』を開き【Samba Server (<サーバのホスト名>)】が存在していることを確認する。
    (Windowsが認識するまで数分かかる場合があります。)
  2. 【Samba Server (<サーバのホスト名>)】をダブルクリックすると『linux』と『ServerDirectory』のフォルダがあると思います。
    この『linux』はログイン(アクセス)したユーザの個人フォルダで、『ServerDirectory』は全ユーザがアクセス可能な共有フォルダです。

■ 広告

ページ先頭へ

Copyright(©)2004-2008 First home server construction. All Right Reserved.