>

Part I. Install VirtualBox Guest Additions

Before we can mount the shared folder in Guest OS, we have to install Guest Additions in it, Virtualbox Guest Additions is a software and is distributed in its own CD image (.iso) file named VBoxGuestAdditions.iso, we need to get this image file from
http://download.virtualbox.org/virtualbox/, while we open this link and enter the subdirectory for the latest version of VirtualBox. The corresponding VBoxGuestAdditions_X.Y.Z.iso file should be there.

Once we have got VBoxGuestAdditions_X.Y.Z.iso image file, we should mount it on Guest OS so that it can be seen and be installed thereafter. There are multiple ways that we can mount the VBoxGuestAdditions_X.Y.Z.iso in Guest OS, For example, in the VirtualBox window, choose the Storage section under Details, and so forth.

or we can right click the cd icon in bottom status bar of Virtualbox Window, like below:

Before the VBoxGuestAdditions_X.Y.Z.iso can be installed successfully, we have to install the requiredd dependencies:

$ sudo apt-get install build-essential linux-headers-$(uname -r)
$ sudo apt-get install virtualbox-guest-dkms

Now reboot the system, the Virtualbox guest additions should be installed successfully.

Part II. Setting up the Shared Folders

1. Setup Shared Folders

We need to choose a folder from the host system that we want to share, and add it to a shared folder list in VirtualBox like this:

Once the system is rebooted, we should be able to see that the shared folder is mounted under /media directory (it is automatically mounted when the system starts up). the shared folder is auto named with a prefix sf_ (e.g. /media/sf_xxx).

If there /media/sf_SharedFolder does not exist after we reboot the system, it is probably because it is not mounted successfuly, we can try to manually mount it:

$ sudo mount -t vboxsf SharedFolder sf_SharedFolder

2. Shared folder access permission

Add our current user account into vboxsf group so that we can access to sf_xxx folder.

$ sudo adduser juniway vboxsf

or

$ sudo usermod -aG vboxsf juniway

juniway is the username

Note: we need to re-login so that this takes effect!

Since shared folders are always in /media directory, which is not a convenient location that in daily work, it is suggested to create a symbolic link in our $HOME directory so that we can access to it more quickly:

$ ln -s /media/sf_xxx ~/shared_dir

Also, we can even set it as the starting directory when we login to the system, add the below line into ~/.bashrc will achieve this:

$ cd ~/shared_dir

Done!





###### Reference --- http://juniway.blogspot.com/2013/09/virtualbox-shared-folders-on-ubuntu.html