sambaとは、LINUX/UNIX上で稼働し、WindowsNT/2000互換のファイル/プリントサービス機能を提供するオープンソースソフトウェアです。
# yum -y install samba |
ここでの設定は、ファイルサーバでの設定とします。
sambaでプリントサーバを構築することも可能ですが、当サイトでのプリントサーバはプリントサーバの構築(cups)で構築します。
ユーザ"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 |
設定ファイルの編集 # 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を起動する # /etc/rc.d/init.d/smb start SMBサービスを起動中: [ OK ] NMBサービスを起動中: [ OK ] |
起動時にsambaを起動する # chkconfig smb on 設定内容を確認 # chkconfig --list smb smb 0:オフ 1:オフ 2:オン 3:オン 4:オン 5:オン 6:オフ |