Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Add policykit rules for virt-manager

If a user wants to use virt-man to control virtual machines on localhost, he will be prompted to authenticate to policykit. If you have a policykit rule established (as the libvirt package already provides) for the right group, it's seamless. Just make sure the user is in group "libvirt" (from /usr/share/polkit-1/rules.d/50-libvirt.rules) Or, to make a different group the (additional) accepted value:

tf=/etc/polkit-1/rules.d/80-libvirt.rules
touch "${tf}" ; chmod 0644 "${tf}"
cat <<EOF >"${tf}"
polkit.addRule(function(action, subject) {
  if (action.id == "org.libvirt.unix.manage" && subject.local && subject.active && subject.isInGroup("wheel")) {
      return polkit.Result.YES;
  }
});
EOF

References

Web links

    1. How do I prevent virt-manager from asking for the root password? - Super User

Comments