qm set --sshkey

modem7

Member
Nov 2, 2021
34
2
13
38
Hey guys,

I think I already know the answer, but you never know.

In Proxmox GUI, in cloud-init settings, I'm able to set the ssh key (ed25519) as a string.

1670285860238.png

This can also be confirmed in the conf file in /etc/pve/qemu-server/
1670285938627.png

When I attempt to do the same in the CLI, I get:
Bash:
No such file or directory
1670285984805.png

Is this a limitation of the qm command or an oversight/bug?
 
single quotes, or "ticks" mean "execute this command" in shell. Use double quotes.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Aye, the command I put in (should have put this in, my bad!) was:

Bash:
# qm set 1107 --sshkey "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAREKNSYKMD1gDHTG0T7EsC4YEBem6hzM4J7yzgE2uWK test"
can't open 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAREKNSYKMD1gDHTG0T7EsC4YEBem6hzM4J7yzgE2uWK test' - No such file or directory

I also tried (just in case it didn't like the spaces):
Bash:
# qm set 1107 --sshkey "ssh-ed25519%20AAAAC3NzaC1lZDI1NTE5AAAAIAREKNSYKMD1gDHTG0T7EsC4YEBem6hzM4J7yzgE2uWK%20test"
can't open 'ssh-ed25519%20AAAAC3NzaC1lZDI1NTE5AAAAIAREKNSYKMD1gDHTG0T7EsC4YEBem6hzM4J7yzgE2uWK%20test' - No such file or directory
 
Last edited:
man qm:
Code:
 --sshkeys <filepath>
           cloud-init: Setup public SSH keys (one key per line, OpenSSH format).


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox

Aye, that's the confusion I'm getting.

The GUI allows for single lines to be manually added (especially in ED25519's case where it's rather short), but qm set does not allow adding unless it's directly from a file (with the same content).

There seems to be a disconnect in ability.

The only workaround I've found is doing something like this: https://github.com/modem7/public_scripts/blob/master/Bash/Proxmox Scripts/create-jammy-cloud-template.sh#L131-L136 but it seems...awkward when one should be able to just provide the exact values.
 
Last edited:
There seems to be a disconnect in ability.
different interfaces have different workflow. A gui user may find an ssh key in some other gui interface and copy it with a mouse.

A CLI user is very likely storing public keys in a single file already, ie known_hosts.
Also, what if you have 10 keys, repeat the --ssh-key 10 times?
What if you want to add 11th later? Does the new "qm set" overwrite existing config? Somehow add to it?

An ssh-rsa key is about 400 characters, 10 of them - 4000, is that something you want to be copy/pasting into shell?


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
1670285860238.png
So can I provide additional keys as new lines in GUI here? And if --sshkey accepts a file, does it also accepts several lines with several keys here?
 
So can I provide additional keys as new lines in GUI here? And if --sshkey accepts a file, does it also accepts several lines with several keys here?
You can in the GUI.

Unfortunately, as the post above seems to state, the CLI doesn't provide as much power user functionality as the GUI.
 
Last edited:

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!