Setting VNC password permanently

CmasterG

New Member
Aug 27, 2018
19
0
1
36
Hi!

I have added in /etc/pve/local/qemu-server/100.conf the following line:

args: -vnc 0.0.0.0:100,password

but I don't know how to set a permanent password. I can set a password via the monitor of the VM, but when I restart proxmox I have to set the password again.
Can someone help me?

Thanks a lot in advance!

Cheers
 
Hi!

I have added in /etc/pve/local/qemu-server/100.conf the following line:

args: -vnc 0.0.0.0:100,password

but I don't know how to set a permanent password. I can set a password via the monitor of the VM, but when I restart proxmox I have to set the password again.


Directly not possible, but you can do it via script whenever your VM starts, e.g. with expect:

Code:
#!/usr/bin/expect

set vmid [lindex $argv 0]
set pwd [lindex $argv 2]
set dispnum [lindex $argv 1]


spawn qm monitor $vmid
expect {"qm>"}
send "change vnc 0.0.0.0:$dispnum,password\r"
expect {"qm>"}
send "set_password vnc $pwd\r"
expect {"qm>"}
send "exit\r"

and run it e.g. as follows (for VM 101 at port 5901):
Code:
myvncspript 101 1 mypassword
 
Directly not possible, but you can do it via script whenever your VM starts, e.g. with expect:

Code:
#!/usr/bin/expect

set vmid [lindex $argv 0]
set pwd [lindex $argv 2]
set dispnum [lindex $argv 1]


spawn qm monitor $vmid
expect {"qm>"}
send "change vnc 0.0.0.0:$dispnum,password\r"
expect {"qm>"}
send "set_password vnc $pwd\r"
expect {"qm>"}
send "exit\r"

and run it e.g. as follows (for VM 101 at port 5901):
Code:
myvncspript 101 1 mypassword
hi Richard, nice to meet you,
i need your help, where is i setup those script? at VM monitor or where?

thank you