KVM VNC password change

Nacházíte se: / Linux / How to ...

 There are some tasks in qemu / kvm monitor which could be scripted (i.e. like changing VNC password on demand).

Here is how.

First, you need to tell qemu / kvm process to have a monitor accessible via a UNIX socket – if you use Proxmox VE, it will be created automatically, if not, just use such a command line parameter:

-monitor unix:/var/run/qemu-server/105.mon,server,nowait

Where /var/run/qemu-server/105.mon is the path to the socket.

Next, install minicom and create the /etc/minicom/minirc.105-mon file with the contents like below – this will tell minicom to connect to the serial monitor console of this qemu / kvm quest:

pu port             unix#/var/run/qemu-server/105.mon
pu minit
pu mreset

Next, minicom needs to execute a script – an example for changing a VNC password below (save it as “change-vnc-pass”; see “man runscript” for more syntax help):

send \r\r
send "change vnc password"
expect "Password:"
send some-password

The last thing would be to start minicom and execute these commands:

#!/bin/bash
minicom 105-mon -S /some/path/change-vnc-pass &
sleep 3s
kill $!

That’s it!

Source: http://blog.wpkg.org/2010/05/26/scripting-qemu-kvm-monitor/