Use the below steps to share a folder between host and guest in GNOME Boxes app.
GNOME Boxes is a front-end application to create and manage virtual machines. It is primarily compatible with the GNOME desktop. However, you can use it in other desktop environments, such as KDE Plasma and others.
At the backend, it uses QEMU, KVM, and libvirt tech and provides an easy-to-use user interface to manage multiple virtual machines.
If you want to learn more, you can also refer to these guides on GNOME Boxes to create virtual machines.
How to share folder and file in GNOME Boxes
GNOME Boxes primarily support SPICE protocol to enable remote access, sharing and many virtualization features. SPICE is one of the oldest open-source packages in the virtualization space.
1. Initial setup
- Firstly, make sure to install the following spice packages in the guest system.
sudo apt install spice-vdagent spice-webdavd #for Ubuntu-based distros sudo dnf install spice-vdagent spice-webdavd #Fedora, RHEL, etc pacman -S --needed spice spice-gtk spice-protocol spice-vdagent #Arch Linux (optional)
- After you install the above, reboot the host and guest systems.
- In the host system (for GNOME desktop), open settings and go to Sharing panel.
- Enable Sharing using the top toggle button.
- Then, click on File Sharing and Enable File Sharing. Make sure to enable the network. The password is optional. If you want to enable password-based authentication for your shared folder, enable it.
- Close the settings window.
- Open GNOME Boxes. Right-click on the VM and select preferences.
- Click on Devices and Shares on the preference window and click on the [+] button under Shared folders.
- Under Local Folder: Select the folder from your host you want to access inside the guest.
- Name: Give any name you want. This name will be visible in the guest’s file manager.
- Click Save.
2. Setup for guest
- Start your guest virtual machine.
- Inside the guest virtual machine, open the file manager. If you are using a GNOME desktop, open Nautilus (i.e. Files).
- Click on Other Locations. you should see the “Spice client folder” under Networks.
- Double-click on this, and you should see the folder contents of your host system.
- Sometimes, the above folder takes some time to appear. if it is not visible, wait for 1 or 2 minutes. Refresh the file manager window via
3. Some troubleshooting
- Furthermore, if you are getting the following error, then you need to access the path manually.
Unable to access location - HTTP Error: Could not connect: Connection refused
CTRL+Lin the file manager to bring up the address bar. In the address bar, type the following:
- And hit enter. And you should see the folder contents. The
davprotocol is used by the SPICE server, which connects the guest and host at port 9843.
And that’s it. Now you can enjoy file sharing between guests and hosts in GNOME Boxes.
Here’s a screenshot of the same folder accessed by the guest and host.
If you run into any error, drop a comment below.