My host is Windows 7, and VM is Ubuntu 12.04. I use it for web development and I need to make Git repo from virtual HDD visible for the host OS to edit files on the host. What is the best way to do it?


There are two straight forward ways to accomplish this that are independent of the virtualization software that you are using.
1. set up a samba share folder on the guest and then add it like a shared network folder on the host. 2. Share a folder on the Windows host and then use samba to open/map it on the Ubuntu guest.

Virtual box, and I believe VMWare have an option to share folders between guest and host that uses this underlying setup but is all done through the gui of the virtualization software.

To be more specific I would need to know what path you would like to take. Option 1 would best match the paradigm of guest to host.

  • Unfortunately, SAMBA share from Virtualbox's GUI doesn't preserve file permissions because all files are located at NTFS drive. If I do git diff, I get many messages about file permission changes. Thus I need some solution on the guest side. – Sergey Filkin Jan 7 '14 at 6:07
  • 3
    It looks like you will have to set up a samba share on the guest then. Here is a link that covers the basic install of samba and configuration of a shared folder: help.ubuntu.com/10.04/serverguide/samba-fileserver.html watch out for this line in the instructions as ti will kill the permissions and I dontt think it is necessary $sudo chown nobody.nogroup /srv/samba/share/ – Evan Jan 7 '14 at 19:57
  • Updated link to the ubuntu Samba file server docs: help.ubuntu.com/lts/serverguide/samba-fileserver.html – mike Jul 9 '15 at 15:54

Right click the virtual machine in VirtualBox and select Settings. You'll see the dialog below with a button to add a shared folder.

enter image description here

  • Thank you for your comment, but this solution doesn't preserve file permissions, because files are located at NTFS partition. I need another solution on the guest side. – Sergey Filkin Jan 7 '14 at 6:08
  • 2
    In that case, you're talking about normal networking and virtualization is irrelevant. You might want to simply use Samba. – Jo-Erlend Schinstad Jan 7 '14 at 22:40

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.