File permissions for QEMU/kvm

Im able to access my localhost from QEMU/kvm and i was able to access my files. Than i created symlink and now i cant it from localhost access (access denied)

I messed up with chown the directory now can see any files. How can i set perms/chown for it ? Now all the folder and files are green lol. But again cant access it.

Any help ?

Your description is rather unspecific.
The virtual machine is normally totally isolated from the host.
There are ways to access the host file system:

QEMU - ArchWiki
Each is configured differently.

Yes i know but the problem is i can access the localhost. There is no problem with that. Also i was able to access the files, its ok too. The problem is i forget to ‘chown’ the new symlink so i cant access that one. Than messed up with ‘chown’ commands, now can access any of em.

Hello ? At least can somebody tell me the default chown settings for me ?

Edit:

sudo chmod -R 750
or
sudo chmod -R 755

And the file perms has to be “user : qemu” < qemu is the name in the groups for qemu. I guess its good now, gonna try.

What chown settings? You still haven’t said anything about how you are accessing VM and these files.

Well, im using QEMU/kvm from Gui. The files in my ~/projects directory. And im access from http://localip < localhost. I was downloading from there to virtual windows. I created symlinks from ~/projects/myproject1 & ~/projects/myproject2 to /srv/http/projects/myproject1 & 2

Edit: I truly dont get it. I tried to chmod 750 and and project directory not accessible. So i realize there no r read. I go for 755, now i cant see the folder but inside files still not appear. And it hits, i didnt changed to real files only edited the perm to symlinks but even after gave 755 to main files, didnt solved.

~/ ls -lh
drwxr-xr-x 9 guns libvirt 4.0K Dec  3 10:19 xproject
cd xproject & ls -lh
drwxr-xr-x 2 guns libvirt 4.0K Dec  3 08:29 filesforR
-rwxr-xr-x 1 guns libvirt 1.5K Dec  1 00:58 set.cpp
/srv/http ls -lh
drwxr-xr-x 3 guns libvirt 4.0K Dec  5 10:28 xproject
cd xproject & ls -lh
drwxr-xr-x 2 guns libvirt 4.0K Dec  3 12:38 filesforR
lrwxrwxrwx 1 guns libvirt   31 Dec  5 10:28 set.cpp -> /home/guns/xproject/set.cpp

LAME SOLUTION: copy the file to /srv/http from ~/
Yeap it did the trick. And you can copy from main directory again for saving changes or you can use it directly.

Second, you can use 9p file sharing.

That was one of the ways mentioned in the Arch wiki I linked you to.
Basically all the methods work through some kind of network connection, either Samba or ssh or VirtFS
and you didn’t tell which way you chose and what you did. :man_shrugging:

1 Like

Yeah the localhost way not a way :smiley: i got it now. I dont get it but there was some permission issues. I copied the files to localhost instead of creating symlink now its working. Same perms and even now its not user:libvirt its just user:user but its working.

I, for one, still don’t get what you where/are doing.
It’s o.k. If it works for you, whichever way you did it.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.