-
Notifications
You must be signed in to change notification settings - Fork 7
Key pairs, e.g. for AWS EC2
-
To get the public key from a pem file:
ssh-keygen -f private.pem -y > public.pub
See ssh - How do I get the public key of a pem file? - Stack Overflow
-
How to get the private key from a pem file?
Answer: The .pem file is the private key, and one thatssh
can use directly! -
To verify your key pair's fingerprint, for a key that was created on AWS:
openssl pkcs8 -in path_to_private_key -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#verify-key-pair-fingerprints for more information including commands for key pairs that were generated elsewhere.
ssh-keygen -i -f john-doe-public-1-SSH2.pub
# List all existing keys
aws ec2 describe-key-pairs
# Quick way to generate entries for appending to ~/.ssh/authorized_keys on target EC2 instance
aws ec2 describe-key-pairs --include-public-key --key-names john-doe-public jane-doe-public-1 | jq -r '.KeyPairs.[].PublicKey'
-
To remove passphrase from an existing SSH key:
ssh-genkey -p
-
To convert SSH private key to PuTTY private key:
puttygen NAME-id_rsa -o NAME-id_rsa.ppk -O private --ppk-param version=2
Wikis: data | model-factory | opendrr-api | opendrr | python-env | riskprofiler-cms