Use it when an SSH connection is refused, times out, warns about the host key, or rejects the login.
SSH Troubleshooting
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.
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?
DNS → TCP 22 → key exchange → host key trusted → user authenticated → account/PAM → shell
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
Operational reference
Fast context before you go deeper.
journalctl -u sshd -n 50Verification & 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
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
-vevidence 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 · 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.
"Connection timed out" → network or firewall; "Connection refused" → nothing listening; host key warning → verify before accepting; "Permission denied (publickey)" → key, permissions or AllowUsers. The server journal gives the real reason.
ssh -vvv user@host— client steps and where it stopsjournalctl -u sshd -u ssh -e— server-side reasonss -ltnp | grep :22— sshd listeningsshd -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 line | Meaning |
|---|---|
Offering public key: ... ED25519 then Authentications that can continue: publickey,password | Server did not accept the key |
Server accepts key | Key accepted; failure is later (shell, PAM, account) |
no matching host key type found | Algorithm mismatch (old client/server) |
REMOTE HOST IDENTIFICATION HAS CHANGED | Host key changed — verify out of band before removing from known_hosts |
Key accepted by nobody — server-side causes
| Cause | Server log hint |
|---|---|
Permissions on ~/.ssh or authorized_keys too open | Authentication refused: bad ownership or modes |
| Home directory group-writable | Same message |
SELinux label wrong on ~/.ssh | AVC denial; restorecon -Rv ~/.ssh |
AllowUsers/AllowGroups excludes the user | User alice not allowed because not listed in AllowUsers |
| Account locked/expired | PAM 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.*
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).
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
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 SSH → SSH Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.openssh.com/manual.html · confidence 94%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.
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 Troubleshooting operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for SSH Troubleshooting.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | SSH 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 verification | Pin 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 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 | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | 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. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated 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 verification | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It 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 check | Continue 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 boundary | SSH Troubleshooting |
|---|---|
| Topic path | SSH → SSH Troubleshooting |
| Runtime state | SSH 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 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 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 boundary | 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. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |