Show Table of Contents
20.4. Connecting to the Hypervisor with virsh Connect
The
virsh connect [hostname-or-URI] [--readonly] command 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 uri command), as shown:
$ virsh uri
qemu:///session
For example, to establish a session to connect to your set of guest virtual machines, with you as the local user:
$ virsh connect qemu:///session
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 uri command will display it:

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.