How to pass multiple SSH public keys with `linode-cli linodes create`
According to linode-cli linodes create --help
Arguments:
--authorized_keys: A list of SSH public keys to deploy for the root user on the newly-created Linode.
How do I format this list to use multiple SSH public keys? When I include the quoted text of a two-line existing (and functioning) authorized_keys
file, I get the following error:
authorized_keys SSH Key 1 must not be multi-lined.
I'm using this format:
"ssh rsa KEY user@host","ssh rsa KEY user@host"
This is accepted, but the authorized_keys
file then is one line with two keys and does not work.
1 Reply
The linode-cli expects an "array of strings", so I can understand why you'd take the approach you did.
It's not the most intuitive thing, but to pass multiple SSH keys to separate lines in your authorized_keys
file, you'll need to pass --athorized_keys
multiple times. For example:
--authorized_keys 'ssh-key-1' --authorized_keys 'ssh-key-2'
The linode-cli
will pick up from there and convert it to an array of strings, as you can see from this snippet from the --debug
output:
"authorized_keys": ["ssh-key-1", "ssh-key-2"],