"Enter"a basıp içeriğe geçin

smb:\\ubuntu-qemu.host\users on a fully-powered win10 vm to easily share files between linux and windows environments (docker powerized)

Do not judge or ask me why I do this, I was just helping out to a friend to resolve some problems around Windows 10 technologies lately and I took the challange to have a functional win10 virtual environment in my linux playground aswel.

I first created a running Windows 10 VM environment + licensed msoffice and stuff running in qemu-kvm on my Ubuntu 18.04 LTS system; powered by Thinkpad t460 tbh :proud:

then there was the problem… sharing files between the hosts.

I was thinking about networking + virtualization solutions to overcome this so I just found this very useful, interestingly documented, nice docker container; easy to configure and ready to use : dperson/samba

Thank you dperson, this is very useful!
Next step: Run this one liner docker run to have SMB protocol up and running on your environment, I will explain the command below :

$ sudo docker run -it --name samba -p 139:139 -p 445:445 -v /mnt:/share -d dperson/samba -w "USERS" -u "win;badpasswd" -s "users;/share;yes;no;yes;win;win;win;win" 
This above command will pull the image from the hub and run it with the following samba configuration for smbd.

/share mountpoint inside the docker container will bind mount onto /mnt on Ubuntu host and
make sure there’s a user named win privileged by badpasswd to make sure it can access and rw onto shared “users” directory. Make sure it’s running :
$ sudo docker ps 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                    PORTS                                                     NAMES
fe43d80f567a dperson/samba "/sbin/tini -- /usr/…" 24 minutes ago Up 24 minutes (healthy)>139/tcp, 137-138/udp,>445/tcp samba
On my Windows10, I just had to add “Map Network Drive” just like in the screenshot attached below :
Setting up Map Network Drive with smb:\\ on Win10 (vir) to Ubuntu (phy) powered by Docker container
\\users is the smb:\ ip address which is actually running in my docker container hosted on my ubuntu physical host and the ip address is the virbr0 qemu-kvm nat networking bridge interface ip address (which I have win10 vm on the same network) and ta-da! It’s accessible as the driver name (Y in this case) and you can just copy any kind of files from the windows 10 virtual environment and you will be able to see and reach those files on your /mnt mountpoint on your ubuntu host by docker and networking power. I just find it delicious and smart.
Just smooth
Synchronized samba fileserver between virtual and physical operating systems


Some useful stuff to troubleshoot around

$ sudo docker inspect $ID
$ sudo docker logs $ID
$ sudo smbclient -L localhost -Uwin -WUSERS

WARNING: The "syslog" option is deprecated
 Enter USERS\win's password: 
     Sharename       Type      Comment     --------- 
     users           Disk      win     
     IPC$            IPC       IPC Service (Samba Server)
 Reconnecting with SMB1 for workgroup listing.
To remove the docker container in case of any need :
$ sudo docker stop samba
$ sudo docker rm samba
$ sudo docker volume prune (this will attempt to remove all unusued volumes by docker)
I find myself suprised how come these 2 very different systems have started to work together very nice, delighted.

Hope you enjoy it!

İlk Yorumu Siz Yapın

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.

This site uses Akismet to reduce spam. Learn how your comment data is processed.