[Host OS: Windows XP, Guest OS: Ubuntu 8.10]
If you are using VMware as your virtualisation software you will be able to copy files directly from the host to the guest OS, and vice versa. But unfortunately this feature does not exist in VirtualBox. Not yet at least.
However, there is a very easy way you can share files between the host and guest when using VirtualBox – using Shared Folders.
First you have to create folder in your Windows host. For example, create a folder on your desktop called “myshared“.
Then start your Ubuntu VM. After you get to the desktop, press the right-Ctrl button so that your mouse pointer can move outside the Ubuntu desktop. From the menubar, go to Devices-> Shared Folders. After that click the Add New Shared Folder button and then browse to the folder you created earlier (myshared). Make sure you tick the “Make Permanent” checkbox.
After you have added the folder, click OK and return back to your Ubuntu desktop. Then create a folder in Ubuntu which will be used as the shared folder on the guest OS. For example, create a folder called “SharedItems” on your desktop.
Then open a new Terinal window (Applications -> Accessories -> Terminal) and execute the following command:
sudo mount -t vboxsf myshared Desktop/SharedItems
The text in red is the name of the shared folder in the Windows host and the text in blue is the directory path of the shared folder on the Ubuntu guest.
Once you’ve done that, you can now share files between the two OSs by simply placing files in the folders. Here’s an example. I put a GIF file in the myshared folder and when I open the SharedItems folder, I have that file available for me.
There’s just one more thing to do now. To make sure that the shared folders are mounted automatically when you start your computer, open Terminal and execute the following command:
sudo gedit /etc/init.d/rc.local
This will open the rc.local file in Gedit. Now scroll to the bottom of the file, add the following line and save it.
sudo mount -t vboxsf myshared /home/nass/Desktop/SharedItems
Once again, the red text is the name of the shared folder in the Windows host and the text in blue is the directory path of the shared folder on the Ubuntu guest.
The difference here is that since I created my folder on the Desktop, I had to give the full path. But earlier I didn’t have to write the “/home/nass” part because when you open Terminal, by default you are placed in your Home folder.