Skip to content

fix: name the SSH user when a new device rejects every key - #737

Merged
penso merged 1 commit into
penso:mainfrom
theontho:fix/ssh-key-login-names-user
Oct 21, 2026
Merged

penso merged 1 commit into
penso:mainfrom
theontho:fix/ssh-key-login-names-user

Conversation

@theontho

@theontho theontho commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When an Add Device target has no user (for example rpi4-hermes.taile584c3.ts.net), ssh logs in as the local account. If the host only accepts the key for another account (pi@…), the probe hits Permission denied (publickey) and the dialog says "accepted none of your SSH keys". It then offers to run ssh-copy-id for the wrong account and never says which user it tried. Plain ssh pi@host works, so the message is misleading.

  • The host claim already holds the ssh -G-resolved destination. When the target doesn't name a user, the key offer now names the resolved one and suggests the target with a user. For an ssh:// target the user goes inside the URI (ssh://name@box:2222).

    rpi4-hermes.taile584c3.ts.net accepted none of your SSH keys for the user mac. If you log in there as someone else, change the target to name@rpi4-hermes.taile584c3.ts.net and press Enter to check it. Otherwise, install your key for mac? …

  • Editing the target while an offer is shown now returns the dialog to the form and drops the claim. Following the hint therefore re-checks the new target instead of installing a key for the refused account. Before this, edits on the offer step were ignored.
  • The Windows terminal instructions get the same hint. Targets that name their user keep the existing text. The change starts no extra process and opens no connection.

Screenshots

There are no native screenshots yet. Driving a second app instance through synthesized input wasn't safe on a desktop that was in use, so no capture was taken. The change is text in the existing status line of the key offer, plus the dialog returning to its form.

QA

  • cargo test -p herdr-gpui --locked --bins menu::devices: 125 passed. New key_login tests cover the implied user, explicit user@/ssh://user@ targets, an ssh:// target without a user, no resolved user, and target edits withdrawing the offer
  • just ci on c266a1c, macOS arm64: passed. An earlier run under heavy load hit two timing flakes unrelated to this change (login_env::…timeout_kills_shell_and_descendant_group, updater::brew::…relaunch_retries_then_alerts_when_open_keeps_failing); both passed when rerun
  • Native release build of c266a1c (just run, macOS arm64), with a target that has no user, for a host that only accepts pi@: the probe failed with Auth and the offer named the local user
  • On that offer, changed the target to pi@… and pressed Enter: the host was checked again (Running) and the device saved through machine add without a key install, then was removed
  • Check that the longer message wraps cleanly in a narrow dialog

@theontho
theontho requested a review from penso as a code owner October 20, 2026 05:37
@theontho

theontho commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

just ci ran locally and passed on c266a1c (macOS arm64), rebased on main 32b0b87. No extra recipes were run; the change has no cfg gates.

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain.

Summary

The key-login offer now names the resolved SSH user when the target leaves it out.

  • Key offers name the SSH login that refused the keys.
  • Editing a target withdraws its current setup offer.

Reviews (2) · Last reviewed commit: "fix: name the SSH user when a new device..." · Reviewed by Greptile

Comment thread crates/herdr-gpui/src/menu/devices/add_device.rs Outdated
Comment thread crates/herdr-gpui/src/menu/devices/add_device.rs Outdated
An Add Device target without a user (`host.example`) logs in as the local
account, so a host that only knows `pi@host.example` refuses every key and
the dialog offered to run ssh-copy-id for the wrong account, with no sign
of which user was tried.

The host claim already holds the `ssh -G` destination, so the key offer now
names that user when the target does not, and suggests the target with a
user (inside the URI for an `ssh://` target). Targets that name their user
keep the existing text. No extra process or connection is made.

Editing the target while an offer is shown now returns the dialog to the
form and drops the claim, so following the hint checks the new target
instead of installing a key for the account that was refused.
@theontho
theontho force-pushed the fix/ssh-key-login-names-user branch from 7777e5b to c266a1c Compare October 20, 2026 16:55
@penso

penso commented Oct 20, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@penso
penso merged commit afcd56e into penso:main Oct 21, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants