Sharing Folders between Host OS and Guest OS in VirtualBox

When working on a guest OS, you often need to share files to and from the host OS. A guest OS is an isolated OS that has access to neither the host nor the other machines in VirtualBox. However, the VirtualBox guest addition utility enables the guest machine to share files to and from the host OS.

In this article, we will show you how to install VirtualBox Guest Additions and share folders between the host OS and the guest OS.


  1. Host OS with VirtualBox installed
  2. Guest OS installed in the virtual machine

For this demonstration, we are using Windows10 as the host OS and Ubuntu 20.04 LTS as the guest OS. To enable sharing between guest and host OS, we will install VirtualBox Guest Additions on the guest OS and then share and mount a folder from the host OS to the guest OS. Let’s get started.

Install VirtualBox Guest Additions on the guest system

To enable file sharing between host and guest, you must install Guest Additions in the guest OS. To do so, the following steps must be taken:

1. Open VirtualBox in your host system and start a guest operating system.

2. On the top menu bar of VirtualBox, click Devices, then select Insert Guest Additions CD image to insert a virtual CD inside the guest system.

3. The following message will appear. Click Run to install Guest Additions on the guest machine.

4. Installation will begin, and once completed, you will be asked to press Enter to close the window. Press Enter to finish the installation.

Once VirtualBox Guest Additions has been installed on the Guest OS, you can share folders between the host system and the guest system.

Share folders between host and guest

Now, we will share a folder between the host and guest systems. You can share multiple folders between the guest OS and the host OS. For folder sharing, either create a new folder or use an existing folder. Follow the steps below to share a file or folder between the host and guest systems.

1. From the top menu bar of VirtualBox, go to Shared Folders > Shared Folders Settings.

2. You will see the following settings window in your guest system. Click the + button to open the Add Share dialog box.

3. In the Add Share dialog box, select the shared folder using the Folder Path drop-down, and choose a folder from your host OS. Then, type a name for your shared folder, and check the Auto-mount box. The Auto-mount option will automatically mount the shared folder on the next boot.

Now, click OK to close the Add Share dialog. You will now see the shared folder in the Settings window. Click OK to close the window.

4. By default, only root and members of vboxsf are allowed to access the shared folder. To assign permissions to your user account, issue the following command in the terminal, replacing with the actual username:

$ sudo usermod -aG vboxsf

5. If you open File Manager or Explorer in your guest OS, then you will see the shared folder sf_shared_folder mounted there, where sf_shared_folder is the name of your shared folder.

The shared folder can also be accessed from the command line. Open the command line using Ctrl+Alt+T, and then navigate to /media directory using the following command in the terminal:

$ cd /media

Here, if you run the cd command, you will see your shared folder listed under the /media directory.

Now, navigate to the shared folder using the cd command as follows:

$ cd sf_shared_folder/

Make sure to replace sf_shared_folder with the name of your shared folder.

In the shared folder, you can place any file you want to share with your host OS. Similarly, you can access any file shared by your host OS.


This article showed you how to set up folder sharing between a host system and a guest system in VirtualBox. You need to follow the above procedure for your guest machines only once. After that, the shared folder of the host will be automatically mounted in the guest OS on every boot for file sharing.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.