![]() |
| ◆ | sambaのインストール |
|
[root@centos]# yum -y install samba <--- 入力 |
|
| ◆ | samba の設定 |
|
[root@centos]# vi /etc/samba/smb.conf <--- 入力 途中略 #======================= Global Settings ===================================== [global] # ----------------------- Netwrok Related Options ------------------------- # # workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH # # server string is the equivalent of the NT Description field # # netbios name can be used to specify a server name not tied to the hostname # # Interfaces lets you configure Samba to use multiple interfaces # If you have multiple network interfaces then you can list the ones # you want to listen on (never omit localhost) # # Hosts Allow/Hosts Deny lets you restrict who can connect, and you can # specifiy it as a per share option as well # unix charset = UTF-8 <--- 追記 dos charset = CP932 <--- 追記 workgroup = WORKGROUP <--- 書き換え(ワークグループの設定) ↓ workgroup = ********* server string = Samba Server Version %v ; netbios name = MYSERVER <--- コメント解除して書き換え(netbiosの指定がある場合は設定 ↓ 通常は変更なし) netbios name = ******** ; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 ; hosts allow = 127. 192.168.12. 192.168.13. <--- コメント解除して書き換え(同一LAN内だけに ↓ 許可する場合に設定 ) hosts allow = 192.168.1. 127. 途中略 # ----------------------- Standalone Server Options ------------------------ # # Scurity can be set to user, share(deprecated) or server(deprecated) # # Backend to store user information in. New installations should # use either tdbsam or ldapsam. smbpasswd is available for backwards # compatibility. tdbsam requires no further configuration. security = user <--- user になっている事を確認 なっていなければ書き換え passdb backend = tdbsam <--- tdbsam になっている事を確認 なっていなければ書き換え 途中略 #============================ Share Definitions ============================== 途中略 # A publicly accessible directory, but read only, except for people in # the "staff" group ; [public] ↓ [public] <--- コメント解除 ; comment = Public Stuff ↓ comment = Public Stuff <--- コメント解除 ; path = /home/samba ↓ path = /home/samba <--- コメント解除 ; public = yes ↓ public = yes <--- コメント解除 ; writable = yes ↓ writable = yes <--- コメント解除 ; printable = no ; write list = +staff |
|
| ◆ | 共有ディレクトリの作成 |
|
[root@centos]# mkdir /home/samba <--- 入力 |
|
| アクセス権を変更 | |
|
[root@centos]# chmod 777 /home/samba <--- 入力 |
|
| ◆ | ユーザーの作成 |
|
[root@centos]# pdbedit -a ***** <--- 入力(***** ユーザー名) new password: ****** <--- パスワード入力(* は実際には表示されません) retype new password: ****** ← 再度パスワード入力(* は実際には表示されません) |
|
| ◆ | ユーザー専用ディレクトリのアクセス権の設定 |
|
[root@centos]# vi /etc/samba/smb.conf <--- 入力 [*****] <--- 以下最終行に追記(***** ユーザー名) comment = ***** Only Space path = /home/***** writable = yes (書き込みの許可 ) |
|
| 設定の詳細 path = /home/***** (***** はユーザ名) public = yes guest ok = yes guest only = yes guest account = ***** (*****
はユーザ名) read only = yes writable = yse create mask = 0777 (0777 の 777
部分に指定するアクセス権を記述) directory mask = 0777 (0777 の 777
部分に指定するアクセス権を記述) force user = yes browseable = yes valid users = ***** (***** はユーザ名) invalid users = ***** (*****
はユーザ名) write list = ***** (***** はユーザ名) hosts allow = ***** (***** はホスト名) hosts deny= ***** (***** はホスト名) 上記詳細で yes の部分を no に設定すると逆の意味になります。 |
|
| ◆ | samba の起動 |
|
[root@centos]# /etc/rc.d/init.d/smb start <--- 入力 [root@centos]# /etc/rc.d/init.d/nmb start <--- 入力 |
|
| 自動起動設定 | |
|
[root@centos]# chkconfig smb on <--- 入力 [root@centos]# chkconfig nmb on <--- 入力 |
|
| 自動起動設定の確認 | |
|
[root@centos]# chkconfig --list smb <--- 入力 smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 2・3・4・5 が on になっていればOK [root@centos]# chkconfig --list nmb <--- 入力 nmb 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 2・3・4・5 が on になっていればOK |
|
| ◆ | xinetd のインストール |
|
[root@centos]# yum -y install xinetd <--- 入力 |
|
| ◆ | xinetd の起動 |
|
[root@centos]# /etc/rc.d/init.d/xinetd start <--- 入力 |
|
| xinetd の自動起動設定 | |
|
[root@centos]# chkconfig xinetd on <--- 入力 |
|
| 自動起動設定の確認 | |
|
[root@centos]# chkconfig --list xinetd <--- 入力 xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 2・3・4・5 が on になっていればOK |
|
| ◆ | samba-swat のインストール |
|
[root@centos]# yum -y install samba-swat <--- 入力 |
|
| ◆ | samba-swat の設定 |
|
[root@centos]# vi /etc/xinetd.d/swat <--- 入力 # default: off # description: SWAT is the Samba Web Admin Tool. Use swat \ # to configure your Samba server. To use SWAT, \ # connect to port 901 with your favorite web browser. service swat { port = 901 socket_type = stream wait = no only_from = 127.0.0.1 <--- 追記 ↓ only_from = 127.0.0.1 192.168.1.0/24 user = root server = /usr/sbin/swat log_on_failure += USERID disable = yes <--- 書き換え ↓ disable = no } |
|
| ◆ | samba-swat の日本語化 |
| 64bitの場合 | |
|
[root@centos]# cp /usr/lib64/samba/ja.msg /etc/samba/ <--- 入力 |
|
| 31bitの場合 | |
|
[root@centos]# cp /usr/lib/samba/ja.msg /etc/samba/ <--- 入力 |
|
| ◆ | xinetd の再起動 |
|
[root@centos]# /etc/rc.d/init.d/xinetd restart <--- 入力 |
|
| ◆ | ブラウザでの確認 |
| ブラウザで http:<サーバーのIPアドレス>:901 にアクセスしユーザー名とパスワードを入力 (root と root のパスワード) | |
|
|
|
|
|
|
| ※ samba-swat で各種設定を行うと smb.conf のコメント部分が削除されてしまうので注意 | |