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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Open Terminal and run ssh-keygen -t ed25519 -C "you@example.com". Press Enter to accept ~/.ssh/id_ed25519, create a passphrase, and copy only ~/.ssh/id_ed25519.pub to the VPS account’s ~/.ssh/authorized_keys. Keep the matching private key, ~/.ssh/id_ed25519, on your Mac.

Once the public key is installed with the correct server-side permissions, test with ssh user@server.example. A password prompt after setup usually means the wrong username, address, key filename, public-key line, or server permissions—not that the key pair itself is invalid.

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

What an SSH key pair does

SSH (Secure Shell) public-key authentication uses two mathematically related files. The private key proves your identity and must remain under your control. The public key is safe to place on systems you want to access. During login, your Mac uses the private key to answer a cryptographic challenge; the VPS checks that proof against a public key listed for the target account.

The files are a pair, but they do not have equal sensitivity. Anyone who obtains the private key may be able to authenticate as you, especially if it has no passphrase. The .pub file contains only the public half and is the file you install on the server. Never upload, email, paste into a ticket, or otherwise disclose the private-key file.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

macOS includes the OpenSSH client and the ssh-keygen utility, so no separate SSH package is required for the standard workflow. DigitalOcean’s OpenSSH instructions, marked last verified 13 July 2026, use Ed25519 as the modern default and recommend protecting the private key with a passphrase.

Before you start

  • A Mac account with access to Terminal.
  • The VPS provider’s server address (an IP address or DNS name) and the login username. The username may be root, an administrator account, or a provider-created account; it is specific to the VPS image.
  • A way to authenticate once while installing the key, normally an existing password login, a provider web console, or an image-provisioning screen that accepts an SSH public key.
  • A plan for storing the passphrase. A password manager is preferable to an unencrypted note.

Have the exact target account in mind. A key placed in one user’s home directory does not automatically authorize another user. For example, a key in /home/alice/.ssh/authorized_keys authorizes Alice, not Bob or root.

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

Generate an Ed25519 key on macOS

  1. Open Terminal

    Open Applications → Utilities → Terminal, or press Command–Space and search for “Terminal.”

  2. Run ssh-keygen

    ssh-keygen -t ed25519 -C "you@example.com"

    The -t ed25519 option selects the Ed25519 algorithm. The -C value is a comment to help you identify the key later; it is not an authentication secret. Replace the example address with a useful label, such as the Mac’s name or the account that owns the key.

  3. Choose the file name

    When prompted with a path similar to Enter file in which to save the key (/Users/yourname/.ssh/id_ed25519):, press Enter to use the default. OpenSSH expands ~ to your macOS home directory, so the files will be in /Users/yourname/.ssh/.

    If that path already contains a key you still use, do not overwrite it. Type a new path such as ~/.ssh/vps_production_ed25519. The private and public files will then use that base name, with .pub appended to the public file.

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

    Enter a strong passphrase when prompted, then enter it again. A passphrase encrypts the private-key file at rest; someone who copies the file from your Mac still needs the passphrase to use it. Leaving the prompt empty is possible, but it removes this protection. Use a unique passphrase rather than your macOS login password.

  5. Confirm the result

    A successful run reports that the identification (private key) and public key were saved. You can list the directory without printing secret material:

    Rank #2
    Sale
    Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
    • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
    • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
    • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
    • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
    • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
    ls -la ~/.ssh

    You should see the private file and a matching .pub file. Do not use cat on the private file when copying or troubleshooting.

Where macOS stores each file

Path Role How to handle it
~/.ssh/id_ed25519 Ed25519 private key Keep on the Mac; protect with a passphrase and restrictive permissions. Never copy it to the VPS.
~/.ssh/id_ed25519.pub Matching Ed25519 public key Copy this one-line file to the target account’s authorized_keys.
~/.ssh/vps_name_ed25519 Private key when you selected a custom name Keep private; specify it with ssh -i or an SSH config entry.
~/.ssh/vps_name_ed25519.pub Public key for the custom-name pair Install this matching .pub line on the VPS.

