i'm having some difficulty trying to generate public key from private key , from the command line, where keys were made with openssh
(I know it's probably bad form to be root for this, but anyhow)
There are three private key files here. hp_blah_id_rsa, id_rsa, rodney
root@droplet-50-1:~/.ssh# ls -l total 20 -rw------- 1 root root 1512 May 29 00:14 authorized_keys -rw------- 1 root root 2602 May 28 23:15 hp_blah_id_rsa -rw------- 1 root root 2602 May 28 23:28 id_rsa -rw-r--r-- 1 root root 222 May 28 21:47 known_hosts -rw------- 1 root root 2602 May 28 21:17 rodney
as you see there's no .pub files there.
here the file command confirms they are private keys without me having to cat them!
root@droplet-50-1:~/.ssh# file hp_blah_id_rsa hp_blah_id_rsa: OpenSSH private key root@droplet-50-1:~/.ssh# file rodney rodney: OpenSSH private key root@droplet-50-1:~/.ssh# file id_rsa id_rsa: OpenSSH private key
I would like the public keys that can be derived from those private keys, in .pub files.
and it mentions
openssl rsa -in mykey.pem -pubout > mykey.pub
But that doesn't work for me e.g.
root@droplet-50-1:~/.ssh# openssl rsa -in id_rsa -pubout -out a.a unable to load Private Key 140565827753280:error:0909006C:PEM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY