Connect Over SSH

Updated

You connect to the Mac over SSH with the key you added. The Mac’s Connect section gives the exact command, with the address and username filled in.

Before you start, add an SSH key. Without one, the Connect section shows Add SSH Key in place of the commands.

Connect

  1. Open Macs in the sidebar and click the Mac.
  2. In Connect, choose the Terminal tab.
  3. Press Copy on the command.
  4. Run it in Terminal.
  5. Type yes when it asks if you want to keep connecting.

The Connect section on the Terminal tab, with the SSH command

For a Mac with a public IP, the command looks like this:

ssh <username>@<address>

Macs Reached Through Cloudflare

Some Macs are reached through a Cloudflare tunnel. On those, the Terminal tab starts with an Install cloudflared step. The SSH command carries a ProxyCommand:

ssh -o ProxyCommand="cloudflared access ssh --hostname %h" <username>@<address>

Install cloudflared once. Pick your computer’s tab in the step. On macOS:

brew install cloudflared

On Windows:

winget install --id Cloudflare.cloudflared

The Linux tab’s command downloads the x86-64 build from GitHub into /usr/local/bin. Copy it from the app.

Use a Shorter Command

On a tunnel Mac, open Use a Shorter Command under the steps. Run its command once to add the Mac to your SSH config. This shorter command then works in Terminal, VS Code, scp and rsync:

ssh <address>

After a Reset

A reset gives the Mac a new host key. SSH refuses to connect until the old one is gone. For 7 days after a reset, the Mac’s panel shows the command to clear it. Run it once:

ssh-keygen -R <address>

If It Won’t Connect

A running Mac gets a new key within a minute. Wait that long after adding one. A suspended Mac, or one being erased, has no Connect section.

SSH is the only way into the Mac from the internet. To reach Screen Sharing or another service on the Mac, tunnel it over SSH. See Open Ports and Port Forwarding.

Need help? Email support@macmetro.com.