How to share folders between your Ubuntu Virtualbox and your host machine

Sometimes you need to share data files between your host computer and your Ubuntu virtualbox. In this tutorial, you will learn how to achieve this so that you will be able to access folders orfiles on your host computer from your Ubuntu virtualbox.

Installing guest additions

Before starting the sharting process, it is mandatory to install your so called virtualbox guest additions. This will allow you to use some cool features such copy and paste, folder sharing and mouse integration.

We have written a small article on how to do this in case your virtualbox runs on Ubuntu. If however your virtualbox runs on Windows, you may want to check this article.

Read: How to Change the Resolution of Ubuntu 22.04 VM in VirtualBox

Enabling shared folders

Now that you have installed the guest additions, select your Ubuntu virtual machine as shown below :

Read: How to share clipboard between Ubuntu VirtualBox and host

And then click on Settings on the menu bar. The popup below will show up. Select the Shared Folders item.

On the right hand side, click on the icon with the Add sign. The dialog box below will be displayed.

Once you click on the Folder Path drop-down list, select the ‘Other’ item.

Read: How to change the size of your virtual box window

You will be able to select a folder to be shared with your virtualbox. See snapshot below.

Once the folder is chosen, its full path will be inserted. Tick the checkbox Auto-mount. Click on OK to finish.

The selected folder will be displayed in the Transient Folders List as shown below. Click OK to close the window.

Now run your Ubuntu virtualbox and open up a terminal session.

Run the command below as root :

sudo apt install virtualbox-guest-utils

Once completed, exit the terminal.

Now open your file explorer :

Virtualbox shared folders

You will see your shared folder but with the string “sf_” added at the beginning.

Read: How to copy paste between Windows 10 and Android

If you click on the shared folder you will most likely see the error message below :

Virtualbox shared folder Ubuntu

Read: How to manage permissions in Linux – guide for beginners

In order to access the shared folders, you would need to add your user to a group called vboxsf (there are users and groups). Open up your terminal and run the command below :

sudo adduser [username] vboxsf

Now enter the command :

sudo reboot

And access again your shared folder. You will be able to create/delete/change files .

Virtualbox shared folders Linux


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

This Post Has 3 Comments

  1. Justin

    Thanks for this write-up. I’ve been to a bunch of sites trying to figure this out and yours is the only one that worked

  2. js

    Finally a set of instructions that works. I tried so many others that just didn’t cut it! Thanks!

  3. Kunal

    THanks! After following the ORACLE docs and a bunch of other sites, I was so close but your post made did the job till the end and it finally worked.

Leave a Reply