How to Share Host Folders with VirtualBox Ubuntu Guests

This brief tutorial shows students and new users how to share folders from VirtualBox host computers to Ubuntu 20.04 | 18.04 guest machines.

When using VirtualBox you can share folders from the host computer with guest machines. Guest machines can be Windows, Linux, or macOS.

This is made possible by the VirtualBox host folder-sharing feature. Folder sharing exposes the host computer files and folders to virtual machines.

For this to work, you must be running the latest version of VirtualBox virtualization software with the current version of guest addition tools. You’ll have to enable bidirectional sharing from the host software, and the steps below show you how to do that.

To get started with sharing folders from VirtualBox host to guest machines, follow the steps below:

Install VirtualBox Guest Additions

VirtualBox comes with a guest machines tool called guest additions. You must install the guest additions tool whenever you create a new guest machine.

The tool provides tight integration between the host and virtual machine operating systems, improvement to the VM graphics performance, shared folder between the host and guest machines, copying and pasting of text, images, and files between the host and guest machine as mouse improvement.

To install the tool in Ubuntu, follow the steps below. First, run the commands below update the Ubuntu guest machine.

sudo apt update && sudo apt dist-upgrade && sudo apt autoremove

When you’re done, run the commands below to install the latest kernel header and dkms package to support VirtualBox.

sudo apt install virtualbox-guest-dkms build-essential linux-headers-virtual

After installing the packages above, restart your machine and continue below.

To install VirtualBox Guest Additions software on Ubuntu virtual machine operating systems, select the Devices from the VirtualBox host application menu and click Insert Guest Additions CD image…

Ubuntu 19.04 VirtualBox

This should mount a virtual CD/DVD drive inside the Ubuntu guest machine. When that happens, you should get a prompt to run the software. Click Run to begin the installation.

You will have to type your password to install the software. If your account is not an administrative account, the installation will fail.

The Guest Additions suite of utilities is the official tool for VirtualBox virtual guest machines.

Restart the guest machine and you’re set.

To enable copying and pasting between the guest machine and the host, go to the guest machines settings page (General –> Advanced) and enable it as shown below

VirtualBox machine

Share the Host Folders

Now that the guest tool is installed in step 1, run the commands below to enable your account to access the host folder in Ubuntu.

The command to do that is below:

sudo usermod -G vboxsf -a $USER

After running the command above from Ubuntu guest to Ubuntu guest machine settings from the host software, share the folder from the host machine.

Select the guest machine you want to share with, go to the Settings tab, and pick the Shared Folders from the list. Click the Plus ( + ) top to add a folder you want to share.

Browse to the folder on the host machine and select it. If you want the folder to automatically mount every time the guest machine starts, choose that option.

Click OK to save your changes and close.

Turn on the guest machine or reboot if you’re already logged in. The next time you log in, the shared folder on the host should be mounted.

If you don’t see it mounted, go to the /media/sf_FOLDERNAME

That’s it!


This post showed you how to share VirtualBox host folders with guest machines, including Ubuntu. If you find any error above, please use the comment form below to report.