Show Table of Contents
20.4. Connecting to the Hypervisor with virsh Connect
virsh connectcommand begins a local hypervisor session using virsh. After the first time you run this command it will run automatically each time the virsh shell runs. The hypervisor connection URI specifies how to connect to the hypervisor. The most commonly used URIs are:
qemu:///system- connects locally as the root user to the daemon supervising guest virtual machines on the KVM hypervisor.
qemu:///session- connects locally as a user to the user's set of guest local machines using the KVM hypervisor.
lxc:///- connects to a local Linux container.
The command can be run as follows, with the target guest being specified either either by its machine name (hostname) or the URL of the hypervisor (the output of the
virsh uricommand), as shown:
For example, to establish a session to connect to your set of guest virtual machines, with you as the local user:
To initiate a read-only connection, append the above command with
--readonly. For more information on URIs, see Remote URIs. If you are unsure of the URI, the
virsh uricommand will display it: