To enable SSH key login, create or locate a key pair on your computer, copy the public key to the server account you will use, and save it in that account’s accepted-key file. Keep the private key on your computer. For a typical OpenSSH account, the destination is ~/.ssh/authorized_keys; Windows OpenSSH servers use a different path for administrator accounts.
Know which key goes where
An SSH key pair has a public half and a private half. The public key is usually the file ending in .pub; it is the part you install on the server. Keep the matching private key on your client and do not copy it to the server. The public-key file’s contents are added to authorized_keys on each account where that key should permit login. See the OpenSSH ssh-keygen manual.
As an Amazon Associate I earn from qualifying purchases.
This is your user-authentication key, not the server’s host key. Host keys identify the server to clients; your public key lets the server authorize your account.
Generate a key or find one you already have
On Linux, macOS, or Windows with OpenSSH installed, run ssh-keygen and follow the prompts to select a save path and passphrase. If you already have a key pair, locate its matching public-key file rather than generating another unnecessarily. Keep the private key protected on the client; a passphrase can add protection if the private-key file is exposed.
#1 Best Overall
- 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.
Key algorithms and accepted policies depend on the installed OpenSSH version and the server’s configuration, so follow your organization’s requirements rather than assuming one algorithm works everywhere. Microsoft’s Windows guidance documents ssh-keygen and lists DSA, RSA, ECDSA, and Ed25519 support; it identifies Ed25519 as the default when no algorithm is specified. See Microsoft’s OpenSSH key management guide.
Install the key on a standard OpenSSH account
For a typical OpenSSH account, add the complete public-key line to ~/.ssh/authorized_keys in the target user’s home directory. The file is plain text with one key per line. Preserve the full line; its key type and encoded key are essential, while any trailing comment is just an identifier.
Rank #2
- 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
- Connect to the server using a password or another authorized method, or have an administrator do this for you.
- Create the directory if needed:
mkdir -p ~/.ssh. - Append the public key: use a trusted transfer method such as
scpor paste the public-key line into~/.ssh/authorized_keysin an authorized server session. Append it rather than overwriting existing keys. - Restrict access: OpenSSH recommends that the
.sshdirectory andauthorized_keysfile not be accessible by other users. On a Unix-like OpenSSH server, a common setup ischmod 700 ~/.sshandchmod 600 ~/.ssh/authorized_keys. The server’s policy and configuration are authoritative.
If your client has ssh-copy-id, it can copy a public key to an OpenSSH account when you have an initial login method. It is a convenience, not a requirement. The server may use another location through its AuthorizedKeysFile setting, or the account’s home directory may differ from the usual layout. Check the server configuration or ask its administrator if the default path does not work. OpenSSH documents the file format and permission checks in its sshd manual.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteUse the right key-file path on a Windows OpenSSH server
First ensure that OpenSSH Server is installed, the sshd service is running, and the inbound firewall rule permits SSH connections. Windows installation state and setup steps depend on the Windows release; Microsoft documents these in its OpenSSH installation and first-use guide.
Rank #3
- 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
The accepted-key file depends on the Windows account type:
| Windows account | Public-key file | Access rule |
|---|---|---|
| Standard user | C:Usersusername.sshauthorized_keys |
Use permissions that prevent other users from accessing the key file. |
| Member of the local Administrators group | C:ProgramDatasshadministrators_authorized_keys |
Allow only NT AuthoritySYSTEM and BUILTINAdministrators. |
For an administrator account, do not put the key only in the user profile’s .sshauthorized_keys; Windows OpenSSH uses the shared administrator key file instead. Microsoft provides the icacls command for setting that file’s required ACLs. Follow the account-specific instructions in Microsoft’s key management guide; Unix chmod permissions do not replace Windows ACLs.
Rank #4
- 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.
Microsoft documents this key-based flow for local and Active Directory accounts, but not Microsoft Entra ID accounts. Windows OpenSSH also does not support AuthorizedKeysCommand or AuthorizedKeysCommandUser; these are Windows-specific limitations, not general OpenSSH rules.
Test the connection
From the client, connect with the account name and server address:
Best Value
- 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.
ssh username@server
If the private key is not in a default location or loaded into an agent, specify its path with -i:
ssh -i path/to/private_key username@server
Replace the example username, server, and key path with your actual values. If the connection is rejected, client-side verbose output can help reveal what is happening:
ssh -v username@server
Fix “Permission denied (publickey)”
Check the cause on the server side first, then confirm you are connecting as the intended account:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute- Wrong username: the key must be installed for the same account named in the SSH command.
- Wrong key-file path: confirm the account’s actual home directory and the server’s
AuthorizedKeysFilesetting. On Windows, check whether the target is a standard user or a local administrator. - Incomplete public-key line: make sure the full line from the client’s
.pubfile appears in the accepted-key file as a single line, without wrapping, truncation, or accidental edits. - Permissions or ACLs: ensure the server accepts the ownership and access settings on the key file and its containing directory. For a Windows administrator key file, check the specified SYSTEM and Administrators ACLs.
- Wrong private key offered: if you have several keys, try the matching private key explicitly with
-i.
Microsoft’s OpenSSH connection troubleshooting guide lists missing or incorrect authorized_keys files and improper permissions among causes of public-key authentication failures.
Quick Recap
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.




