Tuesday, March 29, 2016

Share a host folder with an Ubuntu VM using VirtualBox

This post describes how an Ubuntu based virtual machine on VirtualBox can access a windows folder.

In order to achieve this functionality follow the next steps.

Step 1. Run VirtualBox Manager, right click on your VM and select settings. There select the "Shared Folders" Option and press the add button on the right. In the "Folder Path" select the folder that you want to share, and in the "Folder Name" type a name. Moreover, select "Auto-mount" and "Make Permanent".

 

Step 2. Run your VM. Your folder has been mounted in the directory /media named "sf_<Folder Name>", where <Folder Name> is the name you selected in step 1. Nevertheless, this folder cannot be accessed.

Step 3. In order to be able to access the shared folder from your VM you have to add you user account to the group "vboxsf". You can do that by executing the following command:

sudo usermod -a -G vboxsf <username> 

Where <username> is your account user name. Restart, and you will be able to access the shared folder.