Use it when the SSH service will not start, or settings do not take effect.
sshd
sshd is the OpenSSH server daemon (service sshd on RHEL, ssh on Debian/Ubuntu). It may also be started by socket activation (ssh.socket) on newer Ubuntu releases.
1. systemctl status sshd ssh ssh.socket.
2. sshd -t — config errors?
3. Port: sshd_config Port vs systemctl cat ssh.socket.
4. SELinux non-standard port → semanage port -a -t ssh_port_t -p tcp <port>.
5. Reload and test.
unit (service or socket) starts sshd → config parsed → host keys loaded → listening
For SSH → sshd, continue with the first unproven Topic check: Validate sshd configuration before reload/restart and capture the active service unit/process. If that boundary is healthy, advance to the adjacent check: Confirm listener ownership and correlate PID/connection logs with the client attempt. 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.
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
sshd binary + config parse → service manager → master listener → connection child/pre-auth → KEX/auth → PAM/account policy → session child/subsystem → workload
Healthy evidence: configuration validates, the intended daemon listens, one connection progresses through expected pre-auth/auth/session phases and the requested remote operation completes.
Step 2 Verification and output interpretation Verify boundary
Use sshd configuration test/effective config where supported before reload.
Existing fast checks for this Topic. - Validate sshd configuration before reload/restart and capture the active service unit/process.
- Confirm listener ownership and correlate PID/connection logs with the client attempt.
- Separate pre-auth, auth, PAM/account and session/subsystem log phases.
- After changes, reconnect with the original user/source/channel and verify the actual workload.
Verification chain. sshd binary + config parse → service manager → master listener → connection child/pre-auth → KEX/auth → PAM/account policy → session child/subsystem → workload
Step 3 Commands Verify boundary
sshd -t
systemctl reload sshd
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: config validates but a different file/drop-in is effective, daemon is active without expected listener, PAM/account checks fail after auth or session child setup terminates immediately.
It does not show behavior outside the captured transport, trust, authentication, policy, session, filesystem or workload scope. sshd syntax/service evidence shows daemon-side readiness only within that layer, but it does not show network path, client host trust, user filesystem access or application success.
Step 5 Common mistakes Narrow the fault
- Restarting sshd with a broken config.
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.
A config error stops sshd from starting — sshd -t shows it. On Ubuntu with ssh.socket, the port is set in the socket unit, not only in sshd_config. Reload with systemctl reload sshd to keep sessions.
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
Anchor troubleshooting on the exact sshd process/unit and connection attempt. Confirm binary/config syntax, loaded configuration, listener ownership and runtime logs; then distinguish pre-authentication failures from authentication, account, PAM, session child or subsystem failures.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
sshd syntax/service evidence shows daemon-side readiness only within that layer, but it does not show network path, client host trust, user filesystem access or application success.
In depth
Running and debugging sshd
sshd runs as a listener that forks one process per connection. The sshd(8) manual page describes its behaviour:
- It rereads its configuration on SIGHUP, by re-executing itself.
- Command-line options override the configuration file.
-tchecks the configuration and keys, and-Talso prints the effective configuration. With-C,-Tshows the result for a specific connection, so Match blocks are evaluated.-druns a single connection in debug mode in the foreground, without forking. Up to three-dflags increase the detail.-Dkeeps sshd from detaching, which is how systemd usually runs it.
Service management
| Task | Command (Debian/Ubuntu unit ssh, RHEL unit sshd) |
|---|---|
| Status | systemctl status ssh |
| Reload configuration (existing sessions stay) | systemctl reload ssh |
| Restart | systemctl restart ssh |
| Logs | journalctl -u ssh -b |
| Listening sockets | ss -tlnp 'sport = :22' |
On some recent Ubuntu releases, sshd is socket-activated (ssh.socket), so the listening port comes from the socket unit. Check systemctl status ssh.socket before assuming Port in sshd_config is used.
Debugging one login without disturbing the service
Run a second sshd on another port in debug mode. Then connect to it. Its output shows exactly why authentication fails, which the normal log may not show.
srv1$ sudo sshd -T -C user=admin,host=10.110.0.64,addr=10.110.0.64 | grep -E "^(passwordauthentication|allowtcpforwarding|forcecommand)"
srv1$ sudo /usr/sbin/sshd -d -p 2222
debug1: sshd version OpenSSH_9.6, OpenSSL 3.0.13
debug1: Server will not fork when running in debugging mode.
Server listening on 0.0.0.0 port 2222.
debug1: trying public key file /home/admin/.ssh/authorized_keys
Authentication refused: bad ownership or modes for directory /home/admin
admin$ ssh -p 2222 admin@srv1
srv1$ sudo journalctl -u ssh --since today | grep -E "Accepted|Failed|refused"
Reading the example
"bad ownership or modes for directory /home/admin" means the home directory is writable by group or others. sshd's StrictModes check then ignores authorized_keys. Fix it with chmod go-w /home/admin. Don't disable StrictModes.
Documented example, not captured output.
How it works at runtime
Topic-specific state model. sshd is the OpenSSH server daemon: it accepts SSH transports, performs privilege-separated authentication and policy evaluation, creates sessions/subsystems/forwards, and emits security-relevant logs for each connection.
Technical metadata. Client host/distribution/OpenSSH version, server host/distribution/OpenSSH version, timestamp, destination name/address/port, source address, username, ssh_config Host/Match/Include resolution, proxy/jump path, negotiated KEX/host-key/cipher/MAC where relevant, server host-key fingerprint, known_hosts source, authentication method, client identity fingerprint/agent source, authorized-key source/options, sshd_config Include/Match/effective policy, PAM/account result, session type, PTY/command/subsystem, local/remote/dynamic forward endpoints, server PID/unit/listener, remote process/exit status, source/destination file path and hash where relevant, client/server logs and original workload result.
Interpretation rule. - sshd -t success ≠ daemon is running with the intended effective policy.
- systemd active state ≠ correct listener or successful client session.
- Authentication log success ≠ child session command or shell launched successfully.
- Restart succeeded ≠ existing connections use new configuration or original issue is fixed.
Quick reference
sshd daemon internals: a privileged listener process forks a per-connection process with privilege separation (unprivileged pre-auth child, then a user-privileged process). Each session appears as sshd: user@pts/0.
ps -ef --forest | grep -A2 '[s]shd'
who; w
pkill -KILL -t pts/3 # kick a session
sshd -d -p 2222 # debug instance on another port
The debug instance shows exactly why authentication fails without disturbing the running daemon.
Limits and how it fails
Primary failure point. sshd syntax/service evidence shows daemon-side readiness only within that layer, but it does not show network path, client host trust, user filesystem access or application success.
Possessing a private key does not guarantee the server accepts the key algorithm, maps the account or authorizes that public key. known_hosts protects server identity and is separate from user authentication. sshd_config syntax success does not show a safe remote reload.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Configuration intent and lifecycle. Change sshd policy with a syntax/test step and preserve an existing administrative session when hardening remote access.
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 → sshd. 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
sshd operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for sshd.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | sshd is the OpenSSH server daemon: it accepts SSH transports, performs privilege-separated authentication and policy evaluation, creates sessions/subsystems/forwards, and emits security-relevant logs for each connection. | 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 | sshd binary + config parse → service manager → master listener → connection child/pre-auth → KEX/auth → PAM/account policy → session child/subsystem → workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | sshd syntax/service evidence proves daemon-side readiness only within that layer; it does not prove network path, client host trust, user filesystem access or application success. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux SSH evidence can establish this proof path: sshd binary + config parse → service manager → master listener → connection child/pre-auth → KEX/auth → PAM/account policy → session child/subsystem → 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. sshd syntax/service evidence proves daemon-side readiness only within that layer; it does not prove network path, client host trust, user filesystem access or application success. | 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. |
sshd · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | sshd |
|---|---|
| Topic path | SSH → sshd |
| Runtime state | sshd is the OpenSSH server daemon: it accepts SSH transports, performs privilege-separated authentication and policy evaluation, creates sessions/subsystems/forwards, and emits security-relevant logs for each connection. |
| Fast checks | - Validate sshd configuration before reload/restart and capture the active service unit/process. - Confirm listener ownership and correlate PID/connection logs with the client attempt. - Separate pre-auth, auth, PAM/account and session/subsystem log phases. - After changes, reconnect with the original user/source/channel and verify the actual workload. |
| Verification chain | sshd binary + config parse → service manager → master listener → connection child/pre-auth → KEX/auth → PAM/account policy → session child/subsystem → 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 | sshd syntax/service evidence proves daemon-side readiness only within that layer; it does not prove network path, client host trust, user filesystem access or application success. 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. |