Setting user permissions in KVM

In a pre­vi­ous ar­ti­cle I men­tioned how to in­stall a li­brary in Fe­do­ra, in or­der to make KVM vir­tu­al­iza­tion easier, man­ag­ing the NAT net­work con­fig­u­ra­tion be­tween the guest vir­tu­al ­ma­chine and the host, by means of lib­virt.

Be­sides that, while us­ing KVM lo­cal­ly for de­vel­op­men­t, I use virt-­­man­ag­er, a help­ful ap­pli­ca­tion that man­ages the dif­fer­ent vir­tu­al ­ma­chines. This ap­pli­ca­tion, as well as the rest of the com­mands that in­ter­ac­t with lib­virt (virsh for ex­am­ple), re­quire su­per us­er priv­i­leges, so it will prompt for the su­do pass­word ev­ery time.

This can be avoid­ed by in­clud­ing the us­er in­to the fol­low­ing group­s: kvm, and lib­virt.

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.