Ubuntu 12.04 – Enabling Shared Folders Under VirtualBox

These instructions are for Ubuntu 12.04 running under VirtualBox 4.1.12 on Windows 7 with SP1. They should be the same for other version combinations, but no guarantee is made.

It shouldn’t matter on which host VirtualBox is running, but I don’t run it on anything other than Windows.

I have not tried sharing folders on other Linux distros, so these instructions may or may not work with them.

Assumes you have installed VirtualBox Guest Additions on Ubuntu 12.04. Instructions to do so can be found here.

If you have already enabled folder sharing and want instructions on how to add a shared folder to Ubuntu, instructions can be found here.

Shared folders allow you to easily share large files or large amounts of data between the host OS and the guest OS. In my case, I share code so I can test my code on both Windows and Linux.

Enabling Shared Folders

1) Open a terminal (Ctrl+Alt+T – detailed instructions can be found here).

2) Enter the following command:

sudo usermod -a -G vboxsf  <<username>>

<<username>> is your username. Your username precedes the @ symbol at the start of the command line.

In my case, my username is richard.

3) Enter your password when prompted. Press Enter when you have finished entering your password:

Note: for security reasons, Linux does not echo back your password – not even characters like # or * – so it looks like nothing is happening. This is normal.

4) Shut down or restart the machine. The changes will not take effect until the machine is restarted.

Understanding the Command

sudo temporarily raises your privilege level to super-user status (if you enter the correct password)

usermod modifies the user account

-a instructs usermod to add the user to the specified group

-G tells usermod that a group or list of groups follows

vboxsf is the name of the group to which shared folders belong

<<username>> is the name of the user to add to the specified group

Accessing Shared Folders

Assumes you are using the Unity interface.

Shared folders are found in the /media folder.

1) Click on the Home Folders icon on the Unity Launcher:

2) Click on File System then double-click on the media folder:

The shared folders will be found inside. Shared folders are prefixed with sf_. For example, if you shared a folder called my_code, then it will appear as sf_my_code in the media folder.

Whenever you share a new folder, you need to restart the machine for Ubuntu to pick it up.

Leave a Reply

Your email address will not be published.