Samba

公共共享的 Samba 配置

  • January 4, 2021

昨天我將我的 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 最終刪除了“共享”作為選項,是否有任何替代方案,這樣我就可以在沒有密碼的情況下配置共享。

如果您點擊 JasonAzze 的 FAQ 連結,您會看到“map to guest”這一行也是必需的,因此您需要這兩行:

security = user
map to guest = Bad Password

我遇到了和 OP 一樣的問題,我已經測試過這個解決方案可以在 Fedora 18 上執行

在花了幾個小時試圖讓它在 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

引用自:https://serverfault.com/questions/470650