linux questions - How do i make "Share folder" option run automatically by using terminal in spice

Hi There

How do i make “Share folder” option enable automatically by using terminal in spice, Current command im using is:

virsh start win10 && virt-viewer --connect=qemu:///system --domain-name win10 --spice-shared-dir=/home/$USER/Downloads

host Debian 11 & guest Windows 10

photo_2021-07-19_12-01-21

Please check out this article for more info. virtualization - How to share folder with Windows 10 guest using virt-manager (KVM)? - Ask Ubuntu

There was no interest from me to figure out Windows file sharing but there could be helpful clues in this link above.

I saw it , but I don,t find how can I enable share folder like in picture with command line

Try doing it with SAMBA shares instead:

I’m having the same problem.

When I start virt-viewer from a command line with: “virt-viewer --spice-shared-dir=…”,
The viewer starts with the shared folder NOT-ACTIVE.
I would like the viewer to start with the shared folder being ACTIVE.

What occurs at virt-viewer startup:

File->Preferences
[NOT-CHECKED] Share folder FolderName

What I want to occur at virt-viewer startup:

File->Preferences
[CHECKED] Share folder FolderName

How do I start virt-viewer from the command line so that the shared folder is ACTIVE?

P.S.
I have file sharing working. It just annoying that every time I launch virt-viewer, I have to MANUALLY activate file sharing (can NOT do it in a bash script).

Try removing the setting that explicitly forbids spice drag and drop folders then save and retry again

I’m sorry. I don’t know where this setting is located.
What I’ve tried:

  1. chmod -R 0777 ~/SharedFolder #Remove all write restrictions
  2. Examined the virtual machine “Overview” XML shown in “virt-manager”, and found nothing forbidding drag and drop.
  3. Examined all of the GUI options in “virt-manager” and “virt-viewer”, and found nothing forbidding drag and drop.
  4. Removed “Channel spice-webdav” from “virt-manager” (broke file sharing). Grayed out the virt-viewer file share option.
  5. Web searched for: “forbid” “drag and drop” “spice”. Failed to learn how to do as you instructed.

I’d appreciate a pointer on how to remove the setting as you instructed.

edit the settings then remove:

  <filetransfer enable='no'/>

Thank you for the info.

Unfortunately, the string “filetransfer” does not exit in the XML list.
I examined the XML list three ways:

  1. sudo vim /etc/libvirt/qemu/DomainName.xml
  2. sudo virsh edit DomainName
  3. virt-manager->Overview-tab/OS information-tab/Performance-tab

Am I doing something wrong?

I’m pretty sure it does.

I think you need better assistance. Please post on the libvirt-users mailing list and they will help you:

https://listman.redhat.com/mailman/listinfo/libvirt-users

If you have a solution, please share this

Is there a reason you chose spice over virtmanager? I don;t know much about the former and never tried it. Is this SpiceGTK or the remote viewer for virtual machines?

Hi
I would also be very interested if somebody knows how to do this.
Share folder is working, default shared folder is selected, but I have to activate file sharing manually from virt viewer every time a start the virtual machine.
Thank you