1. 安裝 Samba 套件
2. 編輯設定檔 /etc/samba/smb.conf
3. 設定帳號、群組及密碼
4. 啟動 Samba 服務
5. 設定防火牆
實作環境:
Server IP:192.168.1.75
Client IP:192.168.1.*
Server端:
安裝 Samba 套件
本例為 /run/media/root/HPDATA下建立一個分享目錄HPNFS
chmod 777 /run/media/root/HPDATA/HPNFS
編輯設定檔 /etc/samba/smb.conf,可進入HPNFS目錄操作的群組為smbgrp
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
[HPNFS]
path = /run/media/root/HPDATA/HPNFS
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
設定samba的帳號abc,加入smbgrp群組,最後設定密碼
groupadd smbgrp
usermod -a -G smbgrp abc
smbpasswd -a abc
New SMB password:*********
Retype new SMB password:*********
Added user abc.
設定分享權限
chmod -R 0770 /run/media/root/HPDATA/HPNFS
設定SElinux
啟動 Samba 服務
systemctl start nmb.service
設定防火牆
firewall-cmd --reload