October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Set Up SSH Keys and Manage Them Safely

A practical OpenSSH setup guide: check for existing keys, generate a supported pair, protect it, register its public key, and manage access over time.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To set up SSH access, first check for an existing key, create or select a key pair your service supports, protect the private key with a passphrase, load it into an agent if useful, and add only the public key to your account or server. Then test the connection and keep track of which key belongs to which device and purpose. The commands below are OpenSSH examples; account steps and supported algorithms depend on the service and your operating system.

Before you create a key, check what you already have

Creating another key is not always necessary. An existing pair may already be suitable, and generating a key under a filename that exists can overwrite it. GitHub recommends checking for existing keys first; see its guide to checking for SSH keys. If you do not know what an existing key is used for, do not overwrite it. Choose a new filename when generating a separate pair.

As an Amazon Associate I earn from qualifying purchases.

A key pair has two parts: the private key remains on your computer, while the public key is registered with the service or server you want to access. Never upload or send the private key.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose an algorithm the service and client support

For GitHub’s documented OpenSSH workflow, the default example uses Ed25519. The guide gives RSA with a 4096-bit key as an option for legacy systems that do not support Ed25519. These are examples for that workflow, not a guarantee that every server or client accepts both. Check your target service’s current requirements before choosing.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Generate an Ed25519 key

  1. Open a terminal and run ssh-keygen -t ed25519 -C "[email protected]", replacing the example email with an identifier you recognize.
  2. When prompted for a file location, accept the default only if it will not overwrite a key you need. Otherwise, enter a distinct path and filename.
  3. Set a passphrase when prompted. Keep the resulting private key on this device.

Generate an RSA key for a legacy system

If the client or system does not support Ed25519, GitHub’s guide gives this example: ssh-keygen -t rsa -b 4096. Confirm that RSA is accepted by the service you are connecting to.

For GitHub’s full command flow and platform-specific notes, consult Generating a new SSH key and adding it to the ssh-agent.

Rank #2
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Protect the private key with a passphrase

A passphrase adds protection if someone gains access to the computer holding the private key. It is separate from your account password, and it does not make the key safe to share. GitHub explains the role of a passphrase in its SSH key passphrase guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can change the passphrase on an existing key without creating a new pair. For the default Ed25519 path, run ssh-keygen -p -f ~/.ssh/id_ed25519. Substitute the actual private-key path if you used a different filename.

Rank #3
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Use ssh-agent to reduce repeated passphrase prompts

ssh-agent can hold an unlocked key for use by SSH clients, so you do not need to enter its passphrase for every operation. It does not replace a passphrase or change where the private key should be stored.

Agent startup and key loading differ by platform. GitHub’s setup guide has separate instructions for macOS Keychain integration, Windows OpenSSH service setup, and Unix-like systems. Follow the section matching your environment rather than treating one startup command as universal. On Windows, Git for Windows may use its bundled ssh.exe, which can fail to communicate with keys held by the Windows OpenSSH agent; GitHub documents configuring Git to use the system SSH binary in that situation.

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Register the public key with the service

For GitHub, the public key must be added to your GitHub account before it can authorize SSH access. The public key is typically the file with the .pub suffix; the private key has no such suffix by default. Use GitHub’s instructions for adding a new SSH key and follow the service’s current account interface. For another hosting service or server, use its own public-key registration procedure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test access and identify the key you are using

After registration, test the connection using the target service’s current instructions. If access fails, establish which SSH executable and agent your shell or Git client is using, then compare the local key or fingerprint with the key registered to the account. A mismatch between the SSH binary and agent can make an otherwise correctly registered key appear unavailable.

Best Value
FIDO2 U2F Security Key Passkey Two-Factor Authentication (2FA) USB Key PIN+Touch (Non-Biometric) USB-A Type TrustKey T110
  • Security Key : Protect your online accounts against unauthorized access by using FIDO2 and U2F authentication with T110. It's the world's most protective security key that works with windows, Mac OS, Linux as well as Chrome, Firefox, Edge and many other major browsers.
  • Certified with the new FIDO2 standard, T110 provides the benefit of fast login and strong protection against phishing, account takeover as well as many other online attactks.
  • Works with : Bank of America, Github, Google, Microsoft, DUO, Twitter, Facebook, Dropbox, Apple, ebay, BINANCE, mor and more.
  • Fits USB-A port : Insert the T110 security key into the USB-A port of each service and log in conveniently with one touch
  • For the driver download and user guide, please visit TrustKey Solutions Home support page.

A SHA-256 fingerprint identifies a key without revealing the private key. To list fingerprints available to the agent, run ssh-add -l -E sha256. Compare the result with the account’s key listing, and keep a record of the machine and purpose for each key.

Review, remove, or replace keys as circumstances change

Review the keys registered to your account periodically. Remove entries you do not recognize, no longer use, or no longer trust; treat a compromised key as untrusted and revoke it promptly. GitHub’s key review guidance explains how to inspect associated keys. A fingerprint helps you identify which key an entry represents without exposing its private contents.

Consider hardware-backed keys only if your setup supports them

OpenSSH supports hardware-backed key types such as ed25519-sk; GitHub also documents ecdsa-sk for hardware that does not support Ed25519. The physical security key must be connected when authenticating. Compatibility depends on the security key, OpenSSH build, operating system, and target service, so verify all of those before relying on this route.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.