先运行下面命令查看smb服务是否启动
systemctl status smb.service
如果是运行状态可以用testparm查看配置状态
➜ ~ testparmLoad smb config files from /etc/samba/smb.confProcessing section "[homes]"Processing section "[printers]"Processing section "[print$]"Processing section "[mysmb]"Loaded services file OK.Server role: ROLE_STANDALONE
如果没有问题下一步可以用smbclient测试本地连接,没有密码直接回车
➜ ~ smbclient //127.0.0.1/mysmbEnter SAMBA\root's password:Anonymous login successfulTry "help" to get a list of possible commands.smb: \>
如果能正常访问那应该就是防火墙的问题了,直接使用firwall-cmd将端口139和445允许通过,然后重启防火墙服务
➜ ~ firewall-cmd --zone=public --add-port=139/tcp --permanentsuccess➜ ~ firewall-cmd --zone=public --add-port=445/tcp --permanentsuccess➜ ~ systemctl restart firewalld
【附上配置文件:】
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
#[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
[share]
comment = This is a share directory
path = /home/
writable = yes
public = yes
本文介绍如何检查SMB服务的状态及配置,并提供详细的步骤来确保SMB服务能够正确运行,包括防火墙设置等。
2万+

被折叠的 条评论
为什么被折叠?



