我正在我的机器上运行 Ubuntu 20.04.3 LTS,我尝试使用 samba 运行 docker 容器(基于 ubuntu)。
容器在后台运行。我可以使用以下命令将共享文件夹挂载到主机操作系统
sudo mount -t cifs -o username=sambakot,uid=kot,gid=kot //127.17.0.2/sambashare ~/tests/myFolderToMount/
但是,如果我尝试使用“其他位置”通过默认文件管理器访问 samba 共享,那么当我输入用户凭据时什么也不会发生。没有错误消息,只是当我单击“连接”时什么也没有发生。该窗口仍然可单击,我可以再次单击“连接”,但仍然没有任何反应。
主机有一个用户,除了根-科特
Docker 容器有根和桑巴科特作为用户
smb.conf 包含(我删除了所有注释行,它只是一个默认配置,仅添加了最后一个 sambashare 部分)
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
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
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
[sambashare]
path = /dirToMount
browsable = yes
read only = no
guest ok = no
docker 容器内 /dirToMount 的权限如下所示:
drwxrwxrwx 2 sambakot sambakot 4096 Feb 6 18:51 dirToMount/
使用文件管理器时我做错了什么?
不确定这是否重要,但我认为网络连接一切正常(端口转发)
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
183e3f525ae2 sambav6 "/bin/bash -p" 37 minutes ago Up 37 minutes 0.0.0.0:139->139/tcp, :::139->139/tcp, 137-138/udp, 0.0.0.0:445->445/tcp, :::445->445/tcp friendly_chebyshev