SSH Keys Generation

SSH Keys Generation

SSH permits the webserver to access the (CLI) command-line interface. It provides you with a perfect remote connection and security for the webserver. SSH program has two setups such as SSH key pairs and SSH keys to get connected using a password. You can even say it is a challenge in cryptographic history that gives an SSH connection for perfect integration.

Does your operating system have SSH key pair? Here we are giving you a list of the process to create SSH key pair:
  • PowerShell Windows
  • PuTTY Windows
  • macOS Terminal and Unix
How to use PowerShell in Windows for generating SSH Keys?

You can access using PowerShell or command prompt which gives OpenSSH in Windows.

Step 1: Tap on the “Start Menu” and then enter as PowerShell. Choose the PowerShell as per your requirement and tap on the option “run as administrator”.

Step 2: Now, do SSH key pair generation

Code:
ssh-keygen
Step 3: You will get a prompt that says “Enter file in which to save the key”. So, now you need to tap on the button “Enter” on your keyboard.

Step 4: It shows a prompt again for entering a passphrase so, tap on the “Enter” button.

Step 5: Again for confirmation of the passphrase the prompt will be displayed in front of you. To confirm the passphrase by typing it again + give a click on Enter button.

Step 6: You will get a result like:

Code:
Enter file in which to save the key (C:\Users\/.ssh/id_rsa): Enter passphrase (empty for no passphrase):
Enter the same passphrase again:
Your identification has been saved in C:\Users\/.ssh/id_rsa. Your public key has been saved in C:\Users\/.ssh/id_rsa.pub.
Step 7: Make sure whether the permission you gave is right or not

Code:
cd .ssh
Code:
icacls id_rsa.pub /inheritance:r
Code:
icacls id_rsa.pub /grant:r username:"(R)"
You have now created SSH key pair with PowerShell in Windows.

PuTTY Windows SSH key generation:

We recommend using one of the best SSH access called PuTTY to generate an SSH key.

Follow the below steps please:

Step 1:
Now, try to open the application “PuTTYgen”. It will ask you to select the type of key generation so choose the one called “RSA”.

Step 2: You will get a list that shows key generation in bits of number chooses the one “4096”.

Step 3: Tap on the option “Generate”. Make a full round on the key section to bring a full progress bar.

Step 4: Go to the section “Key Comment” for identifying the SSH key pair.

Step 5: In the field key passphrase just type the passphrase for security purpose also it asks to enter the passphrase again for confirmation.

Step 6: Tap on the button “Save private key” and “Save public key”. You save the private and public key in the directory “user’s.ssh”.

Code:
C:\Users\userna5\.ssh\id_rsa.pub
C:\Users\userna5\.ssh\id_rsa.ppk
That’s it! You have completed the generation of the SSH key pair using PuTTY Windows.

macOS Terminal or Unix SSH Key Generation:

Step 1:
Go to your list of applications and choose “Terminal”. Type below command in your terminal:

Code:
ssh-keygen -t rsa -b 4096
Step 2: You will get a prompt saying “Enter file which to save the key”. Enter the passphrase which is required for your security purpose and the enter button “Enter”.

Step 3: It will ask you to confirm the passphrase again. Once confirmed you will receive a command type of SSH key generation like below:

Code:
userna5@localhost ~ $ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.

Enter file in which to save the key (/home/userna5/.ssh/id_rsa): Enter passphrase (empty for no passphrase):

Enter the same passphrase again:

Code:
Your identification has been saved in /home/userna5/.ssh/id_rsa.
Your public key has been saved in /home/userna5/.ssh/id_rsa.pub.
Step 4: Make sure the given SSH permission is correct or not by using the below command:

Code:
chmod 0700 ~/.ssh
Step 5: Go to SSH folder for correcting the permissions if not:

Code:
chmod 0600 ~/.ssh/*
Overall, we have given you three configuration to generate SSH key pair. I Hope, it will be very useful for you.
Author
kumkumsharma
Views
128
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top