How do I get the public key of a pem file?

Copy the public key to clipboard.

Linux

ssh-keygen -f private.pem -y | xclip

MacOS

ssh-keygen -f private.pem -y | pbcopy

Save to file

ssh-keygen -f private.pem -y > public.pub

Note that if your permissions are vague on the .pem file, then ssh-keygen will generate an empty .pub file.

You can usually fix this with:

chmod 400 private.pem 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)