CentOS7.5+Samba4.7.1搭建随记

CentOS操作系统最小化安装
安装:直接yum install samba*
开机启动:systemctl enable smb.service
systemctl enable nmb.service
启动:systemctl start smb.service
systemctl start nmb.service
查询SMB状态:systemctl status smb.service
防火墙放行:firewall-cmd --permanent --zone=public --add-service=samba
创建SMB用户并配置密码:useradd test #先增加系统用户
smbpasswd -a test
创建分享目录:mkdir /home/share
目录授权: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上测试:开始--运行--输入SMB服务器IP:\192.168.X.X
进入共享目录时会提示需要用户名密码,按创建用户时的录入即可

遇到问题:
1、XP系统不能访问:SMB用户密码为空时可以正常访问,如果设置了密码,则不能访问,猜测XP加密算法与SMB不一样导致,暂时未找到解决方法。
2、Window10访问时提示:你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问。…………
Win10的组策略问题,
按window+R键输入gpedit.msc 来启动本地组策略编辑器。
依次点开“计算机配置-管理模板-网络-Lanman工作站”这个节点,在右侧内容区可以看到“启用不安全的来宾登录”这一条策略设置。当前状态是“未配置”,修改为“已启用”。
再测试,可正常访问。

你可能感兴趣的:(CentOS7.5+Samba4.7.1搭建随记)