如何让 Samba 遵循无用户和密码的来宾帐户的符号链接

如何让 Samba 遵循无用户和密码的来宾帐户的符号链接

我想配置 Linux Samba 4.0.9,以提供对目录内容(来自其他位置的文件的符号链接)的只读访问,无需用户和密码。基本上,任何 LAN 用户都应该可以访问内容,而无需任何用户/密码问题。我有以下 smb.conf:

[global]
    load printers = no
    guest account = guest
    name resolve order = lmhosts host wins bcast
    passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
    preserve case = yes
    obey pam restrictions = yes
    encrypt passwords = true
    passwd program = /usr/bin/passwd %u
    dns proxy = no
    printing = bsd
    server string = Home Server
    invalid users =
    unix password sync = false
    workgroup = Home-Server
    log level = 2
    syslog only = yes
    os level = 20
    printcap name = /dev/null
    disable spoolss = yes
    syslog = 2
    security = user
    map to guest = Bad User
    panic action = /usr/share/samba/panic-action %d
    short preserve case = yes
    max log size = 1000
    unix extensions = no
    interfaces = lo lan0
    bind interfaces only = yes
    follow symlinks = yes
    wide symlinks = yes

[tv]
    comment = Myth Television
    available = yes
    browsable = yes
    public = yes
    writeable = no
    path = /myth/tv/pretty

[root]
    comment = Root FS
    path = /
    valid users = root
    force user = root
    force group = root
    admin users = root
    writeable = Yes

上述配置让我可以以较少的用户/密码访问 [tv] - 但尝试访问符号链接时,系统会提示“权限被拒绝”。完全相同的符号链接对 [root] 工作正常,因此我认为问题与较少的用户/密码访问模式有关(其中用户/密码不正确,Samba 正在使用“映射到访客 = 错误用户”指令)。有人可以提示我正确的配置吗?提前谢谢

答案1

为了允许符号链接,您需要使用wide links指令,而不是wide symlinks。我认为这wide symlinks可能是打字错误,因为我在页面中找不到对它的引用man

wide links = yes

资料来源:

编辑:我的服务器运行的 SAMBA 版本是 3.6.3。

答案2

嗯 - 看起来我在 smb.conf 中有一个旧的选项名称:应该用“wide links = yes”来代替“wide symlinks = yes”。现在它可以正常工作了。

相关内容