I've been silently learning from all of you for a long time. So thank you in advance for that! But now I got to a point where no google search can help with this issue I'm presented. I've found some info on these links, but sadly, it doesn't address exactly what I need (or at least I'm not seeing it):
Scenario: I have a Mac computer connected to a Ubuntu server through SSH.
I'm testing RSA key authentication through it, and it works right. However ONLY if the client key file name for the key is
id_rsa.pub. Whenever this name changes, the ssh handshake goes:
debug1: Next authentication method: publickey debug1: Offering public key: rsa-key-2.pub RSA SHA256:********/s explicit debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: rsa-key-2.pub RSA SHA256:*******/s explicit Load key "rsa-key-2.pub": invalid format debug2: we did not send a packet, disable method debug1: Next authentication method: password
(rsa-key-2 is my second test key, I've .backup-ed the id_rsa original ones for testing purposes. As you can see, sshd seems to see the keys though, why doesn't it accept it?)
My issue is; what if I want to have more than one key to access different Linux machines? Can't I have a key1.pub, key2.pub, etc, file so I can store different keys on my computer for my different linux servers?
Workarounds attempted: I've been tinkering with
sshd_config (host end) and
ssh_config on the client end, but I didn't get to make it work (always restarting sshd after any changes).
PubkeyAuthenticationis set to yes.
I tried adding
HostKey /etc/ssh/name of the key I want to use but that didn't work either.
Do you think there's something I can do to have several local RSA keys that work with several different Linux machines (or the same, for testing purposes)?
I hope I explained my issue properly, and most importantly, thank you in advance for any input/help.