CentOS操作系統(tǒng)最小化安裝
安裝:直接yum install samba*
開(kāi)機(jī)啟動(dòng):systemctl enable smb.service
systemctl enable nmb.service
啟動(dòng):systemctl start smb.service
systemctl start nmb.service
查詢SMB狀態(tài):systemctl status smb.service
防火墻放行:firewall-cmd --permanent --zone=public --add-service=samba
創(chuàng)建SMB用戶并配置密碼:useradd test #先增加系統(tǒng)用戶
smbpasswd -a test
創(chuàng)建分享目錄:mkdir /home/share
目錄授權(quán):chmod 777 /home/share
修改SMB配置文件:vi etc/samba/smb.conf
See smb.conf.example for a more detailed config file or
read the smb.conf manpage.
Run 'testparm' to verify the config is correct after
you modified it.
[global]
load printers = no
server string = Samba Server Version %v
map to guest = Bad User
encrypt passwords = yes
passdb backend = tdbsam
wins support = true
cups options = raw
netbios name = linux_share
netbios aliases = SMB
printing = cups
default = global
workgroup = SAMBA
os level = 20
printcap name = cups
security =user
null passwords=yes
lanman auth = no
ntlm = no
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @printadmin root
force group = @printadmin
create mask = 0664
directory mask = 0775
[home]
browseable = yes
writeable = yes
valid users = test
path = /home/share
available = yes
systemctl restart smb.service
systemctl restart nmb.service
在WINDOWS上測(cè)試:開(kāi)始--運(yùn)行--輸入SMB服務(wù)器IP:\192.168.X.X
進(jìn)入共享目錄時(shí)會(huì)提示需要用戶名密碼把还,按創(chuàng)建用戶時(shí)的錄入即可
遇到問(wèn)題:
1、XP系統(tǒng)不能訪問(wèn):SMB用戶密碼為空時(shí)可以正常訪問(wèn),如果設(shè)置了密碼患亿,則不能訪問(wèn)旨剥,猜測(cè)XP加密算法與SMB不一樣導(dǎo)致,暫時(shí)未找到解決方法缕允。
2艰匙、Window10訪問(wèn)時(shí)提示:你不能訪問(wèn)此共享文件夾,因?yàn)槟憬M織的安全策略阻止未經(jīng)身份驗(yàn)證的來(lái)賓訪問(wèn)昼激”诱溃…………
Win10的組策略問(wèn)題,
按window+R鍵輸入gpedit.msc 來(lái)啟動(dòng)本地組策略編輯器橙困。
依次點(diǎn)開(kāi)“計(jì)算機(jī)配置-管理模板-網(wǎng)絡(luò)-Lanman工作站”這個(gè)節(jié)點(diǎn)瞧掺,在右側(cè)內(nèi)容區(qū)可以看到“啟用不安全的來(lái)賓登錄”這一條策略設(shè)置。當(dāng)前狀態(tài)是“未配置”凡傅,修改為“已啟用”辟狈。
再測(cè)試,可正常訪問(wèn)。