The tilde is shorthand for your current macOS user’s home directory. It is not the VPS path. On the server, the equivalent directory is usually ~/.ssh relative to the account you are configuring, such as /home/alice/.ssh.

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.

Ed25519 or RSA?

Ed25519 is the concise modern default in the documented OpenSSH workflow. RSA remains useful when a legacy SSH server, appliance, or provider specifically requires it. Because the VPS software version and policy are not known in advance, confirm algorithm support with the provider’s image documentation before choosing a fallback.

Consideration Ed25519 RSA
Modern-default status Recommended default for current OpenSSH deployments. Legacy-compatible fallback when required.
Compatibility Requires a server and client that support Ed25519. Supported by many older SSH implementations; provider policy may require a minimum size.
Generation example ssh-keygen -t ed25519 -C "you@example.com" ssh-keygen -t rsa -b 4096 -C "you@example.com" when the server specifically calls for RSA.
File handling Private key and matching .pub file are handled the same way as RSA. Private key and matching .pub file are handled the same way as Ed25519.

Do not generate RSA merely because it is familiar. Use it when compatibility evidence points that way, and keep the same private-key handling rules.

Install the public key on the VPS

The key must be added to the target account’s ~/.ssh/authorized_keys. Uploading the .pub file somewhere else on the VPS does nothing. Each authorized key occupies one complete line; preserve the line from its beginning (for example, ssh-ed25519) through its comment.

Method 1: pipe the public key over an existing SSH login

If password authentication already works for the target account, run this on your Mac, replacing both values:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cat ~/.ssh/id_ed25519.pub | ssh user@server.example "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

The first cat reads the public file locally. SSH sends it to the command running on the VPS. mkdir -p creates the server-side directory if needed, and >> appends the key rather than replacing existing keys. You will be asked for the VPS account password unless another authentication method is already active.

For a custom local key name, change only the local path:

Rank #3
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.
cat ~/.ssh/vps_production_ed25519.pub | ssh user@server.example "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Method 2: use ssh-copy-id when available

Some macOS installations or administrator toolsets include ssh-copy-id. If the command exists, it can install the public key for you:

ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server.example

If Terminal reports that ssh-copy-id is not found, use the pipe method or the provider console instead. Do not install an unrelated copy of the private key to make this command work.

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

Method 3: paste through a provider console

When password SSH access is disabled, open the VPS provider’s browser console or recovery terminal and log in as the intended account or an administrator. On your Mac, display only the public key:

cat ~/.ssh/id_ed25519.pub

Copy the single line. On the VPS, create the directory and open the file with an editor:

mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys

Paste the line on its own line, save, and exit. If the console uses a different account, place the key in the target user’s home directory and correct ownership before testing.

Set the VPS permissions

OpenSSH can reject keys when the SSH directory or authorized-key file is writable by other users. On the VPS, run:

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.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

The account must also own the directory and file. If you installed the key as an administrator for another account, verify ownership with the VPS operating system’s normal account-management tools and correct it according to that system’s documentation. A root-owned file in another user’s home directory can prevent that user’s key login even when the contents are correct.

Do not loosen permissions as a workaround. The restricted modes above are the documented baseline: the account can access its SSH directory and read its authorized-key file, while other users cannot modify them.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Test the key-based connection

  1. Use the target username and address

    ssh user@server.example

    Replace user and server.example with the values for your VPS. A correct key cannot authenticate the wrong account.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. Handle the first-connection authenticity prompt

    On a first connection, SSH may say that the authenticity of the host cannot be established and display a fingerprint. Verify that fingerprint through the VPS provider’s trusted control panel or console before accepting it. The prompt confirms that you are recording a host key; it does not prove that the server is the one you intended to rent.

  3. Supply a custom private-key path when necessary

    ssh -i ~/.ssh/vps_production_ed25519 user@server.example

    Use the private file, not the .pub file, with -i. The SSH client will derive or locate the corresponding public identity as needed.

  4. Check the expected result

    With the correct key and server configuration, SSH logs you in after asking for the key’s passphrase (if one exists), rather than the VPS account password. A shell prompt on the VPS confirms the login; run whoami and hostname if you need to verify the account and machine.

