为什么如果不强制用户=我,其他用户就不能访问我的 SAMBA 共享?

为什么如果不强制用户=我,其他用户就不能访问我的 SAMBA 共享?

我有一个与 Samba 相关的问题。

我的家庭服务器上已成功设置了 Samba 服务器。不幸的是,当我的帐户(服务器)未设置强制用户时,只有我的帐户可以访问共享。我不明白为什么当我未设置“强制用户 = 服务器”时,其他用户无法访问我的共享“Vector_Public”。您知道是什么原因导致的吗?我是 Samba 新手,如果我误解了任何设置,请告诉我:

[Vector_Public]
   comment = Vector public share
   read only = no
   path = /media/Storage/Public
   guest ok = no
   force user = server
   force group = storage_public
   create mask = 0770
   directory mask = 0770
   security mask = 0770
   force create mode = 0770
   force directory mode = 0770
   valid users = server storage_share
   browseable = yes
   writeable = yes
   vfs objects = recycle
   recycle:repository = .deleted/%U
   recycle:keeptree = yes
   recycle:touch = yes
   recycle:versions = yes
   recycle:maxsize = 0

[Vector_Private]
   comment = Vector private share (Niklas)
   read only = no
   path = /media/Storage/Private
   guest ok = no
   force user = server
   force group = server
   create mask = 0770
   directory mask = 0770
   security mask = 0770
   force create mode = 0770
   force directory mode = 0770
   valid users = server
   browseable = yes
   writeable = yes
   vfs objects = recycle
   recycle:repository = .deleted/%U
   recycle:keeptree = yes
   recycle:touch = yes
   recycle:versions = yes
   recycle:maxsize = 0

两个目录的权限为:

drwx------ 6 server server 4096 2011-10-05 20:40 Private
drwxrwx--- 5 server storage_public 4096 2011-10-05 20:28 Public

我在目录 Public 上遇到了这个问题。

显然,共享 Vector_Public 下的任何设置都不会改变这种行为,所以一定是因为其他设置,这些是我的配置中的所有其他设置:

   workgroup = ROSENQVIST
   server string = %h server (Samba, Ubuntu)
#   wins support = no
;   wins server = w.x.y.z
   dns proxy = no
;   name resolve order = lmhosts host wins bcast
;   interfaces = 127.0.0.0/8 eth0
;   bind interfaces only = yes
   log file = /var/log/samba/log.%m
   max log size = 1000
#   syslog only = no
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   security = user
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
   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
;   domain logons = yes
;   logon path = \\%N\profiles\%U
#   logon path = \\%N\%U\profile
;   logon drive = H:
#   logon home = \\%N\%U
;   logon script = logon.cmd
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
; add group script = /usr/sbin/addgroup --force-badname %g
;   printing = bsd
;   printcap name = /etc/printcap
;   printing = cups
;   printcap name = cups
;   include = /home/samba/etc/smb.conf.%m
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash
;   winbind enum groups = yes
;   winbind enum users = yes
;   usershare max shares = 100
   usershare allow guests = no

有什么想法我应该怎么做?(另请查看新评论)

此外,我如何知道我的网络是否支持 WINS 服务器?

答案1

问题是由于权限流问题造成的。当我更改父目录(共享目录)的权限以允许其他用户读取时,一切正常。

答案2

您的公共文件夹仅向“服务器”或“storage_public”组中的用户提供访问权限。如果您不使用“强制用户”并允许匿名访问,则共享可能由不在“storage_public”中的用户 nobody 访问。

您可能想要将公共文件夹的权限更改为“drwxrwxr-x”,这将使 Samba 用户可以读取但不能写入公共文件夹。

为此,请使用“chmod o+rX Public”

关于 WINS:

您的网络并不支持 WINS,但个别服务器可以提供该功能。您可以通过设置“wins support = yes”在特定服务器中启用 wins 支持。

相关内容