Setting user permissions in KVM

In a pre­vious arti­cle I men­tio­ne­d how to ins­ta­ll a li­bra­ry in Fe­do­ra, in or­der to make KVM vir­tua­li­za­tion ea­sie­r, ma­na­ging the NAT ne­two­rk con­fi­gu­ra­tion be­tween the guest vir­tua­l ­ma­chi­ne and the hos­t, by means of lib­virt.

Be­si­des tha­t, whi­le using KVM lo­ca­lly for de­ve­lo­p­men­t, I use vi­r­­t-­­ma­­na­­ger, a hel­pful appli­ca­tion that ma­na­ges the di­ffe­rent vir­tua­l ­ma­chi­nes. This appli­ca­tio­n, as we­ll as the rest of the co­m­man­ds that in­te­rac­t wi­th lib­virt (virsh for exam­ple), re­qui­re su­per user pri­vi­le­ges, so it wi­ll prompt for the su­do pa­ssword eve­ry ti­me.

This can be avoi­ded by in­clu­ding the user in­to the fo­llo­wing group­s: kvm, and lib­virt.

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.