Categories
kbase

How to Create SSH Keys on Windows, macOS, and Linux

SSH keys provide a secure, modern way to authenticate with servers without using passwords. They are safer, faster, and strongly recommended for DirectAdmin, cPanel, VPS hosting, and any SSH‑based workflow.

This guide shows you how to generate SSH keys on Windows, macOS, and Linux, including file paths, commands, and how to copy your public key.

What You Will Create

When you generate SSH keys, you get two files:

  • Private key — keep this safe and never share it
  • Public key (.pub) — this is the key you upload or paste into DirectAdmin, cPanel, GitHub, etc.

Default filenames:

  • id_ed25519 (private key)
  • id_ed25519.pub (public key)

The ed25519 algorithm is recommended because it is modern, secure, and fast.

1. Create SSH Keys on Windows (PowerShell)

Windows 10 and 11 include OpenSSH by default.

Step 1 — Open PowerShell

Press Start, type PowerShell, and open it.

Step 2 — Generate your SSH key

Run:

powershell

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to accept the default save location.

Step 3 — View your public key

Run:

powershell

cat C:\Users\<YourName>\.ssh\id_ed25519.pub

Copy the entire output line — this is the key you paste into DirectAdmin or other services.

Default Windows key paths

  • Public key: C:\Users\<YourName>\.ssh\id_ed25519.pub
  • Private key: C:\Users\<YourName>\.ssh\id_ed25519

2. Create SSH Keys on macOS

macOS includes OpenSSH out of the box.

Step 1 — Open Terminal

Applications → Utilities → Terminal

Step 2 — Generate your SSH key

Run:

bash

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to accept the default save path.

Step 3 — View your public key

Run:

bash

cat ~/.ssh/id_ed25519.pub

Copy the entire line.

Default macOS key paths

  • Public key: /Users/<yourname>/.ssh/id_ed25519.pub
  • Private key: /Users/<yourname>/.ssh/id_ed25519

3. Create SSH Keys on Linux

Most Linux distributions include OpenSSH by default.

Step 1 — Open your terminal

Step 2 — Generate your SSH key

Run:

bash

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to accept defaults.

Step 3 — View your public key

Run:

bash

cat ~/.ssh/id_ed25519.pub

Copy the entire line.

Default Linux key paths

  • Public key: ~/.ssh/id_ed25519.pub
  • Private key: ~/.ssh/id_ed25519

4. How to Copy Your Public Key (All Systems)

Your public key is always the file ending in .pub.

Examples:

  • id_ed25519.pub
  • id_rsa.pub (older)

Open it with:

  • cat (macOS/Linux)
  • cat in PowerShell (Windows)
  • or any text editor (Notepad, nano, vim, etc.)

Copy the entire line, starting with:

Code

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... your_email@example.com

This is the key you paste into DirectAdmin, GitHub, GitLab, or any SSH‑enabled service.

5. Recommended Algorithm: ed25519

Why ed25519?

  • More secure than RSA
  • Much faster
  • Smaller key size
  • Supported everywhere

Only use RSA if you must support very old systems.

Summary

Creating SSH keys is simple and works the same across all operating systems:

  1. Run ssh-keygen -t ed25519
  2. Copy your public key (.pub)
  3. Add it to your hosting panel, Git service, or server
  4. Keep your private key safe

SSH keys give you secure, password‑less authentication and are the recommended method for modern server access.