Programster's Blog

Tutorials focusing on Linux, programming, and open source

SSH Key Cheatsheet

As with all cheatsheets, this will be added to over time.

For the cheats below, you may replace [key path] with ~/.ssh/id_rsa if you are concerned with just your own computers key rather than a key file.

Add Passphrase

If you were given an unencrypted SSH key, such as from AWS, then you probably want to add a passphrase to it with the following command:

ssh-keygen -p -f my-private-key.pem

Generate public key from private key

ssh-keygen -f [key path] -y > [key path].pub

Add/Change password protection

ssh-keygen -p -f [key path]

Remove password protection

openssl rsa -in [key path] -out [key path].new