I found a little hard to setup a shared folder for my VMs. So thought of sharing it..
So, assuming you already have your host machine, VirtualBox installed on it and a VM running Fedora (any linux), there we go..
Highlight your VM in VirtualBox window.
The folder you chose to share is now visible and we are done with the VirtualBox settings. Click OK to come out of it.
Now boot up the VM. We need to install a few packages in Fedora for this. You may use below command to install the same.
This will install latest gcc and kernel-devel packages. Guest addition may get arrogant, at times and gives error that it can’t find a particular version of kernel-devel. I will explain how to solve that later.
Now we can install “Guest Addition”
Click on the “Devices” menu and select the below highlighted option.Some OS automatically run the autorun script from CD. Otherwise open a file-browser and open the CD contents. You will see “autorun.sh” file there. Drag and drop it to Terminal. It will first authenticate you and start installing “Guest Addition”.
You will get below output 99% of the times and that means just a reboot and you have a host-folder available in VM.
The shared folder will be auto-mounted in /media.
yum install kernel-devel-3.17.4-301.fc21.x86_64
Just run the below part out of it and do the “Guest Addition” installation again and you are good to go..
yum install kernel-devel-3.17.4
Now let me take you through another issue you may face. Your folder will get listed in /media. But you may not have permission to open it. In my case, “Shared” is the shared-folder. /media/sf_Shared is the path in VM where it is mounted.
This is because of the difference of UID in host and VM machines.
The easiest way to sort this out is to add the user account to vboxsf.
usermod -a -G vboxsf
I went for a reboot (of VM) after that and things worked well.
May be you want to do this too.
Create a link in your home directory to access the shared directory mounted in /media. Make sure your home directory does not have “Shared” folder already.
ln -s /media/sf_Shared ~/Shared
So now you may use ~/Shared as your window to the host-machine..