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.
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.
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
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:
The public key is now located in your preferred location (id_rsa.pub) The private key
(identification) is id_rsa