Allow virsh as a normal user on Debian Jessie

Debian Jessie has migrated libvirt to use polkit which means the normal advice of “add your user to libvirt and kvm groups” doesn’t work for virsh. There doesn’t seem to be any documentation about the change either. After a bit of head scratching and googling the following fixes the problem and allows members of the libvirt group to use virsh.

You need to create a local policykit access list, this example allows all members of the libvirt group to manage libvirt

[libvirt Management Access]

You also need to configure virsh to connect to libvirtd running on the local system by default, to do this add these lines to .bash_profile to add it to your bash shell environment.

if test -x $(which virsh); then
export LIBVIRT_DEFAULT_URI=qemu:///system