Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

SSH Failure

Direct answer

SSH failures are problems connecting or authenticating with SSH: no connection, host key warnings, rejected keys or passwords, or immediate disconnects.

When to use this

Use it when you cannot log in over SSH.

First 30 seconds

1. ssh -vvv user@host — connect, key exchange, or auth step?

2. Connection refused/timeout → ss -ltnp | grep :22 and firewall.

3. Server log: journalctl -u ssh -u sshd -e.

4. Keys: ~/.ssh 700, authorized_keys 600, home not group-writable.

5. sshd -T — AllowUsers/PermitRootLogin/PasswordAuthentication.

Operational verification

TCP 22 reachable → key exchange → host key accepted → user authenticated → session

Evidence · next step

For Linux Troubleshooting → SSH Failure, continue with the first unproven Topic check: Capture exact host/user/port/source and verbose client trace for one attempt. If that boundary is healthy, advance to the adjacent check: Correlate same-attempt sshd journal/auth logs and effective sshd configuration including Match rules. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux · Linux / OpenSSH + systemd
Key commandjournalctl -u sshd --since "-30 min" --no-pager
Scope / prerequisiteUse it when you cannot log in over SSH.
Verify · 1
What next?3 suggested next steps
Catalog command links1
Evidence1
On this pageJump to a specific section
Linux command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

7 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

Healthy evidence: client and server evidence align through transport, trust, negotiation, authentication and requested session/subsystem, and the original SSH-dependent workload succeeds.

Step 2 Command read-back and what it shows Verify boundary

Read back Linux Troubleshooting → SSH Failure with journalctl -u sshd --since "-30 min" --no-pager. Known-good is the intended client attempt reaches sshd, authenticates through the expected method, opens the requested session/subsystem and the original SSH operation completes; broken/suspicious remains when the same stage-specific rejection recurs or the client still cannot complete the requested session despite an apparently healthy daemon. Classify success only when the expected discriminator is present, then repeat the original acceptance/workload test and one adjacent regression check. The recent sshd journal shows only events emitted by the daemon/unit on that host and window, but it does not show packets reached the host when no log exists or that every distribution logs SSH under the same unit name.

Step 3 Commands Verify boundary
ssh -vvv user@host
journalctl -u sshd -n 50
sshd -T | grep -iE 'permitroot|passwordauth'
Step 4 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Capture exact host/user/port/source and verbose client trace for one attempt.

  • Correlate same-attempt sshd journal/auth logs and effective sshd configuration including Match rules.
  • Verify host key, algorithms, authorized_keys permissions/ownership, PAM/account and session/subsystem restrictions.
  • Apply minimal correction and repeat the original SSH/SCP/SFTP/tunnel operation, not just login.
Step 5 Failure modes and next checks Narrow the fault

Suspicious evidence: port 22 reachability is treated as SSH health, only client errors are read, Match policy/effective user is ignored, or shell login success substitutes for SFTP/tunnel acceptance.

Step 6 Observation-driven branch and next-check logic Narrow the fault

Start from the exact failing target and timestamp. Capture journalctl -u sshd --since "-30 min" --no-pager before mutation. Branch on evidence: if no sshd event exists for the attempt, check listener/network/firewall path; if negotiation or host-key error appears, isolate crypto/client policy; if authentication/PAM/key rejection appears, inspect identity and key permissions; if authentication succeeds but session fails, inspect shell/subsystem/home permissions. Treat an error, failed result, unexpected state or missing object as a branch trigger and move only one boundary at a time.

Step 7 Common mistakes Narrow the fault
  • Wrong permissions on ~/.ssh (700) or authorized_keys (600).
Evidence references

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.

observation · 1
Key points

ssh -v on the client shows where it stops; the server's journal (journalctl -u ssh/sshd) shows why it refused. Common causes: firewall, sshd not running, wrong key or permissions on ~/.ssh, AllowUsers/PermitRootLogin, account locked.

Key checks
  • journalctl -b -p err — errors this boot
  • systemctl --failed — failed units
  • df -h; df -i — space and inodes
  • ss -tulpn — listening sockets
  • dmesg -T | tail — recent kernel messages
ReferenceWhat it is1 section · depth on demand

Core model

Use verbose client evidence and server-side logs for the same attempt. Separate transport, host identity, crypto negotiation, user authentication, authorization/policy, PAM/account restrictions and session/subsystem execution.

ReferenceHow it works1 section · depth on demand

How it works

Linux Troubleshooting → SSH Failure owns client TCP reachability, sshd listener/process state, protocol/crypto negotiation, host-key trust, authentication/PAM policy, account authorization and session/subsystem startup. An SSH session progresses through transport establishment, SSH key exchange/host identity, user authentication and then session creation; each stage can fail while later stages remain untouched. Keep adjacent boundaries separate: DNS, firewall/NAT, time, directory/identity systems, authorized_keys permissions and shell/home filesystem state are independent adjacent boundaries. Diagnostic distinction: an authentication failure shows the daemon and transport were reached, while a connection timeout/refusal occurs before credentials are evaluated.

ReferenceImportant terms & boundaries4 sections · depth on demand

What this shows and what it does not

SSH Failure owns cross-layer SSH fault isolation; SSH owns OpenSSH configuration/authentication depth and Networking/DNS/Permissions own underlying boundaries.

In depth

Troubleshooting SSH connections

SSH failures can be placed precisely by how far the connection gets. The ssh(1) manual page gives the main tool: -v, repeatable up to three times, prints each step. It also documents the exit status: 255 means ssh itself failed, and any other value comes from the remote command. The client tries authentication methods in a fixed order (GSSAPI, host-based, public key, keyboard-interactive, password), and the verbose output shows each attempt.

Where it stops, and why

