[手动选题][tech]: 20230115.0 ️ Share Folder Between Guest and Host in GNOME Boxes.md

This commit is contained in:
六开箱 2023-01-28 23:20:56 +08:00
parent e3e5aacd0a
commit e50328a681

View File

@ -0,0 +1,119 @@
[#]: subject: "Share Folder Between Guest and Host in GNOME Boxes"
[#]: via: "https://www.debugpoint.com/share-folder-gnome-boxes/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Share Folder Between Guest and Host in GNOME Boxes
======
**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][1] on GNOME Boxes to create virtual machines.
In the prior articles, we have explained how to share folders in [virt-manager][2] and [VirtualBox][3]. 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][4] 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 inthe **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][5]
![Enable File Sharing][6]
- 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 guests file manager.
- Click Save.
![Add a share folder in host][7]
#### 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][8]
#### 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][9]
- 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][10]
And thats it. Now you can enjoy file sharing between guests and hosts in GNOME Boxes.
Heres 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)][11]
If you run into any error, drop a comment below.
[_Some references are used in this article from GitLab._][12]
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/share-folder-gnome-boxes/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://www.debugpoint.com/tag/boxes
[2]: https://www.debugpoint.com/share-folder-virt-manager/
[3]: https://www.debugpoint.com/share-folder-between-host-guest-virtualbox/
[4]: https://www.spice-space.org/index.html
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-sharing-in-settings.jpg
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-File-Sharing.jpg
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Add-a-share-folder-in-host.jpg
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Spice-client-folder-in-guest.jpg
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/error-while-accessing-the-spice-client-folder.jpg
[10]: https://www.debugpoint.com/wp-content/uploads/2023/01/accessing-via-dav-protocol.jpg
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Share-folder-and-its-contents-between-guest-and-host-in-GNOME-Boxes-sample.jpg
[12]: https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/430