Password

如何在沒有任何使用者/密碼登錄的情況下使此 Samba 共享可訪問?

  • November 11, 2020

我已修改/etc/samba/smb.conf以創建[public]共享:

[global]
workgroup = WORKGROUP
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
panic action = /usr/share/samba/panic-action %d
server role = standalone server
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
usershare allow guests = yes
[public]
comment = Public Storage
path = /home/share
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

然後我做了:

sudo /etc/init.d/smbd restart
sudo smbpasswd -a pi  # enter a password here

不幸的是,當我從 Windows 訪問這個共享文件夾時,我需要輸入使用者名/密碼登錄(見下面的截圖)。

問題:如何在沒有任何使用者/密碼登錄的情況下使此 Samba 共享可訪問?

在此處輸入圖像描述


PS:我創建/安裝了這樣的共享文件夾:

sudo mkdir /home/share
sudo chown -R root:users /home/share
sudo chmod -R ug=rwx,o=rx /home/share
sudo mount /dev/sda1 /home/share

我終於找到了解決方案:

[global]
workgroup = WORKGROUP
netbios name = NAS
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
panic action = /usr/share/samba/panic-action %d
server role = standalone server
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
usershare allow guests = yes
[public]
path = /home/share
public = yes
guest only = yes
writable = yes
force create mode = 0666
force directory mode = 0777
browseable = yes

創建一個沒有任何使用者/密碼登錄的共享。

您可以在 Windows 中使用\\NAS\public.

引用自:https://unix.stackexchange.com/questions/619106