Samba - mount - 用户权限

时间:2014-06-26 15:17:10

标签: linux share mount samba

我无法允许常规用户访问samba mount。我可以作为root访问挂载点,但是普通用户会被拒绝"错误。

  • 服务器在android CM10.1.3上运行,Samba v3.0.20a(Samba Fileshearing app,build:140525)
  • 客户端正在运行Fedora 20,Samba客户端v4.1.6

这是mount命令:

sudo mount -t cifs -o credentials=/home/david/.sambacredentials,sec=ntlm,uid=david,gid=david,file_mode=0775,dir_mode=0775 //192.168.1.12/sdcard Documents/

这是错误:

$ ls Documents/
ls: cannot open directory Documents/: Permission denied

以下是安装目录权限:

d---rwxr-x. 14 filip filip    0 Jun 26 15:30 Documents/

编辑:smb.conf

[global]
interfaces = wlan0
bind interfaces only = yes
workgroup = WORKGROUP
server string = Samba on Android
netbios name = FILIPSMB
remote announce = 255.255.255.255
encrypt passwords = yes
security = USER
restrict anonymous = 1
load printers = no
printcap name = /dev/null
disable spoolss = yes
deadtime = 5
delete readonly = yes
nt acl support = no
inherit permissions = yes
socket options = SO_SNDBUF=16384 SO_RCVBUF=16384
local master = no
unix extensions = yes

[sdcard]
vfs objects = fake_perms
comment = Android /storage/sdcard0
path = /storage/sdcard0
force user = root
read only = no
writable = yes
guest ok = no

1 个答案:

答案 0 :(得分:0)

您需要创建一个包含filip和david的公共组。例如,作为root:

group add smbusers
groupmod -A david smbusers
groupmod -A filip smbusers
chown filip:smbusers /path/to/Documents

文件组应该是:

d---rwxr-x. 14 filip smbusers    0 Jun 26 15:30 Documents/

我不建议使用0075的文档权限,所以为什么不

chmod 0775 /path/to/Documents

文件组现在将是:

drwxrwxr-x. 14 filip smbusers    0 Jun 26 15:30 Documents/

现在尝试以用户身份重新连接。 (您还可以在valid users中为共享添加smb.conf列表,但是现在,让我们以合理的配置获取目录和组。)

您还必须Documents成为有效的samba共享(抱歉,我认为您已经这样做了)。在smb.conf中,创建一个Documents份额(名称可以是您喜欢的任何内容)。根据您之前发布的内容,它看起来与此相似)

[Documents]
        comment = Documents Share
        path = /full/path/to/Documents
        valid users = smbusers # the group you created holding david & filip
        browseable = Yes
        writeable = Yes

编辑smb.conf后,运行testparm,它将检查错误并提供您的共享转储。然后重启samba(smb和nmb守护进程)。确认david可以访问Documents共享:

smbclient -Udavid -Llocalhost

然后尝试重新连接到Documents。 (如果你遇到smbclient命令的任何问题,那么用你的实际主机名代替localhost。(这表示胜利解决失败,要纠正,将以下内容添加到smb.conf的全局部分:

 name resolve order = lmhosts wins host bcast