Use ssh-agent for repeated connections

A passphrase protects the private file, but entering it for every connection is inconvenient. An SSH agent can hold an unlocked key in memory and answer signing requests without exposing the private key to the server. Add your key to the agent with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

On macOS versions where that option is unavailable, use ssh-add ~/.ssh/id_ed25519. The command asks for the passphrase once for the agent session. You can inspect loaded identities with:

ssh-add -l

If you use a custom filename, substitute it in both commands. Treat an unlocked agent as a convenience, not a replacement for device security: anyone controlling your logged-in Mac may be able to request authentication through the agent.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

“Overwrite (y/n)?” appears during generation

The requested private-key path already exists. Answer no unless you are certain the old pair is disposable and unused. Generate the new pair under a distinct name, such as ~/.ssh/vps_staging_ed25519, then install its matching .pub file.

Best Value
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.

Permission denied (publickey)

Work through these checks in order:

  • Confirm the username and VPS address are exactly correct.
  • Confirm the entire public-key line on the VPS matches your Mac’s .pub file. A wrapped line, missing characters, or pasted extra text invalidates it.
  • Confirm the line is in the target account’s ~/.ssh/authorized_keys, not in another user’s home directory or an arbitrary upload folder.
  • Check chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys on the VPS.
  • Verify that the target account owns its home, .ssh directory, and authorized-key file.
  • Make sure the client is offering the intended private key. Run a verbose test:
ssh -v -i ~/.ssh/id_ed25519 user@server.example

Look through the diagnostic output for the identities SSH considers and offers. Remove -i only after you know the default key path is the one you want.

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

SSH still asks for the VPS password

A password prompt can mean that public-key authentication failed and SSH is falling back to passwords. Specify the private key explicitly with -i, check that its matching public line was installed, and use ssh -v to confirm the client offers it. Also recheck the account name: installing a key for one account does not authorize a different account.

Server-side SSH settings vary by VPS image and provider. If the key, username, path, ownership, and permissions are correct, consult the documentation for that specific image rather than assuming every provider enables the same authentication settings.

The host authenticity warning is unexpected

Do not blindly accept a changed or unfamiliar fingerprint. Verify the VPS fingerprint through a trusted provider control panel or out-of-band console. If the server was rebuilt and its host key legitimately changed, follow the provider’s documented procedure for removing the old entry from your Mac’s known-hosts file before reconnecting.

The command says the file or directory does not exist

Check the local path with ls -la ~/.ssh. A custom filename must be used consistently for generation, installation, and testing. On the VPS, run mkdir -p ~/.ssh as the target account before creating authorized_keys.

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

Optional hardware-backed Ed25519 keys

OpenSSH also supports FIDO authenticator-hosted keys through the ed25519-sk type. A compatible USB-C FIDO2 security key can keep key operations tied to hardware rather than storing all signing capability in a normal disk file.

ssh-keygen -t ed25519-sk -C "you@example.com"

This is an advanced path, not a prerequisite for VPS access. Confirm support on both the Mac’s OpenSSH build and the VPS’s SSH server before depending on it, and keep a documented recovery method. Compatibility, authenticator presence, and provider policies differ; do not assume that every VPS accepts security-key-backed algorithms.

Protect and maintain your keys

  • Back up the private key only through an encrypted, access-controlled backup system. A backup that anyone can read is another copy an attacker can steal.
  • Keep the public and private files paired. If you rename a private key, retain the corresponding .pub file so you can identify and reinstall it.
  • Use separate key pairs for unrelated environments when practical, such as production and testing. Revoking one key then requires removing only its line from the relevant account’s authorized_keys.
  • When a Mac or private key may have been compromised, remove that public-key line from every affected VPS and generate a replacement pair.
  • Do not place private keys in shell history, screenshots, issue trackers, or configuration files that are shared with other users.

The essential boundary is simple: generate the pair locally, keep the private half on the Mac, install only the public half in the correct VPS account’s authorized_keys, restrict server permissions, and test with the exact identity you intend to use.

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.

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