I opened my public key in libre office and edited the comment section of the key and then saved. But when I run:
ssh-keygen -l -f id_rsa.pub
I get:
id_rsa.pub is not a public key file.
The file is no longer recognized as a public key file. How do I solve this?
Remember id_rsa is the private key and id_rsa. pub is the public key. And that's all there is to viewing your SSH public and private keys on Linux, macOS, and Windows.
The default directory for SSH keys is ~/. ssh with the private key named id_rsa and the public key named id_rsa.
id_rsa. pub contains the public key of your RSA key pair. It may be used to allow you access the machine B over ssh without needing to enter password. To know it works, read this Security SE question.
pub file, while the private part is saved in the id_rsa file. Both files can be accessed from this location using Explorer: C:\Users\[your user name]\. ssh . Make sure you replace [your user name] with your user name.
You might not open this file using complex text editor. Use Notepad++ or gedit (something like this) to edit your file.
Then, verify you have a space between 'ssh-rsa' and "AAAA....." at the beginning of your key.
To regenerate your public key, use the -y option as follow :
ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub
I hope it will fix your problem :)
From
man ssh-keygen
:-y This option will read a private OpenSSH format file and print an OpenSSH public key to stdout.
Source : serverfault.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With