Skip to content

Instantly share code, notes, and snippets.

@lichti
Last active January 27, 2017 10:20
Show Gist options
  • Save lichti/c63e53a529d024f269b46f09e05c21a7 to your computer and use it in GitHub Desktop.
Save lichti/c63e53a529d024f269b46f09e05c21a7 to your computer and use it in GitHub Desktop.
Modfying vnc configuration on KVM
  • Para modificar vms KVM em execução podemos usar o virsh.

  • Para o virsh se conectar ao "kvm" (libvirt) será necessário criar uma credencial no libvirt:

# saslpasswd2 -a libvirt glichti
  • Para verificar as credenciais já existentes:
# sasldblistusers2 -f /etc/libvirt/passwd.db
glichti@kvm-server: userPassword

Usando o virsh:

  • Conectando ao KVM(Libvirt)
# virsh
virsh # connect
Please enter your authentication name: glichti
Please enter your password:
  • Listando VMs
virsh # list
 Id    Name                           State
----------------------------------------------------
 8     MQUEUE                         running
 10    NGINX                          running
  • Verificando a configuração atual do VNC de uma VM:
virsh # qemu-monitor-command MQUEUE --hmp 'info vnc'
Server:
     address: 0.0.0.0:5902
        auth: vnc
Client: none
  • Desabilitando o vnc da VM
virsh # qemu-monitor-command MQUEUE --hmp 'change vnc none'
virsh # qemu-monitor-command MQUEUE --hmp 'info vnc'
Server: disabled
  • Habilitando o VNC da VM sem senha:
virsh # qemu-monitor-command MQUEUE --hmp 'change vnc :2'
virsh # qemu-monitor-command MQUEUE --hmp 'info vnc'
Server:
     address: 0.0.0.0:5902
        auth: none
Client: none
  • Listando clientes conectados ao vnc:
virsh # qemu-monitor-command MQUEUE --hmp 'info vnc'
Server:
     address: 0.0.0.0:5902
        auth: none
Client:
     address: 127.0.0.1:45617
  x509_dname: none
    username: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment