ssh public key / private key mismatch

I updated my private key and added the public key to the authorized_keys on my target hosts and it didn't work.  I ran a few verbose connections to see that the key was being sent, but not accepted.

Turns out the old version of ssh on this server doesn't generate the public key from the private key, it reads the id_rsa.pub file to send the public key.  Since this public key doesn't match what's in authorized_keys, I was denied.

The solution was to delete the public key.  Alternatively, you can generate the public key with ssh-keygen.

$ ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

I noticed that the ssh on my workstation doesn't read the id_rsa.pub file, so it must be an issue with the older ssh on the server (hosted server, I can't update it)

Add new comment

About the Author...

Slides from LISA 2019 Linux systems troubleshooting #LISA2019 https://t.co/D4dMKflK6R Tue Oct 29 05:59:30 +0000 2019

https://t.co/AGeihMALAv configuring grub2 with EFI Fri Sep 13 05:20:01 +0000 2019

I published a Thing on @thingiverse! https://t.co/IYpRyEb7Hz #thingalert Tue Jul 23 19:27:57 +0000 2019

Nokogiri install on MacOSX https://t.co/v3An0miW9L Fri Jul 12 15:06:49 +0000 2019

HTML email with plain mailer plugin on Jenkins https://t.co/Z6FSDMDjy8 Thu Jul 11 21:07:25 +0000 2019