How to Configure Access for qcow2 in virt-manager
If you've created a qcow2 virtual disk, you might have noticed that it's not internally accessible even when you access it using sudo virt-manager
. To fix this, we need to make a few changes to the /etc/libvirt/qemu.conf
file.
1. Locate the Configuration File:
The configuration file is found at /etc/libvirt/qemu.conf
.
2. Modify the User and Group Settings: Find the lines that specify the user and group for QEMU processes. The default settings look like:
# user = "root"
# group = "root"
Uncomment (remove the #
at the start) these lines and set them as follows:
user = "root"
group = "root"
3. Save and Close the Configuration File.
4. Additional Security Note:
By default, VMs are run as non-root for security. Changing the VMs to run as root
can pose a security risk, especially if a malicious VM gains access to /dev/vhost-net
, /dev/vhost-vsock
, or /dev/vhost-scsi
.
If you decide to run VMs as root
, it's recommended to adjust access settings in /etc/apparmor.d/abstractions/libvirt-qemu
to enhance security. More details about this can be found in the mentioned links in the qemu.conf
file.