如何写入我的 Samba 共享?

如何写入我的 Samba 共享?

在谷歌土地上有一百万个这个确切问题的版本,但我一直无法解决我的问题(抱歉)。我在 Ubuntu 14.04(实际上是 xbmcbuntu)上创建了一个 Samba 共享,我可以连接并读取它,但不能写入(从我的 Mac)。我遵循了一些不同的教程来进行设置,因此我可能在此过程中配置了一些错误的东西。

我共享的目录 ( /home/xbmc/raid/media) 由用户 xbmc 所有,权限设置为 775。

xbmc@xbmc:~$ ls -al raid
total 28
drwxr-xr-x  4 xbmc xbmc  4096 Sep  4 23:22 .
drwxr-xr-x 23 xbmc xbmc  4096 Sep  4 23:00 ..
drwx------  2 root root 16384 Sep  2 21:34 lost+found
drwxrwxr-x  9 xbmc xbmc  4096 Sep  4 22:58 media

如果我将权限更改为 777,我就可以写入共享,但这感觉像是一个不合适的解决方案。

smb.conf的如下;

[global]
workgroup = WORKGROUP
server string = %h server (Samba, XBMC)
netbios name = XBMCbuntu
dns proxy = no
name resolve order = hosts wins bcast
#guest account = xbmc
load printers = no
show add printer wizard = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
encrypt passwords = true
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
security = user
username map = /etc/samba/smbusers

[System]
path = /home/xbmc/.xbmc
comment = XBMC System Share
writeable = yes
browseable = yes
guest ok = no

[Media]
path = /home/xbmc/raid/media
comment = xbmc media
writeable = yes
browseable = yes
guest ok = no

如下/etc/samba/smbusers

xbmc = xbmc

我对 smb.conf 做了很多修改,但没有修复任何问题。有什么建议么?

答案1

尝试将其添加到[Media]部分:

public = no
hide unreadable = yes
printable = no
force create mode = 0664
force group = xbmc
write list = xbmc
directory mask = 0775

您是否在 MacOS 下以用户 xbmc 身份验证 samba 共享?

答案2

writeable=yes 在您的 smb.conf 文件中,您必须尝试使用​​而不是使用write list=name_of_user

此外,您还必须将 selinux 上下文设置为目录 media 上的 samba_share_t,如下所示:

semanage -fcontext -a -t samba_share_t '/home/xbmc/raid/media(/.*)?'

然后你需要运行这个命令:

restorcon -RvF /home/xbmc/raid/media

配置文件中的其他内容看起来都很好。

相关内容