Before you continue reading this article make sure that you have VirtualBox Guest Additions installed within your guest operating system as this is a must prerequisite. VirtualBox Shared folders allows you to share data between your host operating system and virtual guest operating system.

In this article we are going use "Debian Linux as a host operation system" and "Ubuntu as a virtual guest system". This Article also assumes that you have your virtual guest operating system already installed.

Setup Shared folder

Before your start your guest operating system ( Ubuntu ) you need to change its settings. To be more exact we need to define share folder first.

Open the VM Settings and go to Shared Folders on your host operating system. Click on Add button and select a directory you wish to share with Ubuntu guest operating system.

Next you would need to define a name of this folder. The name will be used by a mount command later when mounting shared folder. In this example we use a following settings:

  • Name: share
  • Path: /home/lilo/temp

Define a VirtualBox Shared  Folder

Mount shared folder

Now that you have defined your shared folder start up your Ubuntu virtual guest system. Open a terminal and create a directory where you wish to mount your VirtualBox shared folder. If we want to for example mount VirtualBox shared folder into /media/share we need to first create this directory.

$ mkdir /home/myusername/share

Now that mount directory is ready we can mount VirtualBox shared folder.

$ sudo mount -t vboxsf share /home/myusername/share

NOTE: share is the name you have defined when creating a VirtualBox shared folder in previous step. Now simply navigate to your home directory and your /home/myusername/share folder and you should see your /home/lilo/temp data shared across.

Mount VirtualBox Shared Folder permanently

Once you restart your guest operating system to get access to your VirtualBox shared folder again you need to mount it again with the above command. To make this mount permanent add a following line into your /etc/fstab file:

share    /home/myusername/share    vboxsf    uid=1000,gid=1000  0     0

NOTE: uid=1000,gid=1000 will make an owner of all files within VirtualBox shared folder. Moreover you can use mount options for more settings such as read-only and so on.

Please refer all article related questions to:

You may also be interested in: