我在 Debian 9 主机上的虚拟机中运行 Tails。为了通过 Tails 访问主机上的共享文件夹,我尝试设置 Samba-exchange。
虽然这种方法在 Debian 8 中运行良好,但在 Debian 9 中不再适用。尝试连接到 Samba 共享时,我总是收到以下错误:
"无法访问位置。无法从服务器检索共享列表:连接超时。 "
在QEMU
-settings 中,我将网络源(虚拟网络接口)指定为带有 name 的网桥virbr0
,设备型号为virtio
. 运行机器时,桥接器被激活,物理网络接口也被激活,来宾(= Tails)接收互联网访问没有任何问题。只有Samba
-share 不起作用。
我的/etc/samba/smb.conf
样子是这样的:
[global]
workgroup = WORKGROUP
netbios name = MYCOMPUTER
name resolve order = bcast
dns proxy = no
log file = /var/log/samba/log./%m
max log size = 50
panic action = /usr/share/samba/panic-action %d
server role = standalone server
map to guest = bad user
usershare allow guests = yes
security = user
server string = %h server (Samba, Ubuntu)
bind interfaces only = yes
interfaces = enp0s25 virbr* lo
[Windows-SMB]
comment = Shared Samba Network Drive for Windows
path = /home/user/Public/Windows-Exchange
public = no
guest ok = no
browseable = yes
writeable = yes
[Tails-SMB]
comment = Shared Samba Network Drive for Tails
path = /home/user/Public/Tails-Exchange
public = no
guest ok = no
browseable = yes
writeable = yes
我尝试了所有可能的解决方案:
- 安装包
gvfs-bin
编辑/etc/samba/smb.conf
:
- 添加
netbios name = NAME-OF-PC
- 添加
name resolve order = bcast host
然而,他们都没有工作。
我试图缩小错误的来源:
testparm
未检测到任何错误,smbtree
正确显示所有共享。如果我从中获取显示的 IP 地址nmblookup <hostname>
并将其插入到 Tails 中,我会再次收到上述错误。
但是,从访客 ping Samba-share-IP 可以正常工作。我只是无法使用 Tails 文件浏览器访问共享。
我可以看看其他一些想法?
该命令smbclient -L host
给我带来了“与主机的连接失败(错误 NT_STATUS_UNSUCCESSFUL) ”。但是,如果我键入,smbclient -L 192.168.178.31
我会成功获得包含共享的表格。
以下是当前情况的一些截图:
通过 CLI 进行配置检查:
user@hostname: ~$ smbtree
WORKGROUP
\\HOSTNAME HOSTNAME server (Samba, Ubuntu)
\\HOSTNAME\IPC$ IPC Service (HOSTNAME server (Samba, Ubuntu))
\\HOSTNAME\Tails-SMB Shared Samba Network Drive for Tails
\\HOSTNAME\Windows-SMB Shared Samba Network Drive for Windows
user@hostname: ~$ nmblookup
192.168.122.1 HOSTNAME<00>
(This seems to be fine)
虚拟机管理器:
Gnome 网络管理器:
通过文件浏览器连接到 Samba 共享 IP 时出现 Tails 错误:
Tails(成功?)向 Samba-Server-IP 发送 ping:
因此,这两个 IP 似乎都可以正常工作:192.168.122.1
以及192.168.178.31
(从重新启动 samba 服务器之前的先前尝试)。
Update: Samba-exchange is still not working.
Maybe interesting: Very frustrated about this Samba-issue I reinstalled my Debian 9 host several times because I thought I did a mistake anyhow. Hereby I think to remember the following fact: The first time I installed Debian and wanted to start Virtual Machine Managers default
network bridge virbr0
I got an error that no firewall has been detected. Therefore Virtual Machine Manager
did not want to start this bridge. I never received such a warning before, so I deleted the default
network bridge and recreated a new one with identical settings and the same name. However, manually starting this new bridge was easily possible without any problems. Although still no firewall has been installed Virtual Machine Manager accepted the new bridge without complains. I think to remember that this time I got the Samba-exchange working.
However, I did a whole reinstall of the host system because some other things did not work and I played a lot with packages in the meanwhile. Hereby I figured out that this error message "No Firewall has been detected" was caused by missing packages firewalld
and dnsmasq
. I installed those packages and never got Samba exchange working again.
Unfortunately I am not that much into Linux to figure out the mistake by myself. Maybe it is just an easy thing with IP-settings of the firewall or something like this...
Another stupid behavior of Samba is the fact that directly after restarting the Samba server by command /etc/init.d/samba restart
the smbtree
-command does not work straight ahead. I have to wait several seconds sometimes until I do not receive an empty line anymore and the tree is displayed.
Furthermore the smbtree
command only shows one output line with the hostname sometimes, but without naming the created Samba shares. This behavior seems to be influenced by the options in smb.conf
. The upper presented smb.conf
invites smbtree
-command to correctly show the shares in its output as well. However, if I do a very simple [global]
section with only two basic entries, sometimes the output of smbtree
remains completely empty - I don't know why.
On my Debian 8 host machine with identical settings the smbtree
-command output indeed is only one line as well. Maybe there is a bug anywhere? Normally smbtree
should show the host name and the Samba shares as well. At least the Samba exchange is working on this Debian 8 system (no firewalld
and no dnsmasq
are installed here).
you are using broadcast ( bcast ) to resolve the name but you have your machines on different subnet.
broadcast name resolving only works on the same subnet.
you must add an entry to your
/etc/hosts
on the tail host that says:you can do that with this command:
always check this file on reboot because i don't think tail will keep this change persistent.
A colleague figured out the problem:
默认情况下,Samba 被
firewalld
. 因此,必须安装软件包firewall-config
以在防火墙中激活 Samba。可能这在没有 GUI 的情况下也是可能的,但firewall-config
它是一个 10 秒的任务......提到在防火墙中激活 Samba 为永久的,不仅适用于当前会话。现在一切正常!