Share folders from Linux guest with Windows host in VirtualBox using Samba


Amelio Vazquez-Reina

I would like to share a folder from a Linux Guest in VirtualBox with a Windows host (with read and write access if possible).

I read these two links: here and here , it is possible to do this with Samba, but I am a bit lost and need more information on how to do it.

So far I managed to setup two network adapters (one NAT and one host only) and install Samba on the Linux guest, but now I have the following problem:

  1. What do I need to enter to samba.confshare a folder from a Linux guest? ( The tutorial provided in one of the links above only explains how to share the home directory)
  2. Do I need to run any Samba commands on the client to enable sharing?
  3. How can I ensure that these folders are only available to the host OS and not to the internet?
  4. After setting up a Linux guest, how can I access each individual shared folder from the Windows host? I read that I need to mount the drive on Windows to do this, but do I log in using Samba or Linux, also using localhost? Or do I need to set an IP for this?

Thanks!

username
  1. These are examples of how you can define shares in smb.conf

    [readonly-share]
       comment = some share
       path = /this/folder/is/shared
       guest ok = no
       browseable = yes
       read only = yes
    
    [read-write-share]
       comment = another share
       path = /this/folder/is/writable
       guest ok = no
       browseable = yes
       read only = no
       create mask = 0777
       directory mask = 0777
       force create mode = 777
       force directory mode = 777
       force security mode = 777
       force directory security mode = 777
    
  2. After editing smb.conf, run "testparm" to check your changes, then let the daemon re-read the configuration with "service smbd restart".

  3. (Not sure about this)
    Use "NAT" and a "host-only" virtual NIC and you should be safe. To get services from a guest from any other computer than the host, you will need to set up port forwarding or configure a "bridged" virtual NIC on the host.

  4. Authentication type can be set in smb.conf. The default in Ubuntu's samba sets it to "security=user", which means you must authenticate with a valid useraccount. (unless you set "guest ok=yes" to "guest ok=yes")

    To access the share from a Windows host, you must use the guest's IP address. VBox NAT uses an address like "10.0.2.15". To access the share "read-only share" from the host, you can enter a URI like the following in the address bar of File Explorer:

    \\10.0.2.15\readonly-share
    

Related


Share folders between Linux host and Windows guest

obscene I'm trying to share a folder between the main OS (openSUSE 42.1) and a guest Windows 7 virtual machine, but can't get it to get set up properly. I've never had access to virtual machines virt-manager, and have read that the best way to do this is to us

Share folders between Linux host and Windows guest

obscene I'm trying to share a folder between my main OS (openSUSE 42.1) and a guest Windows 7 virtual machine, but I can't get it set up properly. I've never had access to virtual machines virt-manager, and have read that the best way to do this is to use Samb

Access Samba share from Windows 10 in VirtualBox

The Balvenie I read many user questions and blogs about this problem, but nothing solves my problem. I have a Linux CENTOS host with a Windows 10 guest installed in VirtualBox. On Linux, there is a user named "myuser" that shares a directory (777) and is regis

Access Samba share from Windows 10 in VirtualBox

The Balvenie I read many user questions and blogs about this problem, but nothing solves my problem. I have a Linux CENTOS host with a Windows 10 guest installed in VirtualBox. On Linux, there is a user named "myuser" that shares a directory (777) and is regis

Access site on host from guest using VirtualBox?

Gilchaz I'm running VirtualBox on a Mac (host) and the VM used is Windows 7 (guest). VirtualBox is set up to use a NATnetwork adapter and has internet access (google, msn, etc.) fine, but I'm hosting a site on a Mac (host) so I can't access it from the VM. The

Access site on host from guest using VirtualBox?

Gilchaz I'm running VirtualBox on a Mac (host) and the VM used is Windows 7 (guest). VirtualBox is set up to use a NATnetwork adapter and has internet access (google, msn, etc.) fine, but I'm hosting a site on a Mac (host) so I can't access it from the VM. The

Samba share / Window host / Ubuntu Guest

rookie encoder Here are the samba share line permissions for the folder . I've tried looking for an answer but can't find one that I understand. I have a desktop with Window 10 OS and Ubuntu in a VM. Using virtualbox, I share two folders on my Windows host wit