SAMBAでファイル共有をしよう!
ここでは、SAMBAによるファイル共有手順を掲載しています。
SAMBAのインストール
[root@co ~]# yum -y install samba
oaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
base | 1.1 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
updates/primary_db | 564 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.0.33-3.39.el5_8 set to be updated
--> Processing Dependency: samba-common = 3.0.33-3.39.el5_8 for package: samba
--> Processing Dependency: perl(Convert::ASN1) for package: samba
--> Running transaction check
---> Package perl-Convert-ASN1.noarch 0:0.20-1.1 set to be updated
---> Package samba-common.x86_64 0:3.0.33-3.39.el5_8 set to be updated
--> Processing Dependency: libsmbclient = 3.0.33-3.39.el5_8 for package: samba-common
--> Running transaction check
---> Package libsmbclient.x86_64 0:3.0.33-3.39.el5_8 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
samba x86_64 3.0.33-3.39.el5_8 base 16 M
Installing for dependencies:
libsmbclient x86_64 3.0.33-3.39.el5_8 base 917 k
perl-Convert-ASN1 noarch 0.20-1.1 base 42 k
samba-common x86_64 3.0.33-3.39.el5_8 base 6.8 M
Transaction Summary
================================================================================
Install 4 Package(s)
Upgrade 0 Package(s)
Total download size: 24 M
Downloading Packages:
(1/4): perl-Convert-ASN1-0.20-1.1.noarch.rpm | 42 kB 00:00
(2/4): libsmbclient-3.0.33-3.39.el5_8.x86_64.rpm | 917 kB 00:00
(3/4): samba-common-3.0.33-3.39.el5_8.x86_64.rpm | 6.8 MB 00:00
(4/4): samba-3.0.33-3.39.el5_8.x86_64.rpm | 16 MB 00:00
--------------------------------------------------------------------------------
Total 12 MB/s | 24 MB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libsmbclient 1/4
Installing : samba-common 2/4
Installing : perl-Convert-ASN1 3/4
Installing : samba 4/4
Installed:
samba.x86_64 0:3.0.33-3.39.el5_8
Dependency Installed:
libsmbclient.x86_64 0:3.0.33-3.39.el5_8 perl-Convert-ASN1.noarch 0:0.20-1.1
samba-common.x86_64 0:3.0.33-3.39.el5_8
Complete!
SAMBA用アカウントの登録
SAMBAでは、CentOSのアカウントとは別に、SAMBA用アカウントを登録する必要があります。必要に応じて、新規でアカウントを作成し、登録を行ってください。
今回は既存のアカウントをSAMBAに登録します。
[root@co ~]# pdbedit -a koro
new password:SAMBAアカウントのパスワード
retype new password:SAMBAアカウントパスワード再入力
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
Unix username: koro
NT username:
Account Flags: [U ]
User SID: S-1-5-21-1835965074-4251303188-898462336-1001
Primary Group SID: S-1-5-21-1835965074-4251303188-898462336-513
Full Name:
Home Directory: \\co\koro
HomeDir Drive:
Logon Script:
Profile Path: \\co\koro\profile
Domain: CO
Account desc:
Workstations:
Munged dial:
Logon time: 0
Logoff time: never
Kickoff time: never
Password last set: 月, 25 6月 2013 04:25:10 JST
Password can change: 月, 25 6月 2013 04:25:10 JST
Password must change: never
Last bad password : 0
Bad password count : 0
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
SAMBAの設定
CentOSで使う文字コードはUTF-8なので、それに合わせた文字コードの設定を追記します。
[root@co ~]# vi /etc/samba/smb.conf
#======================= Global Settings =====================================
[global]
unix charset = UTF-8
dos charset = cp932
display charset = UTF-8
続いて、各自の環境に応じたネットワーク設定を変更します。
# ----------------------- Network Related Options -------------------------
workgroup = MYGROUP
↓
workgroup = WORKGROUP (Windowsのワークグループ名)
; hosts allow = 127. 192.168.12. 192.168.13.
↓
hosts allow = 127. 192.168.11. (LANのネットワークアドレス)
SAMBAの起動
設定が終わったら、SAMBAを起動します。
[root@co ~]# /etc/rc.d/init.d/smb start
SMB サービスを起動中: [ OK ]
NMB サービスを起動中: [ OK ]
[root@co ~]# chkconfig smb on
[root@co ~]# chkconfig --list smb
smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Windowsからのログイン
今回は細かい設定を省きましたが、共有フォルダの細かいパーミッションや使用容量の制限、プリンタの共有設定なども可能です。
参考にしたサイト様
今回新しく登場したコマンド
[広告]

トップページ
Rocky Linux 8
CentOS 7
Scientific Linux 6
CentOS 5
○準備
○VMware Player
○Hyper-V(Win Proのみ)
○導入
○セキュリティ対策
○Dynamic DNS
○NTPサーバ
○データベース
○WEBサーバ
○FTPサーバ
○メールサーバ
○DNSサーバ
○ファイルサーバ
○ブログシステム
○その他
ブログ
[広告]