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 vir­t-­ma­na­ger, 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.

The­re­fo­re, just by run­ning the fo­llo­wing co­m­mand we can skip the pa­sswor­d ­prompt eve­ry ti­me.

sudo usermod -a -G kvm,libvirt mariano

This is an op­tion I would use on­ly for lo­cal de­ve­lo­p­ment on my ma­chi­ne. ­Pro­duc­ti­ve en­vi­ron­men­ts must ha­ve an strict per­mis­sions ma­na­ge­men­t.