Sharing between Host and Guest in Virtualbox

The solution although a little bit confusing is this:

Ubuntu Guest with Ubuntu Host

After installing the Guest Ubuntu:

  1. Load the Guest Addition ISO from the Virtualbox Menu

    enter image description here

  2. In the guest Ubuntu open a terminal and install some essential files for the Guest Addition to install correctly:

    sudo apt-get install dkms build-essential linux-headers-generic in my case of 32Bit

  3. Run the Linux Guest Addition installer in the Guest Ubuntu. Open the terminal, cd yourself to the mounted image (In my case is cd /media/cyrex/VBOXADDITIONS_4.1.6_74713). In your case you need to input cd /media/USER/VBOXADDITIONS_VIRTUALBOX_VERSION where USER is your username and VIRTUALBOX_VERSION is the current version you are installing. After that run the Guest Addition:

    sudo ./VBoxLinuxAdditions.run (It is in the root directory of the ISO image)

    enter image description here

  4. Since you installed the needed packages in step 2, you should be fine after installing the Linux Addition since it will configure with no problems. Say yes to a question or two it might ask but this will not do you harm since it will be checking to see if you have the guest addition installed already. Reboot after finishing the install.

  5. Now when the guest starts again you should see that you have several new options available like input devices, views, etc.. but the one you are needing is SHARE FOLDERS!!. To share a folder you already know that is done from the Virtualbox Menu.

    enter image description here

  6. But what we need is to connect to this Shared folder from the Host. To do this first create a folder in the guest which will link to the shared folder from the host. For example lets create in the guest home folder the directory virtual. Now assuming the shared host folder is also called virtual we would set this up in the guest like this:

    sudo mount -t vboxsf virtual ~/virtual

    Now you can access the shared folder.

NOTES ON HOW TO SHARE, AUTO MOUNT AND 3D

  • The name of the shared host folder must be the same as the guest folder. In the example mentioned above you have both named virtual, but it could be both named bck, shared, virtualbox, etc... This will solve several "protocol" errors.

  • Since mounted shares have by default root as owner, to mount them as YOU, you can do for example:

    sudo mount -t vboxsf -o uid=1000, gid=1000 virtual ~/virtual when mounting them

  • To automount a share folder add it to /etc/fstab. This way when you load the guest it will have the shared folder already mounted.

  • If (JUST IF!!) you by change have a editing/saving problem directly in the shared folder. Just copy over the file to another place. Edit the file, save it, copy over back to the shared folder, replacing the one in there.

  • If the 3D Acceleration support was not enabled when you did the virtualbox setup. Do not worry just run the guest addition again after activating it as seen here:

enter image description here

  • You can also do the Guest Addition setup from the Proprietary Driver Manager. That is, jockey-gtk As seen in this picture (This is the same as Step 2)

enter image description here

After all of this you should have a Virtualbox that shares folders with the host and back and has 3D acceleration. Here is an image of the outcome:

enter image description here

Windows Guest with Ubuntu Host

If you are using Windows Vista and up, by simply installing the Guest Addition, Sharing the folder (The same procedure as in the Ubuntu example) and rebooting the Windows Guest session you will automatically see the Shared folder between both systems.

If you are using Windows XP, 2000 or 2003 you can use the answer shown in: How do I set up shared folders in a Windows XP virtualbox guest?

To do the sharing via a command line, Takkat has a nice tutorial in How to access a shared folder in VirtualBox? and in How do I set up shared folders in a Windows XP virtualbox guest?

To understand how the network works inside a virtual environment (in this particular case) see Wireless Network in Virtualbox


Red Hat Virtual Machine Manager supports KVM, Qemu, and Xen, but not Virtual Box that comes with their own graphical or command line management tools.

For full support of all features (incl. USB 2.0 and RDP) the installation of the up-to-date closed source or PUEL version (free) of Virtual Box is recommended (see this answer for details).

After that guest additions need to be installed on the Ubuntu guest as is further elaborated in this answer.

For shared folders usage see here.