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

Jerry Han

New Member
Mar 19, 2019
3
0
1
53
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!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!