Search

20.4. Connecting to the Hypervisor with virsh Connect

download PDF
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:
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.