我在 ubuntu 服务器上设置了 samba,并尝试在sharedfolders
根目录中共享文件夹。但是,我0x80070043
在 Windows 中收到此错误。
root@ubuntu:~# ls -lh sharedfolders/
total 12K
drwxrwxrwx 2 root root 4.0K May 26 16:10 f1
drwxrwxrwx 2 root root 4.0K May 26 16:10 f2
drwxrwxrwx 2 root root 4.0K May 26 16:11 f3
这是我的 samba 配置文件:
[global]
workgroup = KIWI
server string = %h server (Samba, Ubuntu)
wins support = yes
dns proxy = no
name resolve order = lmhosts host wins bcast
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
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
usershare allow guests = yes
[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
[Shared]
comment = Shared Files
path = sharedfolders/f1
browseable = yes
read only = no
[Home Files]
comment = Home Files
path = sharedfolders/f2
browseable = yes
read only = no
[Work Files]
comment = Work Files
path = sharedfolders/f3
browseable = yes
read only = no
当我尝试连接到上述文件夹之一(f1,f2,f3)时,我提供了在 samba 中定义的用户密码,但出现了这个奇怪的错误。
有人可以帮我解决这个问题吗?
这是我的桑巴状态:
root@ubuntu:~# smbstatus
Samba version 4.3.11-Ubuntu
PID Username Group Machine Protocol Version
------------------------------------------------------------------------------
Service pid machine Connected at
-------------------------------------------------------
No locked files
更新:
这是我的三个共享文件夹所在的根文件夹的权限:
root@ubuntu:~# ls -lh
total 4.0K
drwxrwxrwx 5 root root 4.0K May 26 16:11 sharedfolders
图片附件:
答案1
要解决的第一个问题是 Samba 配置文件中没有正确定义共享路径。
例如,这里:
[Shared] path = sharedfolders/f1
您需要提供绝对路径(即以 开头的路径/
),而不是相对路径。
您将在 Samba 日志文件中看到错误消息的原因。您已经定义了它们,所以请使用它们。
答案2
您共享的文件夹存在一些权限问题:
解决方案是将其移动到/mnt/sharedfolders/
mv sharedfolders/ /mnt/
进而 :
chown -R www-data sharedfolders
然后相应地更新 samba 配置文件中的路径,
然后当然是:
service smbd restart
希望这有效。