How to Share Folders in VirtualBox with Ubuntu

The tutorial guides on sharing folders from VirtualBox host computers to Ubuntu guest machines. This process requires the newest version of VirtualBox and its guest addition tools. Firstly, install VirtualBox Guest Additions, which aids interaction between computers, improves graphics, and enables file sharing. Secondly, share host folders by choosing the guest machine from Settings and…

This article explains how to share folders from VirtualBox host computers to Ubuntu guest machines.

You can share folders from the host computer with guest machines using VirtualBox. The guest machines can be Windows, Linux, or macOS.

This feature allows the host’s files and folders to be accessed by virtual machines through VirtualBox’s folder-sharing capability.

To ensure successful operation, you need to run the latest version of VirtualBox virtualization software alongside the most current version of the Guest Additions tools. Additionally, make sure to enable bidirectional sharing in the host software. The following steps will guide you through this process.

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

Install VirtualBox Guest Additions

VirtualBox includes a tool called Guest Additions for guests. You must install the Guest Additions tool when creating a new guest machine.

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.

To install the tool on Ubuntu, follow the steps below. 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.

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, access the guest machine’s settings page by navigating to General -> Advanced, and enable the feature as shown below.

Share the Host Folders

After installing the guest tool, 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 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.

Navigate to the folder on the host machine and select it. Choose this option if you want the folder to mount automatically every time the guest machine starts.

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 this process, please feel free to leave a comment for assistance.

Richard Avatar

Comments

  1. Alan Stubbs Avatar
    Alan Stubbs

    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.

    1. Newbie too Avatar
      Newbie too

      The title of this tutorial is “Share Host Folders with VirtualBox Ubuntu Guests”. Emphasis is on the last three words. 😉

  2. Surya Pusapati Avatar
    Surya Pusapati

    Well done, It worked for me.

Leave a Reply to Alan Stubbs Cancel reply

Your email address will not be published. Required fields are marked *