Chapter 17. Graphical User Interface Tools for Guest Virtual Machine Management

download PDF
In addition to virt-manager, Red Hat Enterprise Linux 6 provides the following tools that enable you to access your guest virtual machine's console.

17.1. virt-viewer

virt-viewer is a minimalistic command-line utility for displaying the graphical console of a guest virtual machine. The console is accessed using the VNC or SPICE protocol. The guest can be referred to by its name, ID, or UUID. If the guest is not already running, the viewer can be set to wait until is starts before attempting to connect to the console. The viewer can connect to remote hosts to get the console information and then also connect to the remote console using the same network transport.
In comparison with virt-manager, virt-viewer offers a smaller set of features, but is less resource-demanding. In addition, unlike virt-manager, virt-viewer in most cases does not require read-write permissions to libvirt. Therefore, it can be used by non-privileged users who should be able to connect to and display guests, but not to configure them.
To install the virt-viewer utility, run:
# sudo yum install virt-viewer


The basic virt-viewer command-line syntax is as follows:
# virt-viewer [OPTIONS] {guest-name|id|uuid}
The basic virt-viewer command-line syntax is as follows:

Connecting to a guest virtual machine

If used without any options, virt-viewer lists guests that it can connect to on the default hypervisor of the local system.
To connect to a guest virtual machine that uses the default hypervisor:
# virt-viewer guest-name-or-UUID
To connect to a guest virtual machine that uses the KVM-QEMU hypervisor:
# virt-viewer --connect qemu:///system guest-name-or-UUID
To connect to a remote console using TLS:
# virt-viewer --connect xen:// guest-name-or-UUID
To connect to a console on a remote host by using SSH, look up the guest configuration and then make a direct non-tunneled connection to the console:
# virt-viewer --direct --connect xen+ssh:// guest-name-or-UUID


By default, the virt-viewer interface provides only the basic tools for interacting with the guest:
Sample virt-viewer interface

Figure 17.1. Sample virt-viewer interface

Setting hotkeys

To create a customized keyboard shortcut (also referred to as a hotkey) for the virt-viewer session, use the --hotkeys option:
# virt-viewer --hotkeys=action1=key-combination1[,action2=key-combination2] guest-name-or-UUID
The following actions can be assigned to a hotkey:
  • toggle-fullscreen
  • release-cursor
  • smartcard-insert
  • smartcard-remove
Key-name combination hotkeys are not case-sensitive. Note that the hotkey setting does not carry over to future virt-viewer sessions.

Example 17.1. Setting a virt-viewer hotkey

To add a hotkey to change to full screen mode when connecting to a KVM-QEMU guest called testguest:
# virt-viewer --hotkeys=toggle-fullscreen=shift+f11 qemu:///system testguest

Kiosk mode

In kiosk mode, virt-viewer only allows the user to interact with the connected desktop, and does not provide any options to interact with the guest settings or the host system unless the guest is shut down. This can be useful for example when an administrator wants to restrict a user's range of actions to a specified guest.
To use kiosk mode, connect to a guest with the -k or --kiosk option.

Example 17.2. Using virt-viewer in kiosk mode

To connect to a KVM-QEMU virtual machine in kiosk mode that terminates after the machine is shut down, use the following command:
# virt-viewer --connect qemu:///system guest-name-or-UUID --kiosk --kiosk-quit on-disconnect
Note, however, that kiosk mode alone cannot ensure that the user does not interact with the host system or the guest settings after the guest is shut down. This would require further security measures, such as disabling the window manager on the host.
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


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.