You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu Server配置Samba共享后无法访问,权限拒绝错误求助

Ubuntu Server配置Samba共享后无法访问,权限拒绝错误求助

我刚接触Linux,正在学习Ubuntu Server的使用,现在卡在Samba共享配置上了,希望有人能帮我找出问题所在😭

我刚安装了Ubuntu Server,想设置SMB共享,但不管是从Windows还是Linux笔记本连接,都提示“无法找到网络位置”,服务器端则抛出这个权限错误:

[2024/01/17 19:04:33.080528, 0] ../../source3/param/loadparm.c:3448(process_usershare_file)
process_usershare_file: stat of /var/lib/samba/usershares/main failed. Permission denied

我要共享的目录在ZFS池里(池挂载在/main),具体路径是/main/media。我肯定哪里操作错了,麻烦大家帮我指出来。

环境说明

  • UFW已经禁用,也没有SELinux,服务器上除了UFW没有其他防火墙
  • 共享目录所在的ZFS池挂载在/main,我之前因为着急直接给所有目录加了chmod 777(我知道这很不规范,但实在没辙了):
    • /main的权限:drwxrwxrwx 3 root root 3 Jan 14 13:50 main
    • /main/media的权限:drwxrwxrwx 4 shareuser root 4 Jan 17 13:13 media

Samba配置信息

我的smb.conf里的共享段配置:

[media]
path = /main/media
writeable = yes
browseable = yes
public = yes
create mask = 0644
directory mask = 755
force user = enfinders
force group = enfinders

全局配置里的接口我确认过是当前在用的:

;   interfaces = 127.0.0.0/8 enp2s0
;   bind interfaces only = no

另外我运行了testparm -s,结果如下:

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE

Global parameters

[global]
log file = /var/log/samba/log.%m
logging = file
map to guest = Bad User
max log size = 1000
obey pam restrictions = Yes
pam password change = Yes
panic action = /usr/share/samba/panic-action %d
passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n password\supdated\ssuccessfully .
passwd program = /usr/bin/passwd %u
server role = standalone server
server string = %h server (Samba, Ubuntu)
unix password sync = Yes
usershare allow guests = Yes
idmap config * : backend = tdb

[printers]
browseable = No
comment = All Printers
create mask = 0700
path = /var/spool/samba
printable = Yes

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers

[media]
create mask = 0644
force group = enfinders
force user = enfinders
guest ok = Yes
path = /main/media
read only = No

还有,运行net usershare没任何输出。

备注:内容来源于stack exchange,提问作者user1761173

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 10:14:51