SSH Key Generation

This document provides instructions for generating SSH key pairs (private and public) using different methods. SSH keys are used for secure authentication and encryption between a client and a server.

SSH Key Pair Generation Methods

This documentation covers two methods for generating SSH key pairs:

Using the command line on macOS and Unix operating systems.
Using PuTTYgen on Windows operating systems.

Method 1: Generating SSH Key Pair on macOS and Unix

To generate an SSH key pair on macOS and Unix operating systems, follow the steps below:

  1. Open a terminal or command prompt.
  2. Run the following command to generate an RSA key pair:
ssh-keygen -P '' -f transfer-key

This command generates an RSA key pair. The private key is saved as 'transfer-key' in the current directory, and the public key is saved as 'transfer-key.pub'.

  1. Run the following command to generate an ECDSA key pair:
ssh-keygen -t ecdsa -b 256 -N '' -m PEM -f transfer-key

This command generates an ECDSA key pair with a key size of 256 bits. The private key is saved as transfer-key in the current directory, and the public key is saved as transfer-key.pub.

Note: Valid values for the -b option for ECDSA are 256, 384, and 521. Adjust the value as per your requirements.

ssh-keygen -t ed25519 -f transfer-key

This command generates an ED25519 key pair. The private key is saved as transfer-key in the current directory, and the public key is saved as transfer-key.pub.

After generating the key pair, you will need to upload the public key to the desired server or service. The private key should be kept secure and should not be shared.

Method 2: Generating SSH Key Pair on Windows using PuTTYgen

Windows users can use PuTTYgen, a graphical tool, to generate SSH key pairs. Follow the steps below:

  1. Download and install PuTTYgen from the official website: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
  2. Launch PuTTYgen.
  3. Select the desired key type (e.g., RSA, DSA, ECDSA, ED25519) from the "Parameters" section.
  4. Click on the "Generate" button to create a new key pair.
  5. Follow the instructions to generate randomness by moving the mouse over the blank area of the PuTTYgen window.
  6. Once the key pair is generated, you can set an optional passphrase for added security. Enter the passphrase in the "Key passphrase" and "Confirm passphrase" fields.
  7. Click on the "Save public key" button to save the public key (.pub) to a location on your computer.
  8. Click on the "Save private key" button to save the private key (.ppk) to a secure location on your computer.

SFTP/FTP Clients

After generating the key pair, you can use the private key with popular SFTP clients for authentication. Here are a few examples:

FileZilla: In FileZilla, go to "Edit" -> "Settings" -> "SFTP" -> "Add key file" and select your private key file. Download FileZilla

WinSCP: In WinSCP, go to "Session" -> "SSH" -> "Authentication" and select your private key file. Download WinSCP

❗️

Remember to keep your private key secure and do not share it with anyone.