Share Folder Between Guest and Host in GNOME Boxes

3 min


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.

In the prior articles, we have explained how to share folders in virt-manager and VirtualBox. And the following steps explain the same for GNOME Boxes.

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.
Enable sharing in settings
Enable sharing in settings
Enable File Sharing
Enable File Sharing
  • 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.
Add a share folder in host
Add a share folder in host

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 F5.
Spice client folder in guest
Spice client folder in guest

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
error while accessing the spice client folder
error while accessing the spice client folder
  • Press CTRL+L in the file manager to bring up the address bar. In the address bar, type the following:
dav://localhost:9843
  • And hit enter. And you should see the folder contents. The dav protocol is used by the SPICE server, which connects the guest and host at port 9843.
accessing via dav protocol
accessing via dav protocol

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.

Share folder and its contents between guest and host in GNOME Boxes (sample)
Share folder and its contents between guest and host in GNOME Boxes (sample)

If you run into any error, drop a comment below.

Some references are used in this article from GitLab.


Arindam

Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

5 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments