Using Existing ED25519 SSH Keys

This guide explains how to use an existing ED25519 SSH key pair (e.g., id_ed25591 and id_ed25591.pub) across different operating systems. This is useful when reusing previously generated SSH credentials on a new machine or environment.


Key Files

  • id_ed25591 — Your private key
  • id_ed25591.pub — Your public key

Ensure you keep your private key secure and never share it.


1. Ubuntu Linux

Step 1: Create .ssh Directory (if it doesn’t exist)

mkdir -p ~/.ssh
chmod 700 ~/.ssh

Step 2: Move the Key Files

Assuming the keys are in your Downloads folder:

mv ~/Downloads/id_ed25591 ~/.ssh/
mv ~/Downloads/id_ed25591.pub ~/.ssh/

Set the correct permissions:

chmod 600 ~/.ssh/id_ed25591
chmod 644 ~/.ssh/id_ed25591.pub

Step 3: Add Key to SSH Agent

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25591

2. macOS

Step 1: Move Key Files to .ssh Folder

mkdir -p ~/.ssh
chmod 700 ~/.ssh
mv ~/Downloads/id_ed25591 ~/.ssh/
mv ~/Downloads/id_ed25591.pub ~/.ssh/
chmod 600 ~/.ssh/id_ed25591
chmod 644 ~/.ssh/id_ed25591.pub

Step 2: Add Key to SSH Agent and macOS Keychain

eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25591

Step 3: (Optional) Persist Key in SSH Config

Edit or create ~/.ssh/config:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25591

3. Windows

Option A: Using Git Bash

  1. Open Git Bash.
  2. Move the key files to your SSH directory:
mkdir -p ~/.ssh
mv /c/Users/YourUser/Downloads/id_ed25591 ~/.ssh/
mv /c/Users/YourUser/Downloads/id_ed25591.pub ~/.ssh/
chmod 600 ~/.ssh/id_ed25591
chmod 644 ~/.ssh/id_ed25591.pub
  1. Start the SSH agent and add the key:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25591

Option B: Using Windows Subsystem for Linux (WSL)

Inside WSL (e.g., Ubuntu):

mkdir -p ~/.ssh
mv /mnt/c/Users/YourUser/Downloads/id_ed25591 ~/.ssh/
mv /mnt/c/Users/YourUser/Downloads/id_ed25591.pub ~/.ssh/
chmod 600 ~/.ssh/id_ed25591
chmod 644 ~/.ssh/id_ed25591.pub

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25591

Verifying the SSH Key

You can test that your key is working by connecting to a server:

ssh -i ~/.ssh/id_ed25591 user@your-server.com

Or verify that the key is loaded:

ssh-add -l

Summary

OS Key Path Add Command
Ubuntu ~/.ssh/id_ed25591 ssh-add ~/.ssh/id_ed25591
macOS ~/.ssh/id_ed25591 ssh-add --apple-use-keychain ~/.ssh/id_ed25591
Windows ~/.ssh/id_ed25591 ssh-add ~/.ssh/id_ed25591

Ensure that your key is securely stored and permissions are correctly configured to avoid authentication issues.