Use it when the symptom is “SSH Failure”: work through the layers in order and stop at the first one that fails.
SSH Failure
1. SSH failure: network/port, host key change, key not authorised, wrong user, algorithms.
2. Verbose SSH.
3. Check host key changes (security!).
4. Check authorized_keys.
5. Fix and retry.
network → host key → auth → shell
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
ssh -vvv <user>@<host>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
inventory target → DNS/route → TCP reachability → SSH negotiation → host-key trust → user authentication → session/subsystem → privilege → remote command → target read-back
Healthy evidence: resolved target, host key and user/key are explicit, negotiation/auth logs agree, non-interactive command execution works, and target state is verified.
Step 2 Telling causes apart Verify boundary
Known-good is a verbose transcript that connects to the intended host, validates the expected host key, negotiates an approved algorithm set, authenticates the intended user and opens the required session/exec channel; then the same automated remote command succeeds. Broken state is a repeatable failure at one named SSH phase. An established SSH session shows transport plus SSH authentication/channel setup only, not the success of the command or workflow executed through it.
Step 3 Common mistakes Verify boundary
- Host key changes ignored by disabling checking.
- Wrong key or user for the target.
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: host keys are blindly disabled, manual login is treated as equivalent to runner context, or repeated retries hide routing, algorithm or sudo failures.
SSH success shows a session can be established for that path and identity, but it does not show the automation command, privilege transition or desired configuration succeeds.
Step 5 Observation-driven branch and next-check logic Narrow the fault
Run ssh -vvv <user>@<host> from the same control node and read the transcript in order. If connection setup times out/refuses, inspect DNS/route/firewall/listener; if negotiation stops on host key or algorithms, compare known_hosts and supported crypto; if authentication fails, inspect offered identities/account policy; if an interactive session works but automation does not, compare proxy options, batch mode, environment and remote command/shell. If the session status is failed at any phase, inspect that phase before moving on; otherwise compare the automated exec channel with the interactive path. Do not treat a successful ping as evidence that SSH itself is healthy.
Step 6 Where it fails Narrow the fault
Where SSH Failure usually goes wrong: host-key identity, authentication, channel/command exit semantics, timeout ambiguity and target verification.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- TCP 22 reachable ≠ SSH negotiation or authentication succeeds.
- SSH login succeeds ≠ remote automation command or privilege escalation succeeds.
- Host-key acceptance ≠ user authentication.
- Manual SSH success ≠ automation uses the same key, user, proxy or known_hosts.
ssh -vvv -o BatchMode=yes <host>— verbose SSHssh-keygen -F <host>— known_hosts entrync -vz <host> 22— port reachable
ReferenceWhat it is1 section · depth on demand
Core model
Resolve the exact target and route; test TCP reachability; capture SSH negotiation and host-key identity; identify chosen user/key/agent; verify server auth logs; distinguish connection, host-key, authentication and post-login command/sudo failures; correct the first failed layer and rerun the original remote operation.
ReferenceHow it works1 section · depth on demand
How it works and how it fails
SSH Failure spans name resolution and TCP reachability, host-key negotiation, algorithm compatibility, user authentication and remote session/channel startup. Automation often adds proxy/jump hosts, noninteractive key agents and strict host-key policy, which can differ from an operator's shell. The SSH client owns the protocol transcript; the remote command executed afterward is a separate consumer of the established channel.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
SSH Failure owns generic automation SSH isolation; deep SSH protocol/security and target OS configuration stay with Network/Security/Linux/Windows branches.
In depth
An SSH failure in automation happens at a specific stage: connection, key exchange, host key check, user authentication or channel/command. The client's verbose output shows which.
ssh -vvv -o BatchMode=yes -i ~/.ssh/automation deploy@web01 true
nc -zv web01 22
| Message | Cause |
|---|---|
| Connection timed out | Network, firewall |
| Host key verification failed | Host rebuilt or MITM; update known_hosts deliberately |
| No matching key exchange/cipher | Old device needs legacy algorithms |
| Permission denied (publickey) | Key not authorised or wrong user |
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Automation Troubleshooting > SSH Failure. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/architecture/patterns/retry · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
SSH Failure troubleshooting proof-boundary map
Fast symptom/scope, first-failed-boundary, effective-outcome and recovery/closure map for SSH Failure.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Symptom / scope | Time window, immutable source/run identity, effective inputs and exact targets are explicit | Floating source, changed inputs or ambiguous targets destroy reproducibility |
| First failed boundary | Transport/auth/dependency/render/operation evidence identifies the earliest divergence | Investigation starts at the final error and skips earlier unproven boundaries |
| Effective outcome | Controller result is paired with target read-back and workload/service acceptance | Green execution state or changed symptom substitutes for effective-state verification |
| Recovery / closure | Minimal change restores the original test and regression/partial-state checks are clean | Broad retry or unrelated edits make the incident non-reproducible and hide residual state |