Share Folder Between Host and Guest System in VirtualBox

Here’s how you can share a folder between the host and the guest system and write data in VirtualBox.

If you are a heavy user of virtual machines, especially with VirtualBox, it’s essential to know how to share a folder for data transfer between guest and host systems. You may want to access some documents and pictures from the guest system, which is present in your host system.

It’s possible with a little trick. Here’s how.

How to Share Folder Between Host and Guest System in VirtualBox

The following steps require the VirtualBox guest additions installation. If you have not done it, install the guest additions in your guest system.

From the VirtualBox menu, select Device > Shared Folders > Shared Folders Settings.

Select the option in Device menu

Click on Add (green button at the extreme right), in the share folder settings window.

In Folder Path, select the folder you want to share from your host to the guest system. In this example, I have used the Pictures folder, i.e. /home/debugpoint/Pictures from the host system.

Give any meaningful name you want in the Folder Name field. VirtualBox will create a folder in your guest system with sf_ prefix in /media path. For this example, the shared folder in the guest system will be in /media/sf_Pictures.

Select Auto-mount and make it permanent. Press OK.

Create a shared folder – settings

Once you close the above window, you can see the folder is created in /media (see below). Also, note that its group is vboxsf which is different from your current user group. This is the VirtualBox group created by the guest additions.

shared folder created by VirtualBox
owner of the share folder

If you try to access this path, you can’t. Hence add your current user id to the vboxsf group. And change the ownership to yourself for all the subdirectories using the following two commands. Replace the bold items with your system configs.

sudo usermod -a -G vboxsf debugpoint
sudo chown -R debugpoint:users /media/sf_Pictures/

Once you are done, restart your virtual machine.

And you should see the folder in your guest’s virtual machine. You should have the modify access to it.

Accessing the folder from guest system
Settings folder name mapping between guest and host

For any error, if you see an empty folder, then try to force mount the folder. And try to browse using the following command. The “Pictures” parameter should match the “name “Folder Name” in the above image in VirtualBox shared folder settings.

sudo mount -t vboxsf Pictures /media/sf_Pictures

Closing Notes

This is how you can share a folder between host and guest in VirtualBox in a most simple way. Per my test, it worked for all the major Linux distributions, such as Ubuntu/Fedora, Fedora/Mint, and Fedora/Arch combinations. So, I believe it should work for you.

If you face any errors, let me know in the comment box below.

Exit mobile version