Hello all. I’ve been using KVM for a long time now. Every time i try to use virt-manager as a non-root user, i have to enter sudo password. This ain’t a problem but if you use virt-manager most of the times, it can be boring and irritating. I had written a nice tutorial for Arch users on: Complete Installation of KVM,QEMU and Virt Manager on Arch Linux and Manjaro
I’ll show you simple way to use virt-manager as a non-root user, by just creating libvirt group and adding standard user account to it. Without wasting much time, let’s dive in.
To use virt-manager as a non-root user, follow steps below:
1.Create unix group to use
If you’re new to user and group management, have a look at user management section in Top things to do after Fresh Installation of Fedora 23
First check if group already exist, if not create it
# getent group | grep libvirt
# groupadd -g 7777 libvirt
2. Add user account to the libvirt group
# usermod -aG libvirt "username"
Verify that user is added to libvirt group.
# id username | grep libvirt
3. Edit libvirtd configuration file to add group
cat <<EOF >>/etc/libvirt/libvirtd.conf unix_sock_group = "libvirt" unix_sock_rw_perms = "0770" EOF
# tail -n 2 /etc/libvirt/libvirtd.conf
4. Restart libvirtd daemon
systemctl restart libvirtd systemctl status libvirtd
6. Log out and login again to the system.
7. Launch virt-manager
Now try to launch virt-manager with your standard user account. You should be able to use virt-manager as a non-root user. If not, try to read your libvirtd.conf to see the relevant sections to modify.
We’ve covered how to use virt-manager as a non-root user in easy to follow steps. You may have to install KVM virtualization package group to get tools including virt-manager. Now virt-manager should run smoothly for you to create VMs and use virt-manager for vm management.