Skip to main content
search

How to Generate SSH Key

By September 1, 2017December 11th, 2023Emerging Tech
sshkey bg

About SSH Keys

SSH keys serve as a means of identifying yourself to an SSH server using public-key cryptography and challenge-response authentication.While a password can eventually be cracked with a brute force attack, SSH keys are nearly impossible to decipher by brute force alone. Generating a key pair provides you with two long string of characters: a public and a private key. You can place the public key on any server, and then unlock it by connecting to it with a client that already has the private key. When the two match up, the system unlocks without the need for a password. You can increase security even more by protecting the private
key with a passphrase.

Step One

Checking for existing SSH key
Open Terminal and Enter ls -al ~/.ssh​ to see if existing SSH keys are present and Check
the directory listing to see if you already have a public SSH key.

ssh key

Step Two

Create the RSA Key Pair
The first step is to create the key pair on the machine. Open Terminal and enter
ssh-keygen -t rsa

SSH-Key

Step Three

Store the Keys and Passphrase
Once you have entered the Gen Key command, you will get a few more questions:

Enter file in which to save the key : This should be the location where you want your key to be saved — You can press enter here to move to next question.

Enter passphrase (empty for no passphrase) : It’s up to you whether you want to use a passphrase. Entering a passphrase does have its benefits.

The entire key generation process looks like this:

Generate-SSH-Key

 

The public key is now located in your preferred location (id_rsa.pub) The private key
(identification) is id_rsa

Raj Sanghvi

Raj Sanghvi is a technologist and founder of BitCot, a full-service award-winning software development company. With over 15 years of innovative coding experience creating complex technology solutions for businesses like IBM, Sony, Nissan, Micron, Dicks Sporting Goods, HDSupply, Bombardier and more, Sanghvi helps build for both major brands and entrepreneurs to launch their own technologies platforms. Visit Raj Sanghvi on LinkedIn and follow him on Twitter. View Full Bio

Leave a Reply