linode-cli
linode-cli copied to clipboard
Rebuild command fails when passing an authorized_keys
Rebuilding a host fails with incorrect error message
$ linode-cli linodes rebuild 1234 --root_pass somepassword --authorized_keys ~/.ssh/id_ed25519.pub
Request failed: 400
┌errors───────────┬────────────────────────────────────────────────────────────────────────────────┐
│ field │ reason │
├─────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ authorized_keys │ SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519. │
└─────────────────┴────────────────────────────────────────────────────────────────────────────────┘
The key used is ed25519 and is the same key in my Linode profile.
The command also fails if I pass in the key id retrieved from linode-cli sshkeys list
$ linode-cli linodes rebuild 123 --root_pass somepassword --authorized_keys 1234
Request failed: 400
┌errors───────────┬────────────────────────────────────────────────────────────────────────────────┐
│ field │ reason │
├─────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ authorized_keys │ SSH Key 1 key-type must be ssh-dss, ssh-rsa, ecdsa-sha2-nistp, or ssh-ed25519. │
└─────────────────┴────────────────────────────────────────────────────────────────────────────────┘
Ohhh - you actually have to pass in the value of the key, but not the comment like
--authorized_keys ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINabcde
Not:
--authorized_keys `cat ~/.ssh/id_ed25519.pub`
Maybe authorized_keys should test if the argument is a file? Alternatively, perhaps it should accept the comment in an ssh file?
I like the idea of looking for a file if the input looks like a path. What comment do you have in your public key that it isn't accepting?
Actually, it was a matter of quoting - this works:
--authorized_keys "`cat ~/.ssh/id_ed25519.pub`"
or
--authorized_keys "$(cat ~/.ssh/id_ed25519.pub)"
Closing this issue as it seems to be resolved. Feel free to @ me if this issue is still relevant.