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

I read in these two links: here and here that it's possible to do this using Samba, but I am a little bit lost and need more information on how to proceed.

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

  1. What do I need to type in samba.conf to share a folder from the Linux guest? (the tutorial provided in one of the links above only explains how to share home directories)
  2. Are there any Samba commands that I need to run on the guest to enable sharing?
  3. How do I make sure that these folders are only available to the host OS and not on the Internet?
  4. Once the Linux guest is setup, how do I access each of the individual shared folders from the Windows host? I read that I need to mount a drive on Windows to do this, but do I use Samba logins, or Linux logins, also do I use localhost? or do I need to set up an IP for this?



3 Answers 3

  1. These are examples how you define a share in your smb.conf

       comment = some share
       path = /this/folder/is/shared
       guest ok = no
       browseable = yes
       read only = yes
       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 you edit smb.conf run "testparm" to check your changes, then let the daemon re-read the config with a "service smbd restart"

  3. (Not sure about this one)
    With a "NAT" and "host-only" virtual network card you should be safe. To reach the guest's services from any other computer but the host, you would need to set up port forwardings on the host or configure a "bridged" virtual network card.

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

    To access the shares from your Windows Host you have to use the guest's IP address. VBox NATs are use addresses like "". To reach the share "readonly-share" from the host you can write a URI like this in the File Explorer's address bar:

  • If I could give you 10 votes I would. Thanks SO much! Mar 15, 2011 at 23:43

In the answer that bytesum gives, readonly-share must not be a full path, but the path stripped of its $HOME part. I.e.: in my case I was testing to share /home/me/Documents; my machine is named MYMACHINE. So in Windows7 I had to specify when mapping a network drive:


note the absence of /home/me. Problem solved.

**[Global Section]**
workgroup=WORKGROUP[your workgroup name here mine is"WORKGROUP"]
interfaces=your guest ip here
allow hosts=windows ip here
**[Share Details]**
path=samba share path
  • Adding detail about why this is a solution would improve your answer. An indication of why this is better or improves the accepted answer would help
    – Dave M
    Jul 23, 2017 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.