MessageStageUsual cause
Connection timed outTCPFirewall, routing, wrong address, server down
Connection refusedTCPsshd not running, or not on that port
No route to hostIPRouting or a firewall reject
Host key verification failed / REMOTE HOST IDENTIFICATION HAS CHANGEDHost keyServer reinstalled, IP reused, or an attack
no matching host key type / no matching key exchange methodNegotiationOld server or client; algorithm policy
Permission denied (publickey)AuthenticationKey not offered, not authorised, or file permissions on the server
Too many authentication failuresAuthenticationThe agent offers too many keys; use IdentitiesOnly yes
Logs in, then disconnects at onceSessionShell set to nologin, ForceCommand, /etc/nologin

Client and server views together

SideCommand
Clientssh -vvv user@host 2>&1 | grep -E "Connecting|Offering|Authentications|denied|debug1: Server"
Server logjournalctl -u ssh -u sshd --since -10min
Server effective configurationsshd -T -C user=<u>,host=<h>,addr=<ip>
Server in debug mode on another portsshd -d -p 2222
Reachabilitync -zv host 22
admin$ ssh -v srv3 2>&1 | grep -E "Connecting|Offering|Authentications that can continue|denied"
debug1: Connecting to srv3 [10.30.0.13] port 22.
debug1: Offering public key: /home/admin/.ssh/id_ed25519_work ED25519 SHA256:Qb...
debug1: Authentications that can continue: publickey
admin@srv3: Permission denied (publickey).
srv3$ sudo journalctl -u sshd --since -5min | grep -E "admin|refused|Authentication"
sshd[4410]: Authentication refused: bad ownership or modes for file /home/admin/.ssh/authorized_keys
srv3$ ls -l /home/admin/.ssh/authorized_keys
-rw-rw-r-- 1 admin admin 412 Nov 28 15:58 /home/admin/.ssh/authorized_keys
srv3$ sudo chmod 600 /home/admin/.ssh/authorized_keys

Reading the example

The client offers the right key, and the server refuses it without saying why on the client side. The server's log has the reason: authorized_keys is group-writable, so sshd ignores it. That's why SSH authentication problems almost always need the server log, as well as ssh -v.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

SSH Failure is part of Linux Troubleshooting → SSH Failure. SSH Failure isolates an SSH connection from name resolution and TCP reachability through host-key trust, algorithm negotiation, authentication, sshd effective policy, session setup and requested subsystem/command.

Topic-specific state model. SSH Failure isolates an SSH connection from name resolution and TCP reachability through host-key trust, algorithm negotiation, authentication, sshd effective policy, session setup and requested subsystem/command.

Interpretation rule. - TCP/22 open ≠ SSH negotiation or authentication will succeed.

  • Public key offered ≠ server accepted the key for that user/policy.
  • Authentication succeeds ≠ shell/SFTP/forwarding is authorized or functional.
  • Restarting sshd ≠ configuration is valid or failure root cause is fixed.

Method

SSH failure diagnosis:

ssh -vvv user@host                    # client side: which key, which auth methods
journalctl -u sshd -f                 # server side (ssh on Debian/Ubuntu)
sshd -t; sshd -T | grep -Ei 'allowusers|allowgroups|passwordauth|pubkey'
nc -zv host 22
MessageCause
Connection refusedsshd not running/listening, firewall REJECT
Connection timed outNetwork/firewall DROP
Permission denied (publickey)Key not in authorized_keys, wrong permissions (~/.ssh 700, file 600), wrong user
Host key verification failedChanged host key — verify before removing from known_hosts
Too many authentication failuresAgent offers many keys — -o IdentitiesOnly=yes -i key

sshd refuses keys if home or .ssh directories are group/world-writable (StrictModes).

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. SSH Failure owns cross-layer SSH fault isolation; SSH owns OpenSSH configuration/authentication depth and Networking/DNS/Permissions own underlying boundaries.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Linux Troubleshooting → SSH Failure. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/ · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Terminology layer

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.

Aliases that resolve here
linux ssh failuressh connection troubleshootingpermission denied publickeysshd troubleshooting
Embedded reference data

Quick lookup tables

SSH Failure operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for SSH Failure.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSSH Failure isolates an SSH connection from name resolution and TCP reachability through host-key trust, algorithm negotiation, authentication, sshd effective policy, session setup and requested subsystem/command.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin symptom + exact time + host/boot/user → define scope + expected baseline → preserve original failing test → collect targeted kernel/process/service/storage/network/security/log evidence → identify first divergent boundary → make one minimal reversible change → repeat original test → verify adjacent regressions and retain before/after evidence.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainsymptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture checkTrace requested/configured state through effective state to the observed workload result.
Failure boundarySSH Failure troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux troubleshooting evidence can establish this proof path: symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture checkUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured host, boot, process/user, dependency, time or workload scope. SSH Failure troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: reproduce the exact original failure, collect the owning subsystem evidence at the same time, change only the proven cause or prerequisite, then repeat the original workload and regression checks.Continue to the next unresolved boundary while preserving the original test condition.

SSH Failure · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundarySSH Failure
Topic pathLinux Troubleshooting → SSH Failure
Runtime stateSSH Failure isolates an SSH connection from name resolution and TCP reachability through host-key trust, algorithm negotiation, authentication, sshd effective policy, session setup and requested subsystem/command.
Fast checks- Capture exact host/user/port/source and verbose client trace for one attempt. - Correlate same-attempt sshd journal/auth logs and effective sshd configuration including Match rules. - Verify host key, algorithms, authorized_keys permissions/ownership, PAM/account and session/subsystem restrictions. - Apply minimal correction and repeat the original SSH/SCP/SFTP/tunnel operation, not just login.
Verification chainsymptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundarySSH Failure troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?