Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

SSH Troubleshooting

Direct answer

SSH troubleshooting follows the connection step by step: name resolution and TCP 22, key exchange, host key verification, user authentication, then account/PAM and the session.

When to use this

Use it when an SSH connection is refused, times out, warns about the host key, or rejects the login.

First 30 seconds

1. ssh -vvv user@host — which step fails?

2. Timeout/refused → ss -ltnp on the server, firewall, nc -vz host 22.

3. Host key warning → verify the fingerprint, then ssh-keygen -R host.

4. Auth failure → server journal; ~/.ssh permissions; sshd -T | grep -E 'allow|password|pubkey'.

5. Session closes at once → shell valid? PAM/account expired?

Operational verification

DNS → TCP 22 → key exchange → host key trusted → user authenticated → account/PAM → shell

Evidence · next step

For SSH → SSH Troubleshooting, continue with the first unproven Topic check: Pin timestamp, client/source, destination IP/name/port, username, OpenSSH versions and requested SSH operation. If that boundary is healthy, advance to the adjacent check: Classify failure: resolution/TCP, identification/KEX, host-key trust, authentication, account/PAM, session/subsystem/forwarding or downstream workload. 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
Key commandjournalctl -u sshd -n 50
Scope / prerequisiteUse it when an SSH connection is refused, times out, warns about the host key, or rejects the login.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

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

5 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

symptom/time → destination resolution → TCP path → SSH identification/KEX → host-key trust → authentication → account/PAM + effective sshd policy → session/subsystem/forwarding → remote process/filesystem/service → original-test verification

Healthy evidence: the exact original attempt traverses resolution, transport, trust, authentication, policy and requested channel successfully, with client/server evidence aligned and no unintended security regression.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Pin timestamp, client/source, destination IP/name/port, username, OpenSSH versions and requested SSH operation.

  • Classify failure: resolution/TCP, identification/KEX, host-key trust, authentication, account/PAM, session/subsystem/forwarding or downstream workload.
  • Correlate client -v evidence with server journal/auth logs and effective config for the exact connection context.
  • Apply one minimal change, repeat the original failing operation and verify no security/regression boundary was weakened.

Verification chain. symptom/time → destination resolution → TCP path → SSH identification/KEX → host-key trust → authentication → account/PAM + effective sshd policy → session/subsystem/forwarding → remote process/filesystem/service → original-test verification

Step 3 Commands Verify boundary
ssh -vvv user@host
journalctl -u sshd -n 50
sshd -T
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: operators change keys or sshd_config before identifying the failed phase, inspect only one side, test a different channel than the failing workload or weaken host/auth policy to obtain a connection.

Step 5 Common mistakes Narrow the fault
  • Not reading the server-side log.
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 checks
  • ssh -vvv user@host — client steps and where it stops
  • journalctl -u sshd -u ssh -e — server-side reason
  • ss -ltnp | grep :22 — sshd listening
  • sshd -T — effective server policy
ReferenceWhat it is1 section · depth on demand

Core model

Use one reproducible attempt with precise time, source, destination, user and channel type. Correlate client verbosity and server logs, classify the first failure phase, make the smallest targeted change, then repeat the exact original operation and perform regression/security checks.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

SSH troubleshooting is complete only when the first failing step is evidenced and the original operation succeeds after a minimal controlled change; generic ping, port-open, daemon-active or interactive-login checks are intermediate evidence only.

In depth

See the server's effective configuration

# sshd -t && echo syntax OK
# sshd -T | grep -E '^(permitrootlogin|passwordauthentication|pubkeyauthentication|allowusers|allowgroups|authorizedkeysfile|maxauthtries)'
# sshd -T -C user=alice,host=laptop.corp.example.com,addr=10.0.10.55 | grep -E 'passwordauthentication|permitrootlogin'

The sshd manual documents -T (extended test: check configuration and print the effective settings), -C (connection parameters for -T, so Match blocks are evaluated) and -d (debug mode in the foreground). -T -C answers "which rules apply to this user from this address".

Debug both ends

$ ssh -vvv alice@srv01 2>&1 | grep -E 'Offering|Server accepts|Authentications that can continue|debug1: Next authentication'
# /usr/sbin/sshd -d -p 2222          # second debug instance on another port, current sessions unaffected
# journalctl -u ssh -u sshd --since -10min
Client debug lineMeaning
Offering public key: ... ED25519 then Authentications that can continue: publickey,passwordServer did not accept the key
Server accepts keyKey accepted; failure is later (shell, PAM, account)
no matching host key type foundAlgorithm mismatch (old client/server)
REMOTE HOST IDENTIFICATION HAS CHANGEDHost key changed — verify out of band before removing from known_hosts

Key accepted by nobody — server-side causes

CauseServer log hint
Permissions on ~/.ssh or authorized_keys too openAuthentication refused: bad ownership or modes
Home directory group-writableSame message
SELinux label wrong on ~/.sshAVC denial; restorecon -Rv ~/.ssh
AllowUsers/AllowGroups excludes the userUser alice not allowed because not listed in AllowUsers
Account locked/expiredPAM messages

Required modes: ~/.ssh 700, authorized_keys 600, home directory not writable by group/others.

Changing sshd safely

Keep an existing session open, run sshd -t, reload (systemctl reload sshd), and test a new login before closing the old session.

*The sshd configuration and authentication inspection commands are worked examples, not an observed SSH session.*

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 Troubleshooting is part of SSH → SSH Troubleshooting. SSH troubleshooting should isolate the first failing step from name resolution and TCP reachability through SSH negotiation, host identity, user authentication, server authorization, session/subsystem setup and the final remote workload.

Topic-specific state model. SSH troubleshooting should isolate the first failing step from name resolution and TCP reachability through SSH negotiation, host identity, user authentication, server authorization, session/subsystem setup and the final remote workload.

Interpretation rule. - Connection timed out ≠ sshd authentication problem.

  • Connection refused ≠ firewall is necessarily the root cause.
  • Permission denied (publickey) ≠ the private key file is necessarily missing or invalid.
  • Successful interactive login ≠ the original SCP/SFTP/tunnel/remote-command failure is fixed.

Method

SSH troubleshooting checklist:

ssh -vvv user@host 2>&1 | grep -E 'Offering|Authentications that can continue|debug1: Server accepts'
journalctl -u sshd --since -10m        # server reasons: 'Authentication refused: bad ownership', 'User not allowed because not listed in AllowGroups'
sshd -T | grep -iE 'allow|deny|pubkey|password'
namei -l ~alice/.ssh/authorized_keys
ausearch -m AVC -c sshd | tail          # SELinux: wrong context on ~/.ssh (restorecon -Rv ~/.ssh)

Slow logins: reverse DNS (UseDNS no), GSSAPI attempts (GSSAPIAuthentication no on client), or PAM modules (SSSD timeouts).

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

Limits and how it fails

Primary failure point. SSH troubleshooting is complete only when the first failing step is evidenced and the original operation succeeds after a minimal controlled change; generic ping, port-open, daemon-active or interactive-login checks are intermediate evidence only.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. SSH Troubleshooting owns cross-layer isolation inside the SSH branch. DNS, Linux Networking, Firewall, Users/Permissions, systemd and application-specific branches remain owners of their underlying failure domains.

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 SSH → SSH Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.openssh.com/manual.html · 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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
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
ssh troubleshootingssh connection failurepermission denied publickeyssh debug
Embedded reference data

Quick lookup tables

SSH Troubleshooting operational reference

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

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSSH troubleshooting should isolate the first failed boundary from name resolution and TCP reachability through SSH negotiation, host identity, user authentication, server authorization, session/subsystem setup and the final remote workload.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin exact client/server + attempt time → resolve destination/TCP path → inspect effective client config → identify OpenSSH versions → verify KEX + host-key trust → trace offered/accepted authentication → inspect effective sshd policy for user/source → verify session/subsystem/forward → verify remote process/filesystem/service → repeat original workload.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainsymptom/time → destination resolution → TCP path → SSH identification/KEX → host-key trust → authentication → account/PAM + effective sshd policy → session/subsystem/forwarding → remote process/filesystem/service → original-test verificationTrace requested/configured state through effective state to the observed workload result.
Failure boundarySSH troubleshooting is complete only when the first failed boundary is evidenced and the original operation succeeds after a minimal controlled change; generic ping, port-open, daemon-active or interactive-login checks are intermediate evidence only.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux SSH evidence can establish this proof path: symptom/time → destination resolution → TCP path → SSH identification/KEX → host-key trust → authentication → account/PAM + effective sshd policy → session/subsystem/forwarding → remote process/filesystem/service → original-test verificationUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured transport, trust, authentication, policy, session, filesystem or workload scope. SSH troubleshooting is complete only when the first failed boundary is evidenced and the original operation succeeds after a minimal controlled change; generic ping, port-open, daemon-active or interactive-login checks are intermediate evidence only.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: correlate client and server evidence for the same attempt, inspect effective client/server configuration and identity/trust/authentication state, then test the exact requested session, transfer or forward before changing additional layers.Continue to the next unresolved boundary while preserving the original test condition.

SSH Troubleshooting · operational reference

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

Reference boundarySSH Troubleshooting
Topic pathSSH → SSH Troubleshooting
Runtime stateSSH troubleshooting should isolate the first failed boundary from name resolution and TCP reachability through SSH negotiation, host identity, user authentication, server authorization, session/subsystem setup and the final remote workload.
Fast checks- Pin timestamp, client/source, destination IP/name/port, username, OpenSSH versions and requested SSH operation. - Classify failure: resolution/TCP, identification/KEX, host-key trust, authentication, account/PAM, session/subsystem/forwarding or downstream workload. - Correlate client -v evidence with server journal/auth logs and effective config for the exact connection context. - Apply one minimal change, repeat the original failing operation and verify no security/regression boundary was weakened.
Verification chainsymptom/time → destination resolution → TCP path → SSH identification/KEX → host-key trust → authentication → account/PAM + effective sshd policy → session/subsystem/forwarding → remote process/filesystem/service → original-test verification 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 troubleshooting is complete only when the first failed boundary is evidenced and the original operation succeeds after a minimal controlled change; generic ping, port-open, daemon-active or interactive-login checks are intermediate evidence only. 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?