Set up ssh access for Virt Manager

Virt Manager is underrated in our opinion. It's small, fast and can manage VMs over multiple KVM hosts. For it to work effectively in this sense, you need ssh access minus passwords - purely key based. Here's how to set it up. System used: CentOS 7. User account used: root.

First off all we need to generate a keypair. This uses the default ~/.ssh/ location. Enter:

ssh-keygen -t rsa

Now, on the machine you want to use Virt Manager on you need to distribute the key you just generated, like so:

ssh-copy-id -i ~/.ssh/ [email protected][change to the KVM host IP address]

Do this for each KVM host, changing the bit after [email protected] to the hostname (if it resolves in your DNS or the IP address of each respective one. You'll need the password of each. Once done, as per the instructions following the completion of the command, you'll be able to log in without using a password.

Now you can add the hosts in Virt Manager and control them all from one interface.

Posted by