公共共享的 Samba 配置

公共共享的 Samba 配置

昨天我将我的 fedora 盒子升级到最新版本,同时,我也升级了 samba,现在使用 samba 4。我以前可以从家里的任何计算机访问这些共享,无需用户/密码,但现在配置似乎有问题。

这是我的 smb.conf

[global]
    workgroup = mygroup
    server string = Samba Server Version %v
    netbios name = HOME-WS
    log file = /var/log/samba/log.%m
    max log size = 50
    guest ok = yes
    security = share

[Media]
    path = /mnt/Media
    read only = yes
    browseable = yes
    guest ok = yes
    guest only = yes

[Music]
    path = /mnt/Music
    read only = yes
    browseable = yes
    guest ok = yes
    guest only = yes

查看日志,有一个与安全参数相关的警告

 WARNING: Ignoring invalid value 'share' for parameter 'security'

这是否意味着 samba 4 最终删除了“共享”作为一个选项,有没有替代方案,以便我可以配置没有密码的共享。

答案1

如果您点击 JasonAzze 的常见问题解答链接,您将看到有一行“映射到客人”,这也是必需的,因此您需要以下两行:

security = user
map to guest = Bad Password

我遇到了与楼主相同的问题,并且我已经测试过此解决方案在 Fedora 18 上有效

答案2

在花了几个小时尝试让它在 SAMBA4 下工作之后,我感到有义务分享这个 - 这是我的工作 SAMBA4 smb.conf,它不需要密码就可以从 Windows 访问共享

  [global]
  workgroup = HOME
  server string = %h server (Samba, Ubuntu)
  dns proxy = no
  log file = /var/log/samba/log.%m
  max log size = 1000
  syslog = 0
  panic action = /usr/share/samba/panic-action %d
  server role = standalone server
  security = user
  map to guest = Bad Password
  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
  usershare allow guests = yes

  # VIDEO SHARE
    [HD]
    comment = HD Video Share
    path = /RAID/HD
    public = yes
    writable = yes
    available = yes
    browsable = yes
    guest ok = yes
    create mask = 0777
    directory mask = 0777

答案3

将“安全 = 共享”更改为“安全 = 用户”

原因:Samba4 中已不再使用共享和服务器。

答案4

它对我来说非常快

来源 :https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server

[global]
    map to guest = Bad User
    log file = /var/log/samba/%m
    log level = 1

[guest]
    # This share allows anonymous (guest) access
    # without authentication!
    path = /srv/samba/guest/
    read only = no
    guest ok = yes

相关内容