Setting user permissions in KVM

In a previous article I mentioned how to install a library in Fedora, in order to make KVM virtualization easier, managing the NAT network configuration between the guest virtual machine and the host, by means of libvirt.

Besides that, while using KVM locally for development, I use virt-­man­ag­er, a helpful application that manages the different virtual machines. This application, as well as the rest of the commands that interact with libvirt (virsh for example), require super user privileges, so it will prompt for the sudo password every time.

This can be avoided by including the user into the following groups: kvm, and libvirt.

There­fore, just by run­ning the fol­low­ing com­mand we can skip the pass­word prompt ev­ery time.

sudo usermod -a -G kvm,libvirt mariano

This is an op­tion I would use on­ly for lo­cal de­vel­op­ment on my ma­chine. Pro­duc­tive en­vi­ron­ments must have an strict per­mis­sions man­age­men­t.