当将我有 Samba 服务器的 Linux 主机 IP 粘贴到 Windows URL 栏中并按 Enter 键时,我在 Samba 中创建的连接出现,但随后我无法连接,它出现这条信息
本教程Windows 10 无法连接到 Samba 共享(来宾访问)正是针对我的问题,但我按照步骤操作,但运气不佳,错误仍然存在。
这是我的 Samba 配置:
[global]
workgroup = WORKGROUP
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
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
pam password change = yes
map to guest = bad user
usershare allow guests = yes
# Custom connection 1
[Anonymous]
comment = Anonymous File Server Share
path = /media/bz/Data/.VM-shared
browseable = yes
writable = yes
guest ok = yes
read only = no
force user = nobody
# Custom connection 2
[Public Directory]
# path = /Public/Files
path = /media/bz/Data/.VM-shared
guest ok = yes
read only = no
browseable = yes
# Custom connection 3
[Private Directory]
# path = /private/files/
path = /media/bz/Data/.VM-shared
valid users = me
read only = yes
browseable = no
每次我编辑smb.conf
我运行
testparm
sudo systemctl restart smbd
sudo service smbd restart
我所做的其他步骤:
更改主机共享文件夹的权限
sudo chmod -R 0775 /path/to/shared/folder
sudo chown -R nobody:nogroup /path/to/shared/folder
注意:如果我运行/etc/init.d/samba
:给我这个错误No such file or directory
在 UFW 中添加规则
sudo ufw allow samba
笔记:我测试了完全禁用 UFW 但问题仍然存在
将我的用户添加到 Samba
sudo smbpasswd -a My_username
安装
sudo apt install samba smbclient