If you have a Linux machine with KVM on it, you can manage those VMs remotely from a Mac using virt-manager.
SSH to the Linux machine and add your SSH user to the libvirt
group
sudo usermod -a -G libvirt $(whoami)
Running id $(whoami)
should list the libvirt
group. You may also need to edit /etc/libvirt/libvirtd.conf
to ensure that the socket has the right owner and permissions. Make sure you have these lines in there:
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
you should now be able to manage your VMs from the Linux machine without root access. If you open virt-manager locally on the Linux machine (assuming it's not headless) you will no longer be prompted to enter your password.
Homebrew recipe for virt-manager
As stated in the readme, you can install it using
brew tap jeffreywildman/homebrew-virt-manager
brew install virt-manager virt-viewer
First you need to ensure that you're using an SSH key rather than a password to log into the Linux machine. If you connect over ssh without specifying a password then you should be good.
If you try to tell virt-manager to connect over SSH by just specifying the hostname it might not work though. You'll see an error like End of file while reading data: nc: unix connect failed: No such file or directory: Input/output error
. The file it's referring to is the libvirtd socket and the reason it can't find it is because it's looking in the wrong place. It's looking for the sock file in /usr/local/lib
but it actually lives at /var/run/libvirt/libvirt-sock
(at least it does on Debian). Luckily there's a query param you can pass in the SSH URL to override the socket location:
virt-manager --connect="qemu+ssh://USER@HOSTNAME/system?socket=/var/run/libvirt/libvirt-sock"
That should allow virt-manager to connect and let you manage your VMs.