[SOLVED] How to use pvesh set vm's sshkeys

Jerry Han

New Member
Mar 19, 2019
3
0
1
54
Hi,

I can set cloud-init sshkey from Proxmox Web UI.
But when I use "pvesh set /nodes/node1/qemu/1100/config --sshkeys "ssh-rsa AAAAB3NzaC1..." to set the sshkey, got the error:

400 Parameter verification failed.

sshkeys: invalid format - invalid urlencoded string: ssh-rsa AAAA

What is the correct format of sshkeys parameter?
 
The string needs to be URL encoded ...
Thanks for your reply.

I have try to use python urllib.quote(key) and urllib.quote_plus(key) to encode the ssh-key but still get same error.

Could you please supply the sample code?

Thanks.
 
urllib.quote() defaults '/' as safe which is wrong in this context and using urllib.quote_plus() encodes spaces as plus which is wrong as well.

You can use:
urllib.quote(key, safe='')
 
urllib.quote() defaults '/' as safe which is wrong in this context and using urllib.quote_plus() encodes spaces as plus which is wrong as well.

You can use:
urllib.quote(key, safe='')

This is the key!
Thank you very much!