SSH Key

SSH keys are a secure way to authenticate with servers and services without using passwords. Follow these steps to generate your SSH key pair and use your public key.


For MacOS and Linux Users

1. Open Terminal

You can find Terminal in Applications > Utilities or by searching for it using Spotlight (Cmd + Space and type "Terminal").

2. Generate SSH Key Pair:

In the Term In the Terminal window, type the following command and press Enter:

ssh-keygen

This command generates a new SSH key using the RSA algorithm with 4096 bits.

3. Follow the prompts

  • Enter file in which to save the key: Press Enter to accept the default file location (`/Users/your_username/.ssh/id_rsa`).

  • Enter passphrase: Type a secure passphrase for additional security (optional, but recommended).

  • Enter the same passphrase again: Re-type your passphrase.

4. Verify the keys :

To check if your keys were generated successfully, type:

ls ~/.ssh
  • You should see `id_rsa` (your private key) and `id_rsa.pub` (your public key) in the list

  • Copy the SSH Public Key

  • To copy the SSH public key to your clipboard, type:

 bash pbcopy < ~/.ssh/id_rsa.pub

For Windows Users

1. Open Terminal

You can use PowerShell or Windows Terminal. To open it, press Win + S, type PowerShell or Windows Terminal, and press Enter.

2. Generate SSH Key Pair

In the Terminal window, type the following command and press Enter:

ssh-keygen -t rsa -b 4096

This command generates a new SSH key using the RSA algorithm with 4096 bits.

3. Follow the Prompts

  • Enter file in which to save the key (e.g., C:\Users\your_username\.ssh\id_rsa):

  • Press Enter to accept the default file location.

  • Enter passphrase (empty for no passphrase):

  • Type a secure passphrase for additional security (optional, but recommended).

  • Enter the same passphrase again: Re-type your passphrase to confirm.

4. Verify the Keys

To check if your keys were generated successfully, type:

Get-ChildItem $env:USERPROFILE\'.ssh\'

You should see two files in the list: id_rsa (your private key) and id_rsa.pub (your public key).

5. Copy the SSH Public Key

To copy the SSH public key to your clipboard, type:

Get-Content $env:USERPROFILE\.ssh\id_rsa.pub | Set-Clipboard

Last updated

Was this helpful?