ORCAレセコンをWindowsファイルサーバにしよう (日本語Samba)


旧バージョン
ORCAレセコンは、ネットワークに繋がっている立派なサーバです。おそらく60GBなどの大きなHDDを付けた方も多いのでは。これをORCAだけでは少しもったいなく思い、Windowsファイルサーバに設定してみました。筆者は、Windowsの重要ファイルのバックアップを、RealSyncを使い自動的にORCAレセコンに行っています。

インストール方法
/etc/apt/sources.list
に以下の1行を追加します。
deb http://www.yaromai.net/~nsaito samba-ja/

$ sudo apt-get update
$ sudo apt-get install samba-ja swat-i18n

  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x                                                                          x
  x The rest of the configuration of Samba deals with questions that affect  x
  x parameters in /etc/samba/smb.conf, which is the file used to configure   x
  x the Samba programs (nmbd and smbd.) If you want to be asked just a few   x
  x questions then select "Yes" and continue with the configuration. If you  x
  x want to have full control, select "No" and configure your smb.conf       x
  x manually or through SWAT.                                                x
  x                                                                          x
  x Configure smb.conf through debconf?                                      x
  x                                                                          x
  x                    <Yes>                       <No>                      x
  x                                                                          x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

YESを選びます

   lqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
   x This controls what workgroup your server will appear to be in when     x
   x queried by clients. Note that this parameter also controls the Domain  x
   x name used with the security=domain setting.                            x
   x                                                                        x
   x Workgroup/Domain Name?                                                 x
   x                                                                        x
   x ______________________________________________________________________ x
   x                                                                        x
   x                                 <Ok>                                   x
   x                                                                        x
   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

WORKGROUP(またはあなたのWindowsのワークグループ名)を入れます。

  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x                                                                          x
  x Recent Windows clients communicate with SMB servers using encrypted      x
  x passwords. If you want to use clear text passwords you will need to      x
  x change a parameter in your Windows registry. It is recommended that you  x
  x use encrypted passwords. If you do, make sure you have a valid           x
  x /etc/samba/smbpasswd file and that you set passwords in there for each   x
  x user using the smbpasswd command.                                        x
  x                                                                          x
  x Use password encryption?                                                 x
  x                                                                          x
  x                    <Yes>                       <No>                      x
  x                                                                          x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

YESを選択します。

  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x                                                                         x
  x Samba's log files have moved.                                           x
  x                                                                         x
  x Starting with the first packages of Samba 2.2 for Debian the log files  x
  x for both Samba daemons (nmbd and smbd) are now stored in                x
  x /var/log/samba/. The names of the files are log.nmbd and log.smbd, for  x
  x nmbd and smbd respectively.                                             x
  x                                                                         x
  x The old log files that were in /var/log/ will be moved to the new       x
  x location for you.                                                       x
  x                                                                         x
  x                                 <Ok>                                    x
  x                                                                         x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

OKです。

   lqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
   x The Samba services (nmbd and smbd) can run as normal daemons or from  x
   x inetd. Running as daemons is the recommended approach.                x
   x                                                                       x
   x How do you want to run Samba?                                         x
   x                                                                       x
   x                              daemons                                  x
   x                              inetd                                    x
   x                                                                       x
   x                                                                       x
   x                                <Ok>                                   x
   x                                                                       x
   mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

inetdを選択します。

  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x                                                                          x
  x To be compatible with the defaults in most versions of Windows, Samba    x
  x must be configured to use encrypted passwords.  This requires user       x
  x passwords to be stored in a file separate from /etc/passwd. This file    x
  x can be created automatically, but the passwords must be added manually   x
  x (by you or the user) by running smbpasswd, and you must arrange to keep  x
  x it up-to-date in the future.  If you do not create it, you will have to  x
  x reconfigure samba (and probably your client machines) to use plaintext   x
  x passwords. See /usr/share/doc/samba-doc/htmldocs/ENCRYPTION.html from    x
  x the samba-doc package for more details.                                  x
  x                                                                          x
  x Create samba password file, /etc/samba/smbpasswd?                        x
  x                                                                          x
  x                    <Yes>                       <No>                      x
  x                                                                          x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Noを選択します。

/etc/inetd.confの下の方の以下の行を修正します。「#<off># 」を取ります。
#<off># swat stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/swat
  ↓
swat stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/swat

inetdを再起動します。
sudo /etc/init.d/inetd restart

Windows95,95,Meは、Windowsにログオンするユーザ名がSambaのユーザ名と異なる場合、users.mapを設定します。
sudo jvim /etc/samba/users.map
-----------------------
hasegawa = 長谷川司
-----------------------

hasegawaユーザが無い場合、作成します。
sudo adduser hasegawa

sambaのユーザを作成します
sudo smbpasswd -a hasegawa
ここでパスワードを聞かれますが、そのユーザ(ここでは「長谷川司」)のログオンパスワードと同じにします。

SWATにログインします。
ブラウザを立ち上げ、URL欄に以下のようにい入れます。
http://(SambaをインストールしたパソコンのIPアドレス):901/
LAN内のWindowsパソコンから設定できます。SambaをインストールしたパソコンのMozillaから設定する場合「http://localhost:901/」と入れて下さい。

ユーザ名とパスワードを聞いてくるので、rootとORCAレセコンのrootのパスワードを入れて下さい。
SWATでSambaを設定
全体設定 [Global]
	詳細設定をクリック
	coding system コーディングシステム euc
	client code page クライアントコードページ 932
	load printers プリンタをロード no
	username map ユーザ名マップ /etc/samba/users.map
	設定変更をクリック
共有設定 [Share] 
	共有選択でhomesを選ぶ
	writeable 書き込み可 yes
	設定変更をクリック

このフォルダをWidnowsのネットワークドライブにしましょう
Windowsのエクスプローラを立ち上げ「ツール」−「ネットワークドライブの割り当て」を選びます
ドライブ : 適当なドライブ名を選びます
フォルダ : \\(SambaをインストールしたパソコンのIPアドレス)\ユーザ名
とし「完了」をクリックします。



smbpasswdで設定した、ユーザ名とパスワードを入れます。


このように長いネットワークドライブ名ができました。


短く「Orca file server」位に名前を変更しましょう。
このように、/home/hasegawaのフォルダをWindowsから読み書きできます。
漢字のファイル名も大丈夫です。


WindowsXPは、再ログオン時ネットワークドライブの接続に失敗してもエラーメッセージが出ません。他のバージョンのWindowsはエラーメッセージがでます。

「ツール」−「ネットワークドライブの割り当て」を行わず、以下の設定の方が良いでしょう。

以下をメモ帳などで作り、logon.batのファイル名で保存して下さい。
NET USE ドライブ名: \\(SambaをインストールしたパソコンのIPアドレス)\ユーザ名 パスワード /USER:ユーザ名 /PERSISTENT:NO

例として以下のようになると思います。
NET USE G: \\192.168.0.10\hasegawa himitu /USER:hasegawa /PERSISTENT:NO

このlogon.batをWindowsのスタートアップに登録します。
このコマンド実行の前にSLEEPTでタイミングを取った方が確実に接続されます。

SLEEPT 5
NET USE J: \\192.168.0.10\hasegawa himitu /USER:hasegawa /PERSISTENT:NO

SLEEPTのダウンロード


←戻る