I once had a very similar problem, providing read-write access to the shared folder. It was possible to read files but I was not allowed to write files to the shared source path folder.
Unix & Linux - KVM / QEMU / Virt-Manager : How can I store files in the mounted shared folder
The root cause is that the guest system is running as libvirt-qemu
user. What you should do to create files from within the running guest system in the mounted shared folder are these steps :
In Virt-Manager
-> Add Hardware
-> Filesystem
select Mapped
as Mode
setting for the VM.
Change permissions for the shared folders : sudo chmod -R 777 /<path-to-shared-folder>
Change the owner to your username : sudo chown -R user:user /<path-to-shared folder>
Change the permissions for virtual disk files : sudo chmod -R 777 /<path-to-virtual-disks>
Change the owner to your username : sudo chown -R user:user /<path-to-virtual-disks>
Add your username to the libvirtd
group : sudo usermod -G libvirtd -a <your-user-name>
Give full permissions to the libvirt-qemu
user : sudo setfacl -R -m u:libvirt-qemu:rwx /*
Note : * = Specify the folder directory hierarchy you want to give libvirt-qemu
the permissions.
Reboot the host operating systems ... now you should be able to create files in the guest system.
Information about 9p virtio -> Sharing Host files with the Guest | QEMU Documentation 9psetup
Mode
specifies the security mode for accessing the source. Mapped
specifies that the source is accessed with the permission settings of the hypervisor. Passthrough
specifies that the source is accessed with the user's permission settings that are set from inside the virtual guest machine. This is the default mode. Squash
is similar to Passthrough
, the difference is that the failure of privileged operations like chown
are ignored, this makes a Passthrough
mode usable for users who are running the hypervisor without elevated privileges.
Best Answer
After this is the second time this comes up I tried to reproduce it today. You already posted the answer how to install askpass (thanks), but for the other issue which was already marked a dup - here some details about it.
I installed two Ubuntu systems and set up a user ubuntu@... that can be logged in via ssh keys. One of them had libvirtd and one had virt-manager. It worked right away.
Since you mentioned askpass I removed the ability to login via keys and require a password. But in that case the error message for me seems quite clear. It directly calls for ssh-askpass in the error.
You can - as you did - install askpass, or as I outlined before set up ssh-keys - in both cases it then works fine.
Is that maybe a rather old version of virt-manager? I tried virt-manager in Xenial, Bionic, Cosmic and Disco which all worked quite similar for me.
If all of that doesn't help your case, please outline whatever is special on your user setup as it might be related.