Adding a Shared Folder in VirtualBox VM

This method is tested on Debian 11, but should work on all Debian-based systems.

You should have already created a folder on your host system and set it as a shared folder inside the VirtualBox GUI. Now, how do we access the directory from the guest system?

Step-by-Step Guide

Follow these steps to set up a shared folder on your VirtualBox guest system:

  1. Install Required Packages:

    On the guest system, run the following command:

    $ sudo apt install lsb-release -y
  2. Add the Backports Repository:

    Run the command to add the backports repository:

    # echo "deb http://deb.debian.org/debian $(lsb_release -cs)-backports main contrib" | tee /etc/apt/sources.list.d/backports.list
  3. Install the Fasttrack Archive Keyring:

    Install the required keyring to authenticate backports:

    $ sudo apt install fasttrack-archive-keyring -y
  4. Update the Package List:

    Update your system's package list:

    $ sudo apt update
  5. Install VirtualBox Guest Additions:

    For a Desktop Environment that uses X11, install the following package:

    $ sudo apt install virtualbox-guest-x11 -y

    If you don't need X11 (e.g., for a headless installation), you can install only the CLI utilities:

    $ sudo apt install virtualbox-guest-utils -y

Conclusion

Once the required packages are installed, you should be able to access the shared folder from your guest system. This method is simpler than mounting a virtual CD-ROM and should work smoothly on most Debian-based systems.