Troubleshoot VirtualBox Linux Ubuntu guest access from Windows host

25
2013-09
  • wrschneider99

    I'm running VirtualBox on a Windows 7 Host, with an Ubuntu Linux guest OS.

    I'm trying to set up Samba on Linux to access a folder (/home/user) from the Windows host as a share - which I believe SHOULD be possible, but having trouble getting it to work. I am aware of the Share Folder option of VirtualBox but I specifically need to get this done using Samba.

    I installed Samba (apt-get install samba sambafs) and set up /etc/smbd.conf with a share

    [usershare]
    path = /home/user
    read only = no
    browseable = yes
    

    Not worried about securing it by user just yet - want to get it working first.

    I set up two network adapters in VirtualBox - one NAT so I can get to the Internet for apt-get and stuff, one Host-Only hoping that will let me access the Ubuntu guest from the host only. (Hence the lack of immediate concern over user-level security.)

    Now, I can see an IP for the Host-only network in Windows, and tried to access it in the Windows Explorer - a blank window comes up and I don't see anything. The IP looks like 169.254.127.xxx. If I put in \\169.254.127.xxx\usershare it hangs for a while and fails.

    How do I troubleshoot this?

    Is this likely a networking config problem or a Samba problem?

  • Answers
  • wrschneider99

    OK, I think I figured it out.

    There were a few gaps in my understanding:

    Samba setup

    • I realized that Samba users require their own authentication are not necessarily the same as UNIX usernames/passwords. So I created account with smbpasswd.
    • I then confirmed that Samba setup was correct by mounting locally within the VM using smbmount, e.g., smbmount //localhost/share /mnt/test -o user=testuser,pass=password

    Virtualbox setup

    • I ended up wtih two NIC's on my VM - eth0 is default NAT adapter, then new eth1 is host-only
    • In the VM, I gave eth1 a static IP address on the same subnet as the host-only network in VirtualBox File>Preferences>Network menu. The key I was missing is that the VM needs a DIFFERENT IP address than the host-only adapter on the host side. So the host-only adapter in VirtualBox is on 192.168.100.1, the static IP for Ubuntu guest is 192.168.100.2 (for example).
    • Finally, once this was set up, I could see the Samba share under \\192.168.100.2\share\

  • Related Question

    network shares - How to access Guest (Linux) Filesystem from Host (Windows) in VirtualBox
  • Dominic Barnes

    I am trying to synchronize my music between my desktop (Ubuntu 9.10) and my laptop (VirtualBox: Windows 7 host & Ubuntu 9.10 guest) I use Unison to perform the actual sync, which itself is not the problem. I am ultimately trying to get my Windows 7 host to be able to access the music files so I can sync my iPod Touch.

    What I need to figure out is how I can that to work. I would prefer to actually perform the sync to my Ubuntu Guest, mostly because of the filename allowed character differences between Windows and Linux.

    Is there a way to access the files on my Linux Guest from the Windows Host?

    • Can I mount the VDI in Windows when VirtualBox is off?
    • Can I have Windows Host access the Linux Guest filesystem while VirtualBox is running?

  • Related Answers
  • Neal

    This forum post explains how to mount the disk with the machine switched off, but you will need to have it formatted with a Windows friendly filesystem...

    I would use Samba to do a network share for access while the system is running, see this page in for how to do it in Ubuntu. You could also use the "shared folders" thing in Virtualbox.