How to Share Folders in VirtualBox with Ubuntu
Sharing folders between your Windows computer and an Ubuntu virtual machine in VirtualBox lets you easily move files back and forth.
This feature acts like a digital bridge, allowing direct access to files on your main PC from within the Ubuntu environment, and vice versa.
For example, you can grab project files from your Windows desktop and work on them directly inside your Ubuntu virtual machine.
Using VirtualBox version 7.0 or later is recommended for the best experience with Ubuntu 22.04 LTS.
Configure shared folders in VirtualBox settings and install VirtualBox Guest Additions in Ubuntu. After installation, add the host folder via VirtualBox’s “Settings” > “Shared Folders” and reboot the guest.
Install VirtualBox Guest Additions
Installing VirtualBox Guest Additions is the first step to share folders between your main computer and Ubuntu in VirtualBox. This software helps your computer and the Ubuntu virtual machine work together more effectively, a necessary step before setting up shared folders for easy file access.
The tool offers seamless integration between the host and virtual machine operating systems. It enhances the graphics performance of the virtual machine and allows for shared folders between the host and guest machines. Additionally, it enables users to copy and paste text, images, and files between the host and guest machines, improving overall usability.
Follow the steps below to install the tool on Ubuntu. First, run the commands below to update the Ubuntu system.
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
After completing your tasks, execute the commands below to install the latest kernel headers and the dkms package required for VirtualBox support.
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…

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.

The Guest Additions utility suite is the official tool for VirtualBox guest machines.
Restart the guest machine, and you’ll be all set.
To enable copying and pasting between the guest machine and the host, access the guest machine’s settings page by navigating to General -> Advanced, and enable the feature as shown below.

Share the Host Folders
To share host folders into Ubuntu within VirtualBox, start by adding your Ubuntu user to the correct group. Next, set up the actual folder sharing in VirtualBox’s settings for your virtual machine. The command to add your user to the group is: sudo usermod -G vboxsf -a $USER.
The command to do that is below:
sudo usermod -G vboxsf -a $USER
After executing the command from one Ubuntu guest to another, share the folder from the host machine using the host software’s settings.
Select the virtual machine you wish to share with, navigate to the Settings tab, and select Shared Folders from the list. Click the Plus (+) button at the top to add the folder you want to share.


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!
Conclusion:
This post demonstrated the process of sharing folders from VirtualBox host computers with Ubuntu guest machines. Here are the key points to remember:
- Ensure you are using the latest version of VirtualBox and install Guest Additions for optimal functionality.
- Install required packages and update your Ubuntu system to prepare for folder sharing.
- Use the VirtualBox menu to insert the Guest Additions CD image and follow the on-screen prompts to install it.
- Enable copying and pasting between guest and host by adjusting the guest machine’s settings.
- Add the shared folders in VirtualBox settings and configure them for auto-mounting if desired.
- Access shared folders on the guest machine, typically located in /media/sf_FOLDERNAME.
If you encounter any issues during the folder sharing setup for VirtualBox with Ubuntu, please leave a comment for assistance. This allows us to help you resolve the problem, such as when shared folder access fails after completing step 3.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
As a newbie, I am baffled from Step 2 onwards.
My guest machine is Windows XP, so I can’t run Linux commands on it.
The title of this tutorial is “Share Host Folders with VirtualBox Ubuntu Guests”. Emphasis is on the last three words. 😉
Well done, It worked for me.