Add an SSH Key

Updated

An SSH key lets you sign in to your Mac from a terminal without a password. It has two halves. The private half stays on your computer. The public half goes on the SSH Keys page, and every Mac in the account gets it.

Open Add Key

Open SSH Keys in the sidebar and press Add Key. The Add SSH Key button in a Mac’s Next Step band opens the same panel.

The SSH Keys page listing two keys, with the Add Key button marked

The panel has four steps. Pick macOS, Linux or Windows on the first command. The later commands follow that choice. On Windows, run the commands in PowerShell.

The Add Key panel open, with the four steps

1. Check for a Key

On macOS or Linux:

cat ~/.ssh/id_ed25519.pub

On Windows:

Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub

If this prints a line starting with ssh-ed25519, you already have a key. Skip to step 3.

2. Make a Key

ssh-keygen -t ed25519

Press Return to keep the suggested location. Type a passphrase, or press Return twice for none.

3. Copy the Public Key

On macOS, this copies the public half to the clipboard. It prints nothing.

pbcopy < ~/.ssh/id_ed25519.pub

On Windows, this does the same.

Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard

On Linux, run cat ~/.ssh/id_ed25519.pub. Copy the line it prints, from ssh-ed25519 to the end.

4. Paste It Here

  1. Paste the key into Public Key. Label fills in from the end of the key line.
  2. Change Label to something you’ll recognize, like Work Laptop.
  3. Press Add Key.

A running Mac gets the key within a minute. Every new Mac has it from the start. A Mac with support access turned off gets it when support access is back on.

Delete a Key

Press Delete on the key’s row on the SSH Keys page. Confirm with Delete Key.

Next: Connect Over SSH.

Need help? Email support@macmetro.com.