Generate SSH Key Pair
In the first step, you must generate the SSH key from the local system.
How to generate an SSH key pair using OpenSSH from the Windows operating system?
Step 1: Press the Windows Logo Key. This key is located on the bottom row of your keyboard, between the Ctrl and Alt keys, and has the Windows logo on it.
Step 2:Â Type “cmd” in the search box.
Step 3: Right-click on “Command Prompt” under Best Match. The Best Match should be the Command Prompt app. Right-clicking on it will open a context menu.
Step 4: Choose “Run as Administrator”. This option will prompt Windows to open Command Prompt with administrative privileges, allowing you to perform actions that require elevated permissions.
Step 5: After selecting “Run as Administrator,” Windows may display a User Account Control (UAC) prompt asking, “Do you want to allow this app to make changes to your device?” Click “Yes” to proceed with running Command Prompt as an administrator.
Step 6: Enter the following command in the Command Prompt window:
Step 7: Choose where to save the keys. By default, OpenSSH will save the keys in the directory C:\Users\your_username/.ssh/id_rsa. You can either accept the default location and file names or specify custom ones for better identification, especially if you’re managing multiple SSH key pairs. If you’re fine with the default, just press Enter.
Step 8: Set a passphrase (optional). You’ll have the option to set a passphrase for added security. If you prefer not to set one, simply press Enter to skip this step.
Step 9: After choosing the location and passphrase (if applicable), OpenSSH will generate the key pair and display the key fingerprint along with a random image for visual confirmation.
Step 10: Open your file explorer and go to the directory where the keys were saved, typically located at C:\Users\your_username/.ssh.
Step 11: In this directory, you should see two files: id_rsa (the private key) and id_rsa.pub (the public key). These files constitute your SSH key pair.
How to Generate an SSH Key Pair Hsing ssh-keygen From the Linux or MacOS Operating System?
To generate a new SSH key, such as the RSA type, using the ssh-keygen tool on Linux or MacOS, follow these steps:
Step 1: Open your terminal application. Start the key generation process by executing the following command:
Press Enter to proceed with the default values for key location and passphrase, or adjust them if needed.
Step 2: To view the value of both the public and private SSH keys, use the cat command. For example, to view the public key, execute the following command:
Replace the path /root/.ssh/id_rsa.pub with your public key path.
This command will display the content of the public SSH key, which you can then copy and use as needed for authentication purposes.
By following these steps, you can generate a new SSH key pair, specifically the RSA type, using the SSH-keygen tool on Linux or MacOS.