October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Cupertino desk5 min

Set Up SSH Keys on a Mac: A Safer Way to Connect

Set up SSH key authentication on a Mac with an Ed25519 key, Keychain storage, and clear steps for authorizing the public key or enabling Remote Login.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To set up SSH key authentication on a Mac, create a key pair in Terminal, protect the private key with a passphrase, add it to macOS’s SSH agent and Keychain, then authorize the matching public key with the remote account or service. Creating a key does not grant access by itself. For routine SSH logins, keys avoid repeatedly sending a reusable account password—but the private key needs protection, and password-based recovery may still be necessary.

What SSH keys do—and what they do not do

SSH uses a pair of related keys. The private key stays on your Mac and proves your identity; the public key is installed with the remote account or service you want to access. When the server accepts the matching key, you can authenticate without entering that account’s password for each login.

As an Amazon Associate I earn from qualifying purchases.

Never share or upload the private key. When a service asks for an SSH key, it normally wants the contents of the file ending in .pub. A strong passphrase protects the private key if someone obtains the file. It is different from your remote account password: the passphrase unlocks the local key, while the public-key exchange authenticates to the remote service.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Keys are not a reason to assume passwords should never be used anywhere. You may still need an account password for recovery or other access methods. And a key cannot protect you if your Mac or an unprotected private key is compromised.

#1 Best Overall
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

How to create an SSH key on a Mac

1. Check for keys before generating one

Open Terminal and list the files in your SSH directory:

ls -la ~/.ssh

If you already have a working key, do not overwrite it. The usual Ed25519 key pair uses id_ed25519 and id_ed25519.pub. If those files exist, choose a distinct filename when generating a new key.

2. Generate an Ed25519 key pair

For a new key using the default filename, run:

ssh-keygen -t ed25519 -C "[email protected]"

Replace the example with an identifying email or label. When prompted for a file location, accept the default only if it will not replace a key you need; otherwise enter a new path, such as /Users/yourname/.ssh/id_ed25519_work. Enter a strong passphrase when prompted. The command creates a private key and its corresponding .pub public key.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
UANTIN USB C Hub, 7 in 1 Multiport Adapter for Laptop/Mac Type C Devices
  • 【7-in-1 Mass Expansion】USB C hub for laptops easily expands USB-C/Thunderbolt 3-4 ports into 1 HDMI port, 3 USB-A ports, 1 SD/TF card reader slot, and 1 USB-C PD port, providing excellent connectivity to meet all of your expansion needs at the same time, and greatly improving work efficiency.
  • 【4K Visual Feast - USB C to HDMI Hub】Easily connect 4K@30Hz HD video to any monitor, TV or projector by mirroring or expanding the screen with the USB Type C to HDMI adapter. Compatible with 1080p@120Hz high refresh rate, the clear and smooth video transmission will bring the ultimate viewing experience to your eyes.
  • 【Fast Charging - 100W PD IN】USB C Dongle provides up to 100W of ultra-fast power pass-through to safely power your MacBook Pro/Air and other USB-C laptop without worrying about running out of power, while providing additional power to connected USB peripherals
  • 【Efficient - Fast Data Transfer】USB C Hub Multiport adapter is equipped with multiple fast and stable data transfer ports.USB 3.0 supports up to 5Gbps for high-speed file transfer. USB 2.0 supports 480Mb/s for connecting various USB devices without delay.SD/TF card slot allows Quick access to files for viewing your photos or videos, ideal for photographers, designers or video editors
  • 【UANTIN: Elevating Connections in Work and Life】The 7-in-1 USBC Hub is plug and play and requires no drivers. We provide high quality products that combine sophistication with affordability to help you enhance your work and personal life. We are committed to providing fast response support within 24 hours. Please feel free to contact UANTIN.

These steps follow GitHub’s Ed25519 key-generation guidance; other SSH services can accept the same key type, but their authorization steps may differ. See GitHub’s guide to generating an SSH key and adding it to the agent.

Add the key to the macOS agent and Keychain

The SSH agent can hold an unlocked key for use by SSH clients. macOS Keychain can remember the key’s passphrase so you do not have to enter it every time. For a key with the default filename, run:

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

If you chose a different filename, substitute that path. GitHub also documents these settings in the SSH client configuration file ~/.ssh/config for its own host:

Rank #3
Sale
Syntech USB C to USB Adapter Pack of 2, USB 3.0 to Thunderbolt 5/4 Adapter
  • Materials and Design: The adapter is made with anti-interference zinc alloy metallic housing and minimalist design with anti-slippery embossments
  • Connectors: Engineered for enhanced durability, the male USB C and female USB3 connectors are designed to be plugged and unplugged up to 10000 times
  • Compatibility: This USB C to USB 3.0 adapter is compatible with iPhone 17/17e/17 Air/17 Pro/17 Pro Max and MacBook Pro after 2016 and MacBook Air after 2018 and most of the laptops, tablets and smartphones with a USB Type C port
  • USB 3.0 Speed in Two: Came in two fast speed adapters in data transfer and charging with premium materials. A foam container is also included for storage and travel
  • Compact and Easy to Use: Plug and play, no driver required; Simple structure, lightweight and portability; Also, you can sync or charge your phone with this USB C to USB adapter
Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

