Configuring polkit in Fedora 18 to access virt-manager

virt-manager authentication

In Fedora when you run virt-manager you’ll be asked for your password. Since I use this tool a lot I would like to have a password-less virt-manager.

Thank Jebus we have polkit where we can define authentication rules. There was a handy rule available written by Rich, but it stopped to work with the release of Fedora 18 because polkit changed completely the language used in rules files. Since polkit-0.106 the new rules files are written in JavaScript. Yes, JavaScript. More info about the choice you can find on David’s blog post.

To access virt-manager without entering password, just a create a file named /etc/polkit-1/rules.d/80-libvirt-manage.rules (or similar) with following content:

polkit.addRule(function(action, subject) {
  if (action.id == "org.libvirt.unix.manage" && subject.local && subject.active && subject.isInGroup("wheel")) {
      return polkit.Result.YES;
  }
});

Remember to add your user to the wheel group:

usermod -a -G wheel goldmann

That’s all, enjoy!

comments powered by Disqus