SSH Keygen - Generate & Manage SSH Keys | Online Free DevTools by Hexmos

Generate and manage SSH keys with SSH Keygen. Create private keys, view public keys, and convert key formats easily. Free online tool for developers.

SSH Keygen Cheatsheet

SSH Key Generation and Management

The ssh-keygen command is a powerful utility for creating, managing, and converting SSH keys. This cheatsheet provides common usage examples for generating and manipulating SSH key pairs.

Key Generation and Usage

Create a SSH Private Key

This command generates a new SSH private key pair. It specifies the output file path, the key type (RSA), a comment for identification, and suppresses output and passphrase prompts for automation.

$ ssh-keygen -f ~/.ssh/mykey -t rsa -C "MyKey" -q -N ""

Generate a SSH Public Key from a Private Key

This command extracts the public key component from an existing private key file. The -y flag indicates that you want to output the public key.

$ ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

Convert a Multiline Public SSH Key to a Normal Public Key

This is useful when dealing with public keys that have been formatted with newlines. The -i flag is used for importing a key, and -f specifies the input file.

$ ssh-keygen -i -f ~/Downloads/key.multiline_pub > ~/Downloads/key.pub

View the Public SSH Key from a Private Key

This command directly displays the public key associated with a given private key file without saving it to a new file. It's a quick way to inspect your public key.

$ ssh-keygen -y -f ~/.ssh/id_rsa

Further Resources