For another destination, change Host to its hostname and IdentityFile to your actual private-key path. Do not copy the GitHub host line unchanged for a different server. GitHub notes that macOS’s bundled ssh-add supports the --apple-use-keychain option.

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

Authorize the public key with the destination

Copy only the public key’s contents. For the default filename, display it with:

cat ~/.ssh/id_ed25519.pub

For a custom filename, use its corresponding .pub path. Add that text wherever the destination accepts public keys. A code-hosting account typically provides an SSH keys page; a server account generally requires the public key to be added to that user’s authorized_keys file. The exact process depends on the service and server configuration. If you do not administer the server, follow the provider’s instructions or ask its administrator.

Rank #4
Hiearcool 7-in-1 USB C Hub, USB C Dongle Compatible for MacBook, Space Gray
  • One Hub for Work, Meetings & Daily Use: Expand your MacBook or USB-C laptop with HDMI, USB 3.0, PD charging, and SD/TF card slots — ideal for office work, online meetings, presentations and multitasking setups.
  • 4K HDMI for Clear Presentations & Home Viewing: Connect to monitors, projectors or TVs with 4K@30Hz output for smooth video, making it perfect for conferences, teaching, design review and family entertainment.
  • 100W USB-C PD Pass-Through Charging: Power your laptop while using multiple devices without losing performance — stable for long meetings, work sessions and business travel.
  • High-Speed Data Transfer & Card Reading: USB 3.0 ports deliver up to 5Gbps transfer speed; SD/TF card readers support quick access to photos, videos and files — great for content creators and photographers.
  • Compact, Travel-Ready & MacBook-Optimized: Aluminum build enhances heat dissipation. Lightweight design fits easily into bags for work, home, school or travel — optimized for MacBook,Dell,HP,Lenovo,Microsoft,Asus and more.

Keep the private-key file—the one without .pub—on your Mac. Do not paste it into a website, send it to an administrator, or add it to an account’s public-key form.

Test the SSH connection

Use the destination’s normal SSH command, replacing the example username and hostname:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

If the server still prompts for the remote account password, check that the public key was authorized for the same user you are connecting as, that SSH is offering the intended private key, and that the server permits public-key authentication. A password prompt does not by itself mean the key pair is invalid.

Best Value
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Connecting into your Mac is a separate setting

Creating a key lets your Mac authenticate to another system; it does not make the Mac accept incoming SSH connections. To allow another computer to connect to the Mac, use Apple’s Remote Login setting:

  1. Open the Apple menu and choose System Settings.
  2. Choose General, then Sharing.
  3. Click the information button beside Remote Login and turn Remote Login on.
  4. Under “Allow access for,” choose “Only these users” and select the permitted accounts when practical.

Apple displays an SSH command you can use from the other computer. Its example supports connecting to the Mac, but enabling Remote Login does not automatically install a public key or disable password authentication. Apple warns: “Allowing remote login to your Mac can make it less secure.” Do not enable full disk access for remote users unless the task specifically requires it. Read Apple’s Remote Login guidance before enabling inbound access.

Optional: use a FIDO2 security key

A hardware-backed FIDO2 SSH key is an advanced alternative to a file-based Ed25519 key, not a requirement for ordinary SSH use. Yubico documents SSH support for its YubiKey 5 Series and says FIDO2 SSH requires OpenSSH 8.2 or later. It also notes that the OpenSSH bundled with macOS lacks FIDO support; this approach therefore requires a compatible OpenSSH installation, such as one installed through Homebrew, placed ahead of the system version in your PATH.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Consideration File-based Ed25519 key FIDO2 hardware-backed key
Compatibility Uses the standard SSH key workflow documented for macOS by GitHub. Requires compatible OpenSSH; Yubico says macOS’s bundled version lacks FIDO support.
What you need The private-key file on your Mac and its passphrase. A compatible OpenSSH setup and the security key when authenticating.
Setup Generate the key, add it to the agent, and authorize its public key. Additional software and hardware setup; follow the vendor’s instructions.
Lost-key recovery Recovery depends on whether you have a secure backup and can authorize a replacement key. Recovery depends on the service’s supported recovery process and whether another key or access method is available; no universal recovery standard is established here.

These are different setup paths, not a measured security comparison. See Yubico’s SSH documentation for its compatibility and product details.

Do not disable server password authentication casually

Using a key from your Mac does not require changing the server’s authentication policy. Disabling password authentication is a separate server-administration decision, not a step in client-side key setup. A misconfiguration can lock you out. Only consider changing that policy if you administer the server, have verified a second login with the key, and have a backup access path; consult instructions for that server’s operating system.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.