I have this QEMU virtual machine running Debian Stretch, inside a host also running Debian Stretch. The guest mounts a host directory via VirtIO and 9p:
Virtual Machine Manager, Filesystem settings:
- Mode: Mapped
- Source path: /host/username/Projects
- Target path: host-projects
Mounting on the host works:
sudo mount -t 9p -o rw,trans=virtio host-projects /guest/username/Projects
Writing to this directory, however, has proved difficult. I had to
chgrp -R libvirt-qemu /host/username/Projects
on the host in order to be able to write to the directory in the guest, but all the files I write inside the guest then belong to not just group but also user
libvirt-qemu on the host.
I want those files to be mine.
How can I configure the host ownership? (Short of running
qemu-system-x86_64 under my user id; or having cron
chown -R username.libvirt-qemu /host/username/Projects every 2 minutes.)