It seems tricky and is very insufficently documented. But actually, sharing any folder with your virtual guest (any operating system) is easy when using samba.
Install and set up samba
This is an easy task on any linux distribution. There is a package in your distributions repository for sure.
Some links to distribution specific hints:
Don’t forget that you will have to fill sambas user database before any client can access password protected files!
Virtual guest networking
I’m using kvm with qemu networking and virt-manager to set up my hosts. Leave the networking to it’s defaults. This means guest are running in a separate subnet and access the host and the internet over a virtual NAT.
Bridge the virtual guest’s subnet to the host’s subnet
This is the crucial step that does the trick!
sudo editor /etc/sysctl.conf
uncomment the following line:
Now your guest can see anything your host is seeing on his subnet and vice versa.
What makes this approach better than using a briged network for your guests:
- Guests don’t need ip adresses on the outside network.
- Sharing even works if host is not attached to any network and doen’t have an ip address.