安裝相關軟體
apt install samba smbclient cifs-utils
增加 Linux系統中帳號,群組
groupadd smbshare
useradd -M -s /sbin/nologin sambauser
usermod -aG smbshare sambauser
建立 samba 系統帳號
smbpasswd -a sambauser
啟用 samba 系統帳號
smbpasswd -e sambauser
建立分享目錄
mkdir /private /public
chgrp -R smbshare /private
chgrp -R smbshare /public
chmod 2770 /private
chmod 2775 /public
編輯 Samba 設定檔 /etc/samba/smb.conf
[public]
comment = Public Folder
path = /public
writable = yes
guest ok = yes
guest only = yes
force create mode = 775
force directory mode = 775
[private]
comment = Private Folder
path = /private
writable = yes
guest ok = no
valid users = @smbshare
force create mode = 770
force directory mode = 770
inherit permissions = yes
測試設定檔
testparm
沒有留言:
張貼留言