samba伺服器主配置檔案smb.conf詳解(超詳細,實測有效 )

lky_for_lucky發表於2020-08-29

SMB

SMB(Server Message Block,資訊服務塊)是用於在區域網共享檔案和印表機的一種通訊協議。

Samba

Samba則是實現SMB協議的軟體。

安裝Samba

Ubuntu環境

sudo apt-get update(更新apt-get)
sudo apt-get install samba(安裝samba)

主配置檔案smb.conf

路徑位於/etc/samba/目錄下
sudo vim /etc/samba/smb.conf(編輯smb.conf檔案)
smb.conf配置如下:

#全域性設定

[global]
#workgroup/NT-domain,工作組/NT域名)
workgroup = WORKGROUP
#描述
server string = %h server (Samba,Ubuntu)
#禁止nmbd通過DNS搜尋NetBIOS名稱
dns proxy = no

#網路設定

#這塊我還沒弄明白,後面再補上

#Debug

#log.smbd和log.nmbd日誌路徑
log file = /var/log/samba/log.%m
#日誌容量(單位為KB)
max log size = 1000
#通過syslog寫日誌(若設定則日誌謝總syslog,而非log.smbd和log.nmbd)
#syslog only = yes
#若使用syslog則設定更高一點,如syslog = 1000
syslog = 0
#回溯,panic-action是一個指令碼,有興趣的開啟看看
panic action = /usr/share/samba/panic-action %d

#驗證

#伺服器模式(數種不同的模式)
server role = standalone server
#加密密碼型別
passdb bakend = tdbsam
obey pam restrictions = yes
#同步unix密碼
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n password\supdated\ssuccessfully .
pam password change = yes
#連線失敗
map to guest = bad user

#Domain

#若使用primary classic domain controller,backup domain controller,
domain logons則需要配置

#Misc

usershare allow guests = yes

#Share Definitions

#預設的印表機服務,不用可以註釋掉
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
#共享配置
[samba]
#描述
comment = share folder
#瀏覽許可權
browseable = yes
#共享資料夾
path = /home/lky/samba
#許可權
create mask=0777
directory mask=0777
force user=lky
force group=lky
public=yes
writeable=yes
available=yes

相關文章