I am trying to run kvm, but this error occurs:
$ virsh -c qemu:///system list
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
error: failed to connect to the hypervisor
So I enter to:
cd /var/run/libvirt/
and changed privilages by:
sudo chmod -R +777 libvirt
Everything is working now, but I have concerns about security issues, as privileges for all users and groups is not the safest way to do it? What could you recommend instead?
Add your user to the kvm and libvirtd groups:
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
After these group changes you have to logout/login the terminal you are using to have the changes taken into account. The groups you belongs to, can be check with the groups command.
I think
sudo usermod -aG libvirt $USER
is the correct command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With