Use it when setting up or hardening SSH access to a server, or when nobody can connect.
SSH Server
The SSH server runs sshd, listens on TCP 22 (by default), presents its host keys and authenticates users according to sshd_config.
1. systemctl status sshd — running?
2. ss -ltnp | grep sshd — listening on the intended address/port?
3. Firewall: port allowed?
4. sshd -T | grep -E 'passwordauth|permitroot|allow' — policy.
5. Test from a second session before closing the first.
sshd started → listens → presents host key → applies auth policy → starts the user session
For SSH → SSH Server, continue with the first unproven Topic check: Verify sshd unit/process and exact listening sockets/addresses/ports. If that boundary is healthy, advance to the adjacent check: Validate effective server configuration for the target user/address context. 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.
ss -tlnp | grep :22Verification & 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
service/unit → sshd process → listening socket → host keys/config → client connect/KEX → authentication/account checks → session/subsystem/forwarding policy → remote workload
Healthy evidence: sshd is running and listening as intended, host keys/config are valid, the target client reaches the endpoint, authentication/account checks pass and the requested session/subsystem succeeds.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Verify sshd unit/process and exact listening sockets/addresses/ports.
- Validate effective server configuration for the target user/address context.
- Correlate authentication/session events with one timestamped client attempt.
- Confirm the original shell, command, SFTP/SCP or forwarding use case from a real client.
Verification chain. service/unit → sshd process → listening socket → host keys/config → client connect/KEX → authentication/account checks → session/subsystem/forwarding policy → remote workload
Step 3 Commands Verify boundary
sshd -T | head
ss -tlnp | grep :22
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: service is active but bound to the wrong address, Match policy changes one user path, account restrictions block session creation or only the transport layer is healthy.
Step 5 Common mistakes Narrow the fault
- Exposing SSH to the internet without restrictions.
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.
Validate before restarting: sshd -t. Keep an existing session open when changing it. Restrict who may log in (AllowUsers/AllowGroups), disable passwords for internet-facing hosts and open the port in the firewall.
ssh -v user@host— client-side connection and authentication stepsjournalctl -u ssh -u sshd -e— server logsshd -T— effective server settingsss -ltnp | grep :22— sshd listening
ReferenceWhat it is1 section · depth on demand
Core model
Verify the service from outside-in and inside-out: listening endpoint and firewall path, sshd process/unit, host keys and effective configuration, authentication/account policy, then session/subsystem setup. Treat daemon liveness as separate from successful remote workload execution.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Server liveness/listening shows availability of the daemon endpoint only, but it does not show client trust, successful authentication, permitted session setup or workload correctness.
In depth
Securing an SSH server: key settings and defaults
A secure SSH server mostly comes down to a handful of sshd_config settings. The sshd_config(5) manual page documents their defaults:
| Keyword | Default | Hardened choice |
|---|---|---|
PermitRootLogin | prohibit-password | no, with sudo for privilege |
PasswordAuthentication | yes | no once keys are deployed |
KbdInteractiveAuthentication | yes | no unless used for MFA |
PubkeyAuthentication | yes | yes |
AuthenticationMethods | any | e.g. publickey,keyboard-interactive for key + OTP |
MaxAuthTries | 6 | 3–4 |
LoginGraceTime | 120 s | 30–60 s |
AllowTcpForwarding | yes | no, or local where needed |
X11Forwarding | no | no |
AllowUsers / AllowGroups | Everyone | A dedicated group such as ssh-users |
LogLevel | INFO | VERBOSE logs key fingerprints used to log in |
Access control order
DenyUsers and DenyGroups take precedence over the Allow lists. Once any Allow list is set, only matching users or groups can log in at all, including administrators you forgot to add.
Testing before reloading
sshd -t checks the configuration for errors. sshd -T prints the effective configuration, which is useful because Include files and the first-value rule make the result non-obvious. Keep an existing session open until a new login has been tested.
srv1$ sudo tee /etc/ssh/sshd_config.d/10-hardening.conf >/dev/null <<'EOF'
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
AllowGroups ssh-users
MaxAuthTries 3
LoginGraceTime 30
AllowTcpForwarding no
LogLevel VERBOSE
EOF
srv1$ sudo sshd -t && echo syntax-ok
srv1$ sudo sshd -T | grep -E "^(permitrootlogin|passwordauthentication|allowgroups|maxauthtries)"
permitrootlogin no
passwordauthentication no
allowgroups ssh-users
maxauthtries 3
srv1$ sudo systemctl reload ssh
admin$ ssh -o PreferredAuthentications=password srv1
admin@srv1: Permission denied (publickey).
Why use a drop-in file
A file in sshd_config.d survives package upgrades that replace the main file. It must be included before the defaults it overrides, because of the first-value rule. Most distributions put the Include line at the top of sshd_config for exactly that reason.
Documented example, not captured output.
How it works at runtime
SSH Server is part of SSH → SSH Server. An SSH server exposes remote SSH service through sshd, combining listening sockets, host keys, authentication backends, account restrictions, session setup, subsystems and forwarding policy.
Topic-specific state model. An SSH server exposes remote SSH service through sshd, combining listening sockets, host keys, authentication backends, account restrictions, session setup, subsystems and forwarding policy.
Interpretation rule. - sshd process running ≠ listening on the expected address/port.
- Listening socket reachable ≠ SSH negotiation/authentication succeeds.
- Authentication accepted ≠ account/session setup or requested subsystem succeeds.
- One user can log in ≠ another user/address/Match context has the same effective policy.
Quick reference
SSH server operation:
systemctl status sshd # 'ssh' on Debian/Ubuntu
ss -tlnp | grep sshd
sshd -t # config syntax test
sshd -T | grep -E 'port|permitroot|passwordauth|listenaddress'
journalctl -u sshd -f
ls -l /etc/ssh/ssh_host_*_key.pub
Ubuntu 22.10+ uses socket activation (ssh.socket) — port changes go in a socket drop-in or systemctl disable --now ssh.socket to return to the classic daemon. Keep an existing session open while changing sshd config.
Limits and how it fails
Primary failure point. Server liveness/listening shows availability of the daemon endpoint only, but it does not show client trust, successful authentication, permitted session setup or workload correctness.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. SSH Server owns the server role and service exposure. sshd owns daemon lifecycle/process behavior, sshd_config owns policy, Firewall owns packet filtering and systemd & Services owns generic service-manager semantics.
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 Server. 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 Server operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for SSH Server.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | An SSH server exposes remote SSH service through sshd, combining listening sockets, host keys, authentication backends, account restrictions, session setup, subsystems and forwarding policy. | 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 | service/unit → sshd process → listening socket → host keys/config → client connect/KEX → authentication/account checks → session/subsystem/forwarding policy → remote workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Server liveness/listening proves availability of the daemon endpoint only; it does not prove client trust, successful authentication, permitted session setup or workload correctness. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux SSH evidence can establish this proof path: service/unit → sshd process → listening socket → host keys/config → client connect/KEX → authentication/account checks → session/subsystem/forwarding policy → remote workload | 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. Server liveness/listening proves availability of the daemon endpoint only; it does not prove client trust, successful authentication, permitted session setup or workload correctness. | 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 Server · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | SSH Server |
|---|---|
| Topic path | SSH → SSH Server |
| Runtime state | An SSH server exposes remote SSH service through sshd, combining listening sockets, host keys, authentication backends, account restrictions, session setup, subsystems and forwarding policy. |
| Fast checks | - Verify sshd unit/process and exact listening sockets/addresses/ports. - Validate effective server configuration for the target user/address context. - Correlate authentication/session events with one timestamped client attempt. - Confirm the original shell, command, SFTP/SCP or forwarding use case from a real client. |
| Verification chain | service/unit → sshd process → listening socket → host keys/config → client connect/KEX → authentication/account checks → session/subsystem/forwarding policy → remote workload 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 | Server liveness/listening proves availability of the daemon endpoint only; it does not prove client trust, successful authentication, permitted session setup or workload correctness. 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. |