Using Samba to share a folder from a Linux guest with a Windows host in VirtualBox

  1. These are examples how you define a share in your 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 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 "10.0.2.15". To reach the share "readonly-share" from the host you can write a URI like this in the File Explorer's address bar:

    \\10.0.2.15\readonly-share