# SSH keys for developers

> Generate an Ed25519 key with ssh-keygen, protect the private half, and install only the public .pub file on servers.

Source: https://fullbytedeveloper.com/blog/ssh-keys-for-developers
Published here: 2026-12-03, updated 2026-12-03

SSH public-key login uses a key pair from `ssh-keygen`: keep the private file secret, install only the `.pub` line on the remote [1]. Git remotes and VPS shells share the same idea with different `authorized_keys` layouts. Pair key files with a short Host alias in [SSH config](/blog/ssh-config) so you stop pasting four flags every deploy.

## Print a fingerprint you already have

If a default key exists, list its fingerprint before you mint another [1]:

```bash
ssh-keygen -l -f ~/.ssh/id_ed25519.pub
```

A healthy line includes `SHA256:` and the key type (`ED25519`). That fingerprint is what you compare when auditing which key GitHub or a server stores [1].

## Generate an Ed25519 user key

OpenSSH: with no arguments, `ssh-keygen` generates an Ed25519 key [1]. Explicit form:

```bash
ssh-keygen -t ed25519 -C "you@example.com" -f ~/.ssh/id_ed25519
```

The tool writes the private key to the path you chose and the public key beside it with `.pub` appended [1]. It asks for a passphrase; empty means none (required empty for host keys; for user keys prefer a real passphrase on laptops) [1]. Default private-key format is OpenSSH-specific and preferred for protection at rest [1].

Demo under `/tmp` (empty passphrase for teaching only):

```bash
ssh-keygen -t ed25519 -N '' -f /tmp/ssh_demo_key -C 'draft-demo' -q
ssh-keygen -l -f /tmp/ssh_demo_key.pub
```

Captured output:

```text
256 SHA256:BDCKxcNdiqyXrjzYshZvBPWt+9PVkUgdw5lBHZ89HfI draft-demo (ED25519)
```

The `256` is bit length for Ed25519 public material in that listing format [1]. Delete demo keys after teaching; never reuse empty-passphrase keys on real hosts.

## Draw user key versus host key

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 280" role="img" aria-label="Laptop keeps private key; public key goes to authorized_keys; host key goes to known_hosts">
  <defs>
    <marker id="arrowSshKeys" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="280" rx="12" fill="#0b1f3a"/>
  <text x="24" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">your laptop</text>
  <rect x="24" y="52" width="280" height="100" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="36" y="84" fill="#f8fafc" font-family="ui-monospace, monospace" font-size="14">id_ed25519 PRIVATE</text>
  <text x="36" y="108" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">never upload</text>
  <text x="36" y="132" fill="#cbd5e1" font-family="ui-monospace, monospace" font-size="14">id_ed25519.pub PUBLIC</text>
  <path d="M320 100 H368" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowSshKeys)"/>
  <text x="400" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">remote server</text>
  <rect x="384" y="52" width="312" height="100" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="396" y="84" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">authorized_keys</text>
  <text x="396" y="108" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">one public line per user key</text>
  <text x="396" y="132" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">host key is not user key</text>
  <path d="M540 160 V188" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowSshKeys)"/>
  <rect x="24" y="196" width="672" height="60" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="36" y="232" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">First connect stores the server host key in known_hosts on the laptop [1][2].</text>
</svg>
</figure>

*User keys prove who you are. Host keys prove which server you reached. Mixing them up breaks rotation plans.*

## Install only the public half

```bash
cat ~/.ssh/id_ed25519.pub
```

One line: algorithm, base64 blob, optional comment [1]. Append that line to `~/.ssh/authorized_keys` on the server, or paste it into GitHub or GitLab SSH settings. Keep `~/.ssh` mode `700` and private keys mode `600` so OpenSSH does not refuse loose permissions [1][2].

`ssh-copy-id` automates append when password login still works once. For Git hosting, the UI stores the public line; the private file never leaves your machine.

HTTPS protects web APIs in browsers ([what is HTTPS](/blog/what-is-https)). SSH protects interactive shells and `git@github.com` style remotes. Different transports; both need key hygiene.

## Use the agent and multiple keys

`ssh-agent` holds decrypted private keys in memory for a session. `ssh-add` loads keys after you enter the passphrase [1]. Multiple projects may use `-i` or better, a Host block:

```text
Host github-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_work
  IdentitiesOnly yes
```

Host aliases beat swapping default key names when one laptop joins work and personal GitHub. The full Include and first-value-wins story is on [SSH config](/blog/ssh-config).

## Rotate when the private key is at risk

There is no recovery for a lost passphrase: generate a new key and replace public keys on every host [1]. Change a passphrase later with `ssh-keygen -p` [1]. If a private file was copied to chat, email, or a public repo, treat it as burned: new keypair, new `authorized_keys` everywhere, audit git history.

Host key changes after reinstalling a VPS trigger `REMOTE HOST IDENTIFICATION HAS CHANGED`. Verify out-of-band (console fingerprint) before accepting [1].

## Test GitHub SSH before you blame the repo

```bash
ssh -T git@github.com
```

Success often prints a greeting with your username; failure prints `Permission denied (publickey)`. That test exercises user keys and `known_hosts`, not your HTTPS session to the website ([what is HTTPS](/blog/what-is-https)).

When no key is loaded, the command exits non-zero with permission denied. After `ssh-add`, the same command should authenticate if the matching `.pub` line is on the account. Read the message for auth success versus failure; wording on the server side changes over time.

## File layout OpenSSH expects

Default paths under `~/.ssh/` include `id_ed25519`, `id_ed25519.pub`, `known_hosts`, and optional `config` [1]. `authorized_keys` lives on servers you log into, not on the laptop. `known_hosts` accumulates host keys per `HostName` and port. Deleting it forces re-verification on next connect.

Comments in the public key (`-C` flag) are labels for humans only; the server ignores them for auth [1]. Keep comments honest (`you@work-laptop-2026`) when you rotate yearly.

## Ed25519 versus legacy RSA

OpenSSH defaults new keys to Ed25519 [1]. Older docs still mention `ssh-keygen -t rsa -b 4096`. RSA remains valid where policy requires it. New developer keys should start Ed25519 unless a vendor doc names another type. If GitHub rejects an old RSA signature path, migrate with [GitHub RSA SSH key cut-over](/blog/gh-ssh-rsa).

## Forwarding stays a separate checklist

SSH can forward local ports or agent access with `-L`, `-R`, and `-A`. Agent forwarding lets a remote host use keys already loaded in your local agent. That is convenient on jump hosts and risky on untrusted machines. Leave it off unless your runbook documents the threat model [2]. Hardware security keys (FIDO/U2F) are a different stack from file-based SSH keys; when a doc mentions WebAuthn for SSH, read that vendor path separately from `ssh-keygen` [2].

## Audit keys on a schedule

List fingerprints you expect on each host and in each Git hosting account. After laptop loss or contractor offboarding, remove the matching line from `authorized_keys` and from Git hosting settings the same day [1]. Yearly rotation is a reasonable default for developer laptops even when nothing leaked: generate a new Ed25519 key, install the public line everywhere you still need access, then delete the old private file.

Comments in the public key help that audit. A comment like `you@work-laptop-2026` tells you which machine produced the line when five keys sit on one GitHub account [1].

## Certificate-based auth (name only)

Some enterprises issue SSH user certificates signed by a CA instead of raw `authorized_keys` lines per host. That is still public-key cryptography, but rotation and expiry move to the CA workflow [2]. Personal GitHub and VPS paths in this article stay with the classic `authorized_keys` line. If your company mandates certificates, follow their runbook; do not mix a CA identity with a home lab key in the same Host block without reading both docs [2].

## Mistakes that burn keys

Committing `id_rsa` or `id_ed25519` without `.pub` in a repository. Scanners and bots harvest them.

Pasting the private key into a cloud server's "SSH key" UI. Those fields expect the public line only.

Using `chmod 777` on `~/.ssh` because login failed. OpenSSH refuses loose permissions on some platforms [1].

Sharing one team key file in a password manager instead of per-person keys. You lose attribution and easy revocation.

Skipping host key verification on first connect in scripts (`StrictHostKeyChecking=no` everywhere). That opens MITM paths on untrusted networks [1][2].

Treating HTTPS client certs and SSH user keys as interchangeable. TLS certs authenticate servers for HTTP; SSH user keys authenticate you to `sshd` or git remotes ([what is HTTPS](/blog/what-is-https)).

Leaving an empty-passphrase private key on a laptop that travels. Disk encryption helps; a passphrase on the key still matters when the file is copied out [1].

## What you have now

A sourced Ed25519 path from generate to fingerprint, plus a clear split between private file, public line, and host keys. Put the public line on remotes, keep the private file mode `600`, and alias hosts in [SSH config](/blog/ssh-config) so deploy scripts stop carrying four flags [1][2].

Browse the [Dev tools topic](https://fullbytedeveloper.com/blog/topic/dev-tools).

Send this to the friend who still emails private key files as attachments.

Image: Circular dark port with a glowing teal center on the left facing a matte cube with a glowing gold disk on the right, linked by curved and straight teal and gold arrows on a dark grid floor.
https://fullbytedeveloper.com/media/ssh-keys-for-developers/ssh-keys-for-developers-venice.webp
Public material travels to the remote; the private file stays on your laptop and never belongs in a paste field.

## Sources

1. [OpenBSD man pages: ssh-keygen(1), accessed 2026-12-03](https://man.openbsd.org/ssh-keygen.1)
2. [OpenSSH manual index, accessed 2026-12-03](https://www.openssh.com/manual.html)
3. [Full Byte Developer: Stop typing the full SSH command](https://fullbytedeveloper.com/blog/ssh-config)
4. [Full Byte Developer: What is HTTPS](https://fullbytedeveloper.com/blog/what-is-https)
