Share Files Between Guest and Host OS in GNOME Boxes

Using GNOME Boxes tool for virtual machines but cannot figure out how to share files between the host OS and the OS in VM? This tutorial will help you with that.
Warp Terminal

GNOME Boxes is a VirtualBox and VM Ware like virtualization tool focusing on desktop Linux. It provides a simple GUI to create and manage virtual operating systems.

Virtual machines are a good way to test another operating system or distribution (in Linux context).

One of the pain points you’ll experience with VMs is the trouble in copying-pasting and file sharing between the guest and host systems.

Imagine you saved a file in the virtual machines but now you need it in your actual host system outside the VM. The ability to share the files between the two systems makes the VM experience quite smooth.

Let me show you how to do file sharing with GNOME Boxes. It consists of three steps:

  • Installing the required package on the guest OS (VM) to enable file sharing
  • Knowing how to transfer files from the host OS to the guest OS (drag and drop)
  • Knowing how to transfer files from the guest OS to the host OS (through a shared folder)
📋
Guest OS is the operating system inside the VM. Host OS is the main operating system where you are running the GNOME Boxes.

Install the required package on guest OS

Your guest OS (Linux distribution in the VM) needs a SPICE package in order to share files with the host OS (the main operating system).

On Debian, Ubuntu and Fedora based distributions, this package is named spice-webdavd. You can use your distribution’s package manager to install it inside the guest OS (running in the virtual machine).

For Ubuntu and Debian based systems, use this command:

sudo apt install spice-webdavd spice-client-gtk

For Fedora based distributions, use this command:

sudo dnf install spice-webdavd spice-client-gtk

Restart the guest OS.

📋
Remember that you need this package on all the guest operating systems. So every time you create a new VM, you have to take care of this package.

Transfer files from the host OS to the guest OS

This is the simpler of the two. You just have to drag the desired file to the guest OS running in the VM.

You’ll see that when you are dragging the file to the VM, it starts showing a ‘Ready to Recieve File’ option.

drag drop guest host gnome boxes
Drag and drop files to the guest OS from host OS

The transferred files are saved in the Downloads directory.

Alternatively, you can also send files from the GNOME Boxes menu. Just hit the hamburger menu and click on Send File option.

sending files in gnome boxes
Sending files in GNOME Boxes

Transfer files from the guest OS to the host OS

This one is not as straightforward as dragging and dropping.

Here, you use the SPICE protocol to mount a folder of the host OS. You drop the files here and it is transferred to that folder on the host.

The package you installed earlier was required for this kind of operation.

Click on the hamburger menu and select the Preferences option.

gnome boxes preferences
Select GNOME Boxes Preferences

Here, go to the Devices & Shares tab. Look under the Shared Folder section. You should see a + button. Click on it, and it will give the default location of the Public folder on your host operating system. You can change it to any folder of your liking.

share folder gnome boxes
Sharing host OS’s folder in GNOME Boxes

With that set, open the File Explorer in the guest OS. Here, click on the Other Locations option (in GNOME’s Nautilus file explorer).

mount spice folder gnome boxes
Mount Spice client folder

This will mount the Spice client folder.

mounting spice client folder gnome boxes
mounting spice client folder GNOME Boxes

Enter this mounted folder and you should see the folder you had added via the Preference menu here. In the screenshot below, I have two shared folder (because I added another one later on).

mounted spice client folders
mounted spice client folders

In the shared folders, you can create new folders or copy-paste the files. They will be immediately available in the host OS.

I shared two screenshots taken in the guest OS and put them in the mounted Spice client folder.

sharing files from guest to host os gnome boxes
Sharing files from the guest OS to the host OS

It immediately appeared in the public folder of the host OS.

shared files between host guest
Shared files appear in the host OS

Of course, it’s a two-way sharing. If you put something in the shared folder on the host OS, it will be accessible in the mounted folder in the guest OS.

Note that you have added the host OS’s folder on GNOME Boxes level. This means that if you have multiple VMs, all of them should be able to mount that folder.

To keep things organized, you may add multiple shared folders and name them in a way that you can recognize which VM uses them.

Did it work for you?

GNOME Boxes is a pretty good tool for trying various Linux distributions as virtual machines. You can also share the clipboard between the guest and host systems with the method described here. This means that if you copied some text in the host OS, you could paste it into the guest OS and vice versa.

This is pretty much what you need to know and do about sharing files between guest and host OS with GNOME Boxes.

Do let me know if you managed to make it work or if you still face issues. The comment section is all yours.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.