Using Virtualbox Shared Folder on Ubuntu 20.04

This post explains how you can configure Virtualbox Shared Folders for Ubuntu 20.04.

Installing Virtualbox Guest Additions

Before you can configure Virtualbox Shared folders you will need to install Virtualbox Guest Additions.

I have detailed the process of installing this on another blogpost which you should first follow.

Once done you can continue with the second step.

Configuring Shared Folders in Virtualbox

Once Virtualbox Guest Additions is installed you are able to configure the shared folder. To do this go into the Virtual Machine Settings and select “Shared Folders”.

You will want to add a new machine folder by pressing the + button.

Once done you should have a dialog similar to this which will ask you for the folder path, folder name, and whether you want to automount it or make it read only.

To configure this with Ubuntu 20.04 I found the best solution was to not auto-mount it but configure it in the virtual machine.

Here the folder path is set to the location on my non-virtual hard drive that I want to mount. The folder name will be the name that the virtual machine will refer to.

Once this has been saved in the settings interface you can then boot the Virtual Machine and configure it.

Configuring Ubuntu to mount the Shared Folder

Once the shared folder is set up you will then want to request that it is automatically mounted on boot. You can do this by adding it to the /etc/fstab file.

Open /etc/fstab in your favourite editor and put the following line at the bottom.

<foldername> <path to mount> vboxsf defaults,uid=1000,gid=1000 0 0

For my example above I enter:

ssh /home/chewett/.ssh/ vboxsf defaults,uid=1000,gid=1000 0 0

This then configures my cygwin .ssh folder to be mounted at /home/chewett/.ssh/ in my Virtual Machine.

Once done fstab will mount this folder at each boot.

If this worked for you or you have any questions please comment below!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.