產業消息

Server端:

安裝 Samba 套件
yum install samba samba-client samba-common -y

本例為 /home 分享目錄home
chmod 777 /home

編輯設定檔 /etc/samba/smb.conf,可進入home目錄操作的群組為smbgrp
[global]
 workgroup = WORKGROUP
 security = user
 server string = Samba Server Version %v
 hosts allow = 192.168.33.
 log file = /var/log/samba/log.%m
 max log size = 150
 netbios name = centos
 dos charset = UTF-8
 unix charset = CP950
 map to guest = bad user
 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
 create mask = 0644
 directory mask = 0755
 dead time = 15
 getwd cache = yes
 guest account = nobody
 load printers = no
 dns proxy = no
 
[home]
 path = /home
 valid users = @smbgrp
 force user = root
 guest ok = no
 writable = yes
 browseable = yes

設定samba的帳號root,加入smbgrp群組,最後設定密碼
useradd root
groupadd smbgrp
usermod -a -G smbgrp root
smbpasswd -a root

New SMB password:*********
Retype new SMB password:*********
Added user root.

設定分享權限
chown -R root:smbgrp /home
chmod -R 0770 /home


設定SElinux
chcon -t samba_share_t /home


啟動 Samba 服務

systemctl start smb

systemctl enable smb

systemctl start nmb

systemctl enable nmb

設定防火牆
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload

 

[參考]

http://icekuo.blogspot.com/2017/01/centos-7-samba-server.html 

CentOS 7 Samba Server 架設筆記

https://tw.saowen.com/a/f20e8ef4c6245e948e8a33389e9fc970141dd9856fe0d4ad72c83503bbe3a8d0

CentOS 7下Samba伺服器的安裝與配置