7

I have a virtual machine setup through virt-manager, and I am trying to give the vm access to a folder on the host system.

I added a Filesystem, and I can read from the host directly but I cannot write to it.

<filesystem type='mount' accessmode='passthrough'>
 <source dir='/opt/test'/>
 <target dir='testlabel'/>
</filesystem>

It is mounted on boot from fstab using,

testlabel /opt/test            9p             trans=virtio    0       0

The folder on the host system is owned by my user on the host system, and I cannot change ownership to the user in the guest system because that user doesn't exist on the host.

tl;dr Aside from setting the folder permission to 777, how can I setup the folder permissions to allow read/write access for the guest vm user?

Aractor
  • 79
  • 4
  • 1
    This isn't really an answer to your question, but after scouring the internet for clues, I decided I'm going to go with a sshfs to the vm host. It's not nice, but it seems better than running a chown/chmod on cron. – wolfd Sep 22 '17 at 08:16
  • See these serverfault questions, it doesn't look like there is a direct solution to this problem: https://serverfault.com/questions/394645/qemu-virt-manager-no-permisson-on-shared-folder / https://serverfault.com/questions/342801/read-write-access-for-passthrough-9p-filesystems-with-libvirt-qemu / https://serverfault.com/questions/559726/kvm-guest-cannot-write-to-9p-share-owned-by-non-root – icc97 Apr 20 '21 at 09:10

0 Answers0