19.8. Configuring VNC passwords


To manage access to the graphical output of a virtual machine (VM), you can configure a password for the VNC console of the VM.

With a VNC password configured on a VM, users of the VMs must enter the password when attempting to view or interact with the VNC graphical console of the VMs, for example by using the virt-viewer utility.

重要

VNC passwords are not a sufficient measure for ensuring the security of a VM environment. For details, see QEMU documentation on VNC security.

In addition, the VNC password is saved in plain text in the configuration of the VM, so for the password to be effective, the user must not be able to display the VM configuration.

Prerequisites

  • The VM that you want to protect with a VNC password has VNC graphics configured.

    To ensure that this is the case, use the virsh dumpxml command as follows:

    # virsh dumpxml <vm-name> | grep graphics
    
     <graphics type='vnc' ports='-1' autoport=yes listen=127.0.0.1>
     </graphics>

Procedure

  1. Open the configuration of the VM that you want to assign a VNC password to.

    # virsh edit <vm-name>
  2. On the <graphics> line of the configuration, add the passwd attribute and the password string. The password must be 8 characters or fewer.

     <graphics type='vnc' ports='-1' autoport=yes listen=127.0.0.1 passwd='<password>'>
    • Optional: In addition, define a date and time when the password will expire.

       <graphics type='vnc' ports='-1' autoport=yes listen=127.0.0.1 passwd='<password>' passwdValidTo='2025-02-01T15:30:00'>

      In this example, the password will expire on February 1st 2025, at 15:30 UTC.

  3. Save the configuration.

Verification

  1. Start the modified VM.

    # virsh start <vm-name>
  2. Open a graphical console of the VM, for example by using the virt-viewer utility:

    # virt-viewer <vm-name>

    If the VNC password has been configured properly, a dialogue window appears that requests you to enter the password.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部