Skip to content

SSH & Remote Access33 min read

14 SSH Key Management Best Practices Every Developer Needs in 2026

SSH key management best practices for 2026: Ed25519 keys, passphrases, per-user access, key rotation, same-day revocation and a 90-day audit, with commands.

Hiren Kalariya
Hiren Kalariya

Published · Updated

14 SSH key management best practices as numbered cards, from Ed25519 keys and passphrases to FIDO2 keys and SSH certificates

SSH key management best practices come down to six habits: create Ed25519 keys with a passphrase, give every person and every machine its own key, keep private keys on your own devices, rotate automation keys every 90 days, remove a person's key the same day they leave, and audit every server's authorized_keys file every 90 days. The 14 practices in this guide follow the full key lifecycle, from ssh-keygen to revocation, with the exact OpenSSH commands for each step.

Disclosure: CtrlOps is our product. Every practice gives the plain OpenSSH commands first. CtrlOps appears only where it saves steps, and its limits are listed in the tools section.

We ran these commands on Ubuntu 24.04 LTS (OpenSSH 9.6p1) in November 2026 and checked key generation and key exchange on macOS 26 (OpenSSH 10.3p1); the macOS Keychain, FIDO2 and Windows steps follow vendor docs.

The usual story: a client sends server access over Slack, you add a key, the project ends, and the key stays on the server for years. Freelancers with 8 to 12 client servers and startup CTOs whose former developers can still reach production know it well.

Prefer to watch? All 14 practices in under 6 minutes:

SSH key management best practices are the rules for the five stages of an SSH key's life: how you create it, where you store it, who gets it, how often you replace it and how fast you remove it. NIST IR 7966 puts the goal in one line: SSH access "requires proper provisioning, termination, and monitoring processes."

The 14 practices cover those stages in order: generate (1 to 3), rotate (4), store and name (5 and 6), distribute (7 and 8), revoke and audit (9 to 11), then troubleshoot and scale (12 to 14). The cryptography in OpenSSH is rarely the weak point; the usual gaps are a key nobody removed, a laptop key with no passphrase, or one team key shared by ten people.

The 14 practices follow the key lifecycle in order, and each one starts with the OpenSSH command. Practices 1 to 12 apply to every developer or small team managing Linux servers. Practices 13 and 14 (FIDO2 hardware keys and SSH certificates) cover advanced setups for teams whose needs go beyond plain key files.

14 SSH key management best practices every developer must follow in 2026

Practice 1: Use ssh-keygen to Create Ed25519 Keys, Not RSA 2048

Ed25519 is the recommended type for every new OpenSSH key: short keys, fast signing, and a design that resists several implementation-level attacks. RSA 2048 is still secure but no longer the best choice; keep RSA for systems that require it, at 4096 bits.

Ed25519 vs RSA SSH key comparison showing key size, connection speed, and security level for choosing the right SSH key type in 2026

Why Ed25519 Is Preferred Over RSA For New Deployments

PropertyEd25519RSA 2048RSA 4096
Key size256 bits2048 bits4096 bits
Signatures per second (our test)About 57,600About 2,900About 460
Security levelSimilar to RSA 3072Acceptable for most current use casesAcceptable
Side-channel resistanceHigh (by design)Depends on the implementationDepends on the implementation
SupportOpenSSH 6.5 (2014) and newerUniversalUniversal
VerdictUse thisAvoid for new keysOnly if Ed25519 is unsupported

In our openssl speed test (OpenSSL 3.0.13, Ubuntu 24.04, Apple Silicon), Ed25519 signed about 20 times faster than RSA 2048, but RSA checks signatures faster and a login needs one signature, so you won't feel it. Switch for the design: the Ed25519 authors give it a 2^128 security target, similar to RSA with about 3,000-bit keys, and the code never branches on secret data. Mozilla's OpenSSH Guidelines list the Ed25519 host key first.

Generate an Ed25519 key:

bash
ssh-keygen -t ed25519 -C "your-comment-here"

Replace your-comment-here with the naming pattern from Practice 6, such as emily@macbook-pro-2026-11. For a genuinely old server that predates OpenSSH 6.5, fall back to RSA 4096, never a new RSA 2048 key:

bash
ssh-keygen -t rsa -b 4096 -C "your-comment-here"

With CtrlOps SSH Setup Wizard: In the left sidebar, under TOOLS, click SSH Setup. The wizard recommends Ed25519, generates the pair in one click, and shows your new key ready to copy. See the SSH Setup Wizard documentation for step-by-step details.

Adding, viewing and removing keys in CtrlOps:

Use Modern SSH Key Exchange Algorithms (Including Post-Quantum)

SSH key exchange (KEX) is the handshake at the start of every connection, where both sides agree on a session key; it is a separate setting from your key type. Post-quantum key exchange is now the OpenSSH default, but old servers and copied configs can still allow weak methods such as diffie-hellman-group1-sha1, disabled by default since OpenSSH 7.0.

Modern SSH connection flow diagram showing the key exchange handshake and post-quantum KEX negotiation between an SSH client and server

Which key exchange methods to keep:

KEX AlgorithmStatusNotes
diffie-hellman-group1-sha1Remove immediately1024-bit DH, too weak for 2026
diffie-hellman-group14-sha1RemoveSHA-1, flagged by most security scanners
diffie-hellman-group-exchange-sha256KeepFallback for older clients; Mozilla's modern config lists it
curve25519-sha256KeepClassical baseline, fast and secure
sntrup761x25519-sha512KeepPost-quantum hybrid, default since OpenSSH 9.0 (named sntrup761x25519-sha512@openssh.com before 9.9)
mlkem768x25519-sha256PreferredNIST-standardized post-quantum hybrid, added in 9.9, default since 10.0

The post-quantum context: OpenSSH 9.0 (April 2022) made the hybrid sntrup761x25519-sha512@openssh.com the default, and OpenSSH 10.0 (April 2025) moved to mlkem768x25519-sha256. GitHub added post-quantum key exchange for Git over SSH on GitHub.com on September 17, 2025. Since OpenSSH 10.1, a connection without it prints a warning: This session may be vulnerable to "store now, decrypt later" attacks. Your job is removing weak fallbacks with a line your version understands, because one name it doesn't know makes sshd refuse the whole file.

Harden your KEX configuration in /etc/ssh/sshd_config:

bash
# 1. Check the OpenSSH version and the key exchange methods it supportsssh -Vssh -Q kex# 2. Add ONE of these lines to /etc/ssh/sshd_config# OpenSSH 9.9 or newer:KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256,diffie-hellman-group-exchange-sha256# OpenSSH 8.5 to 9.8 (Ubuntu 24.04 ships 9.6p1):KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,diffie-hellman-group-exchange-sha256# OpenSSH 7.4 to 8.4:KexAlgorithms curve25519-sha256,diffie-hellman-group-exchange-sha256# 3. Test the file before you restart: sshd won't start with an error in itsudo sshd -t# 4. Restart SSH: the service is "ssh" on Ubuntu and Debian, "sshd" on RHEL, Fedora and Archsudo systemctl restart ssh# 5. Check that a weak method is refusedssh -oKexAlgorithms=diffie-hellman-group1-sha1 localhost# Expected: "no matching key exchange method found"

Keep a second SSH session open until the new settings work. For the full recommendations, see Mozilla's OpenSSH Guidelines and openssh.org/pq.html, and paste the whole file into the free sshd_config Analyzer, which grades the config A to F and shows the line that fixes each weak directive.

Practice 2: One Key Pair Per Machine, Per Use Case

Never reuse a private key across machines or purposes. Give each laptop, each client and each automation job its own key pair, so a compromised key exposes one machine's worth of access, not every server you manage.

One key pair per machine per use case architecture with separate Ed25519 keys for each laptop and client mapped in the SSH config file

Common key separation patterns

text
~/.ssh/├── id_ed25519                # Personal laptop, default key├── id_ed25519.pub├── client_acme_ed25519       # Client A, freelance project├── client_acme_ed25519.pub├── client_beta_rsa4096       # Client B, legacy server that needs RSA├── client_beta_rsa4096.pub├── ci_deploy_ed25519         # CI/CD only, no passphrase (Practice 3)├── ci_deploy_ed25519.pub└── config

Your other devices get their own sets. Map each key to the right servers in ~/.ssh/config:

text
Host acme-prod  HostName 203.0.113.10  User ubuntu  IdentityFile ~/.ssh/client_acme_ed25519  IdentitiesOnly yes  AddKeysToAgent yesHost beta-staging  HostName 198.51.100.20  User ec2-user  IdentityFile ~/.ssh/client_beta_rsa4096  IdentitiesOnly yes

Now ssh acme-prod picks the right key, and IdentitiesOnly yes stops SSH from offering every agent key to every server ("Too many authentication failures"). The SSH Config Generator builds these blocks for multi-client setups, bastion hosts and port forwarding.

For a freelancer with 10 client servers, this decides how bad a lost laptop gets: one key for everything exposes all 10 clients, one key per client exposes one, and you know which key to revoke.

SSH key chaos vs organized SSH management: scattered, unlabeled SSH keys on the left versus a clean per-client key structure with clear names on the right

When a project ends: unload the key with ssh-add -d ~/.ssh/client_acme_ed25519, remove your public key from the client's authorized_keys, and archive or delete the local key pair. For day-to-day work across many client servers, read the guide on managing multiple servers without losing control.

Practice 3: Protect Every Private Key with a Passphrase

A passphrase encrypts the private key on disk, so a copied file is useless without it.

Generate a key with a passphrase:

bash
ssh-keygen -t ed25519 -C "emily@macbook-pro-2026-11"

The tool prompts:

text
Enter passphrase (empty for no passphrase): [type a strong passphrase]Enter same passphrase again: [confirm]

Use four to six random words, not a variation of your login password. To avoid re-typing it all day, add your key to the SSH agent once per session:

bash
ssh-add ~/.ssh/id_ed25519

On macOS, persist it across reboots:

bash
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

The agent holds the decrypted key in memory, so you type the passphrase once and the key is never written to disk unencrypted.

How to Remove a Passphrase from an Automation Key

CI/CD pipelines, cron jobs and deploy scripts run unattended and can't type a passphrase. Give them their own key without one, and never strip the passphrase from your personal key.

Remove a passphrase from an existing key:

bash
ssh-keygen -p -f ~/.ssh/ci_deploy_ed25519

The tool prompts:

text
Enter old passphrase: [current passphrase]Enter new passphrase (empty for no passphrase): [press Enter]Enter same passphrase again: [press Enter]Your identification has been saved with the new passphrase.

Pressing Enter for the new passphrase sets it to empty, which removes it.

Correct workflow for automation keys:

  1. Generate a dedicated key: ssh-keygen -t ed25519 -C "deploy@github-actions-2026-11" -f ~/.ssh/ci_deploy_ed25519
  2. Leave the passphrase empty, or remove it later with ssh-keygen -p
  3. Add only this key's public key to the target server
  4. Lock it to one task in authorized_keys: restrict turns off forwarding and terminals, and command= runs one fixed command whatever the client asks for: restrict,command="/usr/local/bin/deploy.sh" ssh-ed25519 AAAA... deploy@github-actions-2026-11
  5. Rotate it every 90 days or when a project ends (Practice 4)

Practice 4: Rotate SSH Keys on a Schedule

To rotate an SSH key, add the new key, test it, then remove the old one, in that order, on every server and cloud account that trusted the old key. Rotate CI/CD and other automation keys every 90 days, personal keys once a year, and any key at once when someone leaves, a laptop goes missing or a key may have leaked.

KeyWhen to rotate
CI/CD, cron and deploy keysEvery 90 days
A person's own keyOnce a year
Any keyAt once after an exit, a lost laptop or a leak

Find every place the old key works first. Across cloud infrastructure, that includes AWS EC2 key pairs and DigitalOcean or Hetzner SSH key lists, which put the key on new servers, and CI secret stores. On each server, ssh-keygen -lf ~/.ssh/authorized_keys lists the fingerprints it trusts.

Rotate one key in five commands:

bash
# 1. Make the new key on your computer, dated in the commentssh-keygen -t ed25519 -C "emily@macbook-pro-2026-11" -f ~/.ssh/id_ed25519_2026_11# 2. Add it to the server, logging in with the old keyssh-copy-id -i ~/.ssh/id_ed25519_2026_11.pub emily@203.0.113.10# 3. Test the new key on its ownssh -i ~/.ssh/id_ed25519_2026_11 -o IdentitiesOnly=yes emily@203.0.113.10 'echo new key works'# 4. Remove the old key from the server, matched by its commentssh -i ~/.ssh/id_ed25519_2026_11 -o IdentitiesOnly=yes emily@203.0.113.10 "sed -i '/ emily@macbook-pro-2025-11\$/d' ~/.ssh/authorized_keys"# 5. Check which keys the server still trustsssh -i ~/.ssh/id_ed25519_2026_11 -o IdentitiesOnly=yes emily@203.0.113.10 'ssh-keygen -lf ~/.ssh/authorized_keys'

Step 4 matches the old key by its comment (Practice 6); with no comment, match a unique piece of the key string. Then point IdentityFile in ~/.ssh/config at the new key, unload the old one with ssh-add -d, and delete its files. For a CI/CD key, update the CI secret store before step 4.

Contractors: put OpenSSH's expiry-time option in front of the key, and the server refuses it after that date (OpenSSH 7.7+, server time zone unless you add Z for UTC):

text
expiry-time="20270131" ssh-ed25519 AAAA... lukas@acme-contract-2026-11

With CtrlOps: Rotate SSH Key in a person's Access panel runs steps 2 to 4 on every server they can reach: paste the new public key, and CtrlOps adds it, then removes the old key only where the new one went in. Add User in SSH Management can Set an expiry, which writes the same expiry-time option. There are no rotation reminders, so keep the dates in your calendar.

Practice 5: Keep Private Keys on Your Own Machine

Private key files (anything without .pub) stay on devices you control: not in Dropbox, Google Drive, iCloud or Notion, and never in a Git repository. Wiz Research's November 2025 investigation of the Forbes AI 50 found verified secret leaks on GitHub at 65% of leading AI companies, buried in deleted forks, gists and commit history.

Set chmod 700 on ~/.ssh and chmod 600 on every private key (the full list is in Practice 10). For backup, copy ~/.ssh/ to an encrypted drive or an end-to-end encrypted password manager, never as plain files to a cloud folder.

Which SSH Clients Sync Your Keys to the Cloud?

Some SSH clients keep credentials only on your computer; others sync them through their own cloud, usually encrypted. Both can be fine if you know which one you use when NDAs, SOC 2 or data residency rules apply.

Termius keeps everything in a local vault on its free Starter plan. Pro and higher plans (from $10/month, billed annually, on the Termius pricing page) add a personal cloud vault that syncs across desktop and mobile, with end-to-end encryption using a key derived from your password.

1Password SSH Agent keeps keys in your end-to-end encrypted 1Password vault, which syncs to your devices, and signs logins for your SSH client; in 1Password's words, "your private key never even leaves the 1Password app."

Cloud-hosted terminals (browser-based SSH clients) route your session through the provider's servers by design, so your keystrokes pass through infrastructure you don't control.

What to check before adopting any SSH client for production use:

  1. Does the tool store or sync private key material outside my machine?
  2. Can I verify where credentials are stored (local filesystem vs. cloud vault vs. SaaS backend)?
  3. Does the tool's architecture satisfy my clients' NDA or compliance requirements?

CtrlOps has no cloud sync: it keeps your key files where they are and saves only their paths, and saved server details and passwords are AES-256 encrypted on your computer. Read more about CtrlOps' local-first SSH security architecture.

Practice 6: Add Key Comments with a Naming Convention

The -C flag adds a comment to the end of a public key. Most developers skip it, and a server's authorized_keys file ends up like this:

text
ssh-ed25519 AAAA...ssh-ed25519 AAAA...ssh-ed25519 AAAA...

Three keys, and no idea whose they are, when they were added, or which machine they came from.

Use one naming pattern for every key, who@device-YYYY-MM:

bash
ssh-keygen -t ed25519 -C "emily@macbook-pro-2026-11"ssh-keygen -t ed25519 -C "deploy@github-actions-2026-11"ssh-keygen -t ed25519 -C "lukas@acme-contract-2026-11"

Now your authorized_keys reads:

text
ssh-ed25519 AAAA... emily@macbook-pro-2026-11ssh-ed25519 AAAA... deploy@github-actions-2026-11ssh-ed25519 AAAA... lukas@acme-contract-2026-11

The name says who to ask, the device which laptop to check after a loss, and the date when the key is due for rotation (Practice 4). Name key files by purpose: client_acme_ed25519, ci_deploy_ed25519. In CtrlOps' SSH Management tab, the comment shows as the key's Public Key Identity.

Practice 7: Copy Keys to Servers Correctly, Not by Hand

Most developers do this once, under pressure, and never document it. Here are the three correct methods, fastest first.

When you already have password access to the server:

bash
ssh-copy-id -i ~/.ssh/id_ed25519.pub username@your-server-ip

This appends your public key to ~/.ssh/authorized_keys on the server, creates the .ssh directory if needed, and sets correct permissions, all automatically.

Method 2: Manual append

bash
# Step 1: Copy your public keycat ~/.ssh/id_ed25519.pub# Step 2: SSH into the serverssh username@your-server-ip# Step 3: Create .ssh directorymkdir -p ~/.sshchmod 700 ~/.ssh# Step 4: Append the public keyecho "YOUR_PUBLIC_KEY_HERE" >> ~/.ssh/authorized_keys# Step 5: Set correct permissionschmod 600 ~/.ssh/authorized_keys

Method 3: Cloud provider dashboard

On AWS, DigitalOcean, Hetzner or Vultr, add your public key in the provider's dashboard before you create the server. It is the cleanest option for new servers.

With CtrlOps SSH Setup Wizard: the wizard shows all three methods with pre-filled commands and a Copy Key button, so there is no hunting for the key file and no typos in a long key string. The CtrlOps first connection guide walks through it.

The full server add and key setup flow from zero:

Practice 8: Manage SSH Access Per User, Not Per Team

Every person who needs SSH access to a server should have their own key pair, with their public key in authorized_keys. No sharing private keys between teammates. This is the rule most small teams break, and the one that hurts most when someone leaves.

Shared team SSH key versus per-user SSH access comparison showing why per-user keys make offboarding and key revocation faster and safer

Shared key scenario (dangerous)

The team creates one team_deploy_key and everyone uses it. A developer leaves. To be safe, you'd have to regenerate the key and redistribute it to everyone still on the team. Nobody does, so the old key stays valid for months or years.

Per-user key scenario (correct)

Each developer has their own key pair. When one leaves, you remove their single entry in 30 seconds, and nobody else is affected.

A clean authorized_keys file looks like:

text
ssh-ed25519 AAAA... emily@macbook-pro-2026-11ssh-ed25519 AAAA... jonas@work-laptop-2026-09ssh-ed25519 AAAA... deploy@github-actions-2026-11

Removing Jonas's access means deleting one line. In CtrlOps' SSH Management tab, each key is its own row with its identity and the system user it can log in as, and Add User creates a person's Linux account, sets its role and authorizes their key in one form.

Practice 9: Revoke Access Immediately When Someone Leaves

Revocation is the step that usually happens late, and until it does, a departed person's key works on every server you gave them. It doesn't take bad intent: their laptop can be stolen or their machine compromised. According to DTEX Systems' 2023 Insider Risk Investigations Report, 12% of employees take sensitive IP with them when they leave an organization.

SSH key revocation workflow for removing a departing developer's key from authorized_keys across every server the same day

The manual CLI revocation process

bash
# SSH into each affected serverssh username@server-ip# Open authorized_keysnano ~/.ssh/authorized_keys# Find and delete the line with their key comment# Save and close# Repeat for every server they had access to

For 8 servers, that is 8 SSH sessions and 8 manual file edits: 20 to 30 minutes that often slip to "I'll do it tomorrow."

With CtrlOps SSH Management

  1. Connect to the server and open the SSH Management tab
  2. Find the departing developer's key by its comment
  3. Click the red trash icon on that row and choose Revoke this key
  4. Click Revoke key to confirm

The key leaves authorized_keys at once, and that person can't connect with it again. Each server takes under 30 seconds, or use Remove from all servers in the Access view to take one person's key off every server at once.

Practice 10: Set Correct File Permissions Every Time

If your key files or .ssh directory are too open, OpenSSH rejects the key, and the error never mentions permissions.

Required permissions:

bash
# Your .ssh directorychmod 700 ~/.ssh# Your private keychmod 600 ~/.ssh/id_ed25519# Your public keychmod 644 ~/.ssh/id_ed25519.pub# The authorized_keys file on the serverchmod 600 ~/.ssh/authorized_keys# The .ssh directory on the serverchmod 700 ~/.ssh

The Chmod Calculator converts between symbolic and numeric notation if the numbers are new to you.

Quick permissions audit:

bash
ls -la ~/.ssh

Anything showing rw-rw-rw- (666) or rwxrwxrwx (777) will cause auth failures. OpenSSH refuses such keys on purpose: a world-readable private key can be copied by any user on that machine.

With CtrlOps: in the File Manager, right-click the server's .ssh folder and click Permissions. Choose Owner only and turn on Apply recursively to everything inside: the folder gets 700 and every file in it, authorized_keys included, gets 600, the same modes as the commands above. For a single file, type the number (644 for a public key) or tick Read, Write and Execute for owner, group and every other account on the Advanced tab. The dialog shows the owner and the rwx string as you change the mode, warns in red before anything becomes world-writable, and won't apply a mode that locks the owner out.

The CtrlOps Permissions dialog on the Advanced tab for a file owned by root:root, showing mode 644 and rw-r--r--, with Read and Write ticked for owner and only Read ticked for group and every other account

When a teammate needs one folder, don't loosen its mode for everyone: Team access in the same menu gives that one person Read or Read / Write on that item only. Both need a root or sudo login and aren't on the Free plan.

On Windows: If ssh-add says it can't connect to the agent, run these commands in PowerShell as Administrator:

powershell
Set-Service -Name ssh-agent -StartupType AutomaticStart-Service ssh-agentssh-add $env:USERPROFILE\.ssh\id_ed25519

Still choosing an SSH client for Windows? Our comparison of SSH clients for Windows covers the options.

For the same discipline host-wide (world-writable files, set-id binaries, the modes on /etc/shadow), see the file system security audit checklist.

Practice 11: Audit Your SSH Keys Every 90 Days

Every 90 days, check which keys exist on each server and why. Most developers add keys when onboarding and never look again, so old keys from past contractors, retired CI systems and replaced laptops stay valid for years.

SSH key audit workflow for reviewing authorized_keys on every server and removing unknown or stale keys every 90 days

Manual SSH key audit on your local machine

bash
# List all key filesls -la ~/.ssh/*.pub# Check what is loaded in the SSH agentssh-add -l# Check key fingerprintsssh-keygen -lf ~/.ssh/id_ed25519.pub

Manual SSH key audit on a server

bash
# SSH in and view all authorized keyscat ~/.ssh/authorized_keys# Count entrieswc -l ~/.ssh/authorized_keys

For each entry, ask: whose key is this, are they still on the project, and does the key still need this access? The free authorized_keys Analyzer lists every key with its fingerprint and options and flags the ones nobody can account for.

In CtrlOps: the SSH Management tab shows a visual registry of each server's keys with counters by type, and its Infra Details tab shows CPU, RAM and disk on the same visit. The Access view lists each person and the servers their key works on, so a key that should be gone stands out.

Practice 12: Use AI to Diagnose SSH Key Errors

Permission denied (publickey) doesn't say whether the key, the permissions, authorized_keys or the daemon config is wrong, so people end up trying old Stack Overflow answers one by one.

With CtrlOps AI Terminal

Open the AI Terminal tab on your connected server and type exactly what is happening:

"I'm getting Permission denied (publickey) when connecting. I've added my Ed25519 public key to authorized_keys but it's still failing."

The AI suggests diagnostic commands for that server, which find the cause: wrong permissions on authorized_keys, PubkeyAuthentication no in /etc/ssh/sshd_config, or a key pasted across two lines. Each command waits for Run or Cancel; with Auto-Run on, read-only commands run by themselves, while sudo and everything else still ask. Web Search lets it check current docs through Tavily, Brave or DuckDuckGo.

To connect an AI, sign in with ChatGPT, use a free OpenRouter model with no API key, add your own OpenAI, Anthropic, Google or OpenAI-compatible key, or run a local model such as Ollama. Requests go straight from your computer to the provider, never through CtrlOps. More in the AI in DevOps guide.

Practice 13: Consider FIDO2 Hardware Keys for Production Access

Standard SSH keys live on disk. With a FIDO2 hardware key, the private key never leaves the physical device.

Standard on-disk SSH keys versus FIDO2 hardware-backed ed25519-sk keys where the private key never leaves the YubiKey

An ed25519-sk key (-sk means security key) is created and stored inside a FIDO2 authenticator such as a YubiKey; your machine holds only a key handle that is useless without it. To log in, you touch the key and the YubiKey signs the server's challenge.

Setup (requires OpenSSH 8.2+ and a FIDO2-compatible hardware key):

bash
# Generate a hardware-backed SSH keyssh-keygen -t ed25519-sk -O resident -C "yubikey-prod-2026"# You'll be prompted to touch your YubiKey during generation# The .pub file goes to the server as normal; the private key stays on the hardware# Copy the public key to your serverssh-copy-id -i ~/.ssh/id_ed25519_sk.pub username@server-ip

The -O resident flag stores the key handle on the YubiKey itself, so you can load the same key on another machine with ssh-add -K.

When to use FIDO2 keys

  • Any production server where a stolen laptop would otherwise mean immediate access
  • Shared workstations or CI runners where multiple people have physical access
  • Any environment where "physical presence required" is a meaningful security constraint

Passphrase-protected Ed25519 keys cover most small teams; for critical production servers, hardware keys are worth the cost. Yubico's OpenSSH integration guide walks through the setup.

Practice 14: Know When SSH Certificates Replace Key Management

Beyond roughly 15 to 20 people, authorized_keys files become their own problem. With SSH certificates, servers trust any certificate signed by a central Certificate Authority (CA), and each developer gets a short-lived certificate, valid from a few minutes to a working day, that expires by itself: no standing access, no per-server key files, no revocation step.

For a solo developer or a team of 5, per-user keys with manual revocation (Practices 8 and 9) are enough; for a 30-person org with 80 servers, certificates are the right answer. If you keep forgetting to revoke keys, or auditing authorized_keys feels unmanageable, look at an SSH CA. HashiCorp Vault's SSH secrets engine can act as that CA and sign short-lived certificates. AWS Systems Manager Session Manager takes another route: it replaces SSH keys with IAM-controlled sessions, a trade-off covered in our web-based vs. local SSH clients comparison.

Three kinds of tools cover the 14 practices: OpenSSH itself, free browser tools for one-off jobs, and a desktop app when you manage keys on several servers. Start with OpenSSH, which is free and already installed, and add a tool only where it saves steps. Here is what each one covers, CtrlOps included, with its limits.

OpenSSH built-ins

CommandWhat it does in this guide
ssh-keygenCreates keys (Practice 1), changes a passphrase with -p (Practice 3) and prints fingerprints with -lf (Practices 4 and 11)
ssh-copy-idAdds a public key to a server (Practices 4 and 7)
ssh-addLoads keys into the agent, and unloads them with -d (Practices 2 and 3)
sshd -tTests sshd_config before a restart (Practice 1)
expiry-timeRetires a key in authorized_keys on a set date (Practice 4)

Free browser tools

CtrlOps

CtrlOps is a desktop app for macOS (Apple Silicon and Intel), Windows and Linux. It connects to any Linux server with SSH enabled (AWS, DigitalOcean, Hetzner, Vultr, bare metal), with no agent on the server. For SSH keys it adds:

  • SSH Setup Wizard: generates an Ed25519 key and shows three ways to put it on a server.
  • SSH Management tab: every authorized key on a server; Add User creates the account, sets its role and authorizes the key in one form.
  • Access: each person and the servers their key works on, with Rotate SSH Key and Remove from all servers.
  • AI Terminal: diagnoses SSH errors and asks before each command, with Web Search and a Script Directory for reusable hardening scripts.
  • Security Audit: checks root login, password authentication and authorized_keys permissions, with a hardening score, a PDF report and AI-written fixes you approve.
  • File Manager and Backups: set .ssh to 700 and its files to 600 with the Permissions dialog, share one folder with a teammate through Team access, edit sshd_config without an SFTP app, and back up server folders to S3-compatible storage.
  • Local-first security model: key files stay where they are and nothing syncs to a CtrlOps cloud.
What you needCtrlOps featureTime with CtrlOpsTime manually
Generate Ed25519 keySSH Setup WizardUnder 2 minutes5 min + docs lookup
Copy key to serverWizard, one-click copyUnder 2 minutes10 min including errors
Rotate a person's keyAccess, Rotate SSH KeyOne paste for all their servers5 commands per server
Revoke a departing dev's keySSH Management tab, trash icon30 seconds per server5 min per server
Audit all keys on a serverSSH Management tab, visual registry2 minutes10 min per server
Diagnose SSH auth errorsAI Terminal, Run or Cancel per commandUnder 5 minutes30 to 60 min on Stack Overflow
Fix permissions or config filesFile Manager, Permissions and editorUnder 2 minutes10 min via terminal

Comparing desktop SSH clients on a Mac? The guide to the best SSH clients for Mac in 2026 covers your options in detail.

CtrlOps pricing

  • Free: up to 2 servers, with no end date. The SSH key wizard is included; SSH Management shows 2 users per server.
  • Personal: $9 a month or $90 a year (2 months free), with unlimited servers and a 14-day free trial, no credit card.
  • Lifetime: $349 once for one seat, with unlimited servers, updates for life and a 14-day refund.
  • Team: $39 a month, or $849 once, for 5 seats.

See CtrlOps pricing.

Run this checklist every 90 days and after every team or project change. It has 8 checks for your own computer, 7 for each server and 5 events that can't wait for the next audit. Most checks only read files, so a full pass takes about 15 minutes per server.

On your local machine

  • List all key pairs: ls -la ~/.ssh/*.pub
  • Check agent contents: ssh-add -l
  • Verify every key has a comment that follows your naming pattern
  • Confirm chmod 700 ~/.ssh and chmod 600 on all private keys
  • Confirm no private keys are in any cloud-synced folder
  • Confirm a passphrase on all non-automation keys
  • Rotate automation keys older than 90 days (Practice 4)
  • Delete or archive keys for projects that ended more than 90 days ago

On each server

  • View all authorized keys: cat ~/.ssh/authorized_keys
  • Count entries: wc -l ~/.ssh/authorized_keys
  • Confirm you can identify every entry's owner
  • Remove any key without a clear owner
  • Verify chmod 600 ~/.ssh/authorized_keys
  • Verify chmod 700 ~/.ssh
  • Check PubkeyAuthentication yes in /etc/ssh/sshd_config

After team or project events: do these immediately, not later

  • Developer leaves: revoke their key from all servers the same day
  • Laptop stolen or lost: revoke all keys associated with that device immediately
  • Key may have leaked: rotate it at once (Practice 4)
  • Project ends: remove your key from the client's servers before the final invoice
  • Contractor engagement ends: revoke access before or alongside the final payment

SSH key management best practices are a routine, not a one-time setup: the right key type, private keys kept local, passphrases, per-user access, rotation on a schedule and same-day revocation. Most of the 14 practices take under 10 minutes the first time, and the audit takes about 15 minutes per server every 90 days.

Start with the three highest-impact changes: Ed25519 keys, passphrases on all personal keys, and one key per person with a real revocation process. Then a stolen laptop or a departed developer no longer means a security incident. To revoke keys in a few clicks instead of an SSH session per server, CtrlOps' SSH Management module costs $9 a month or $349 once, with a 14-day free trial.

06

FAQ

  • Ed25519 is the best SSH key type in 2026 for almost every use: short keys, a security level similar to RSA 3072, and a design that resists timing attacks. Use RSA 4096 only for a legacy system that can't accept Ed25519, which is rare since OpenSSH added it in version 6.5 (2014).
  • Create one Ed25519 key pair per client, such as client_acme_ed25519, and map it to that client's servers with IdentityFile in ~/.ssh/config. A compromised key then affects one client, not your whole portfolio, and when a project ends you remove just that key from the client's servers.
  • Run ssh-keygen -p -f ~/.ssh/your_key_name and press Enter at the new passphrase prompt. Do this only for a dedicated automation key; for daily use, load your key with ssh-add so you type the passphrase once per session.
  • From a server, delete the key's line from ~/.ssh/authorized_keys (in CtrlOps, click the red trash icon on its row and choose Revoke this key). The server refuses the key from then on, with no restart.

    From your local machine, unload it with ssh-add -d ~/.ssh/your_key_name and delete both key files. shred -u overwrites a file before deleting it, but the GNU shred manual warns that SSDs and journaling file systems can keep old copies, so full-disk encryption (FileVault, BitLocker or LUKS) is what really protects a deleted key.

  • Private key chmod 600, ~/.ssh/ directory chmod 700, and authorized_keys on the server chmod 600. If they are wrong, OpenSSH rejects the key with "Permission denied (publickey)" even though the key itself is fine.
  • Rotate CI/CD and other automation keys every 90 days, personal keys once a year, and any key at once when someone leaves, a laptop goes missing or a key may have leaked. Always add the new key and test it before you remove the old one; Practice 4 shows the five commands.
  • A password manager such as 1Password keeps SSH keys in an end-to-end encrypted vault that syncs to your devices, which is far safer than a plain file in Dropbox or iCloud. If a contract says keys may exist on one device only, use local key files with an encrypted backup instead.
  • Only when you can't set up keys yet, for example on first access to a new server. Once key login works, set PasswordAuthentication no in /etc/ssh/sshd_config to stop password brute-force attacks.
  • Without a passphrase, every server that trusts those keys is at risk right away, so remove the laptop's public keys from authorized_keys on every affected server from another machine. With per-machine keys, only that laptop's servers are exposed; with one key for everything, you revoke access everywhere.
  • Termius keeps data in a local vault on its free Starter plan; paid plans add a personal cloud vault that syncs across desktop and mobile with end-to-end encryption. CtrlOps has no cloud sync: key files stay where they are and server details are encrypted on your computer. Pick Termius to have your servers on your phone too, or CtrlOps for no copy outside your devices plus SSH Management, an approval-gated AI Terminal and backups. CtrlOps is free for up to 2 servers, then $9 a month or $349 once (CtrlOps vs Termius).
  • ssh-copy-id -i ~/.ssh/id_ed25519.pub username@server-ip adds your public key to a server's authorized_keys, creating the directory and setting permissions in one step. Use it when you can already log in with a password or another key; otherwise append the key by hand and set chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys.
  • One key for everything, keys without a passphrase, shared team keys, keys left behind after people leave, private keys in cloud folders or Git, wrong permissions, and keys with no comment. Each one maps to a practice in this guide, and the audit checklist catches most of them in one pass.

Was this guide useful?

One click helps us decide what to test and write next.

Share this post

Explore article with AI tools

Written by

Hiren Kalariya

Co-Founder & CEO, TST Technology

Hiren Kalariya is the Co-Founder and CEO of TST Technology and the product lead behind CtrlOps, a local-first desktop app that makes Linux server management fast and easy for developers and DevOps teams. Over the past five years he has shipped 60+ production systems, and he still tests every tool he writes about on real servers.

Keep reading

Your privacy preferences. We use product analytics to improve CtrlOps. Google Analytics cookies and live chat stay off until you allow them. Cookie policy