Use it as the entry point for remote access on Linux, or when an SSH login fails.
SSH
SSH gives encrypted remote shell access, file transfer and tunnelling. On Linux the server is OpenSSH's sshd and the client is ssh, authenticating with keys (preferred) or passwords.
1. ssh -v user@host — where does it stop?
2. Server listening? ss -ltnp | grep :22; firewall open?
3. Server log: journalctl -u sshd -e (or ssh).
4. Keys and permissions on ~/.ssh.
5. sshd -T — effective auth settings.
TCP 22 → protocol and key exchange → host key verified → user authenticated (key/password) → session
For SSH, continue with the first unproven Topic check: Capture client/server versions, destination/port, username and the exact requested SSH function. If that boundary is healthy, advance to the adjacent check: Correlate client verbosity with server journal/authentication logs at the same attempt time. 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.
ssh-keygenPrimary Commands
Configuration and operational commands for this Topic.
ssh-keygenReferenceGenerate, inspect, convert and manage SSH public/private key material and known-host keys.
Use when: Primary lookup intent: configure. Use ssh-keygen when the lookup goal is to generate, inspect, convert and manage SSH public/private key material and known-host keys. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for ssh-keygen: Verify fingerprints/permissions and perform the intended SSH authentication/host-verification test. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. ssh-keygen is documented as an operational lookup primitive under SSH. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
sshd -TReferenceRead current SSH state for a bounded verification step.
Use when: Use after confirming the SSH Hardening target and before changing state.
Quick note: Cross-platform security / Cisco / Linux / Windows. A control being configured does not prove enforcement, visibility, containment or acceptable residual risk.
Linux · distribution/version specific · mixedVerification & 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
client invocation/config → DNS/address + TCP/22 reachability → SSH identification/KEX → server host-key verification → user authentication → sshd authorization/effective policy → session/channel/subsystem/forwarding → remote process or transfer → original workload
Healthy evidence: client and server agree on identity and algorithms, the intended host key is verified, the expected user authentication path succeeds, effective server policy permits the requested channel and the original remote workload completes.
Step 2 Operational verification Verify boundary
SSH client/server behavior, host keys, authentication, configuration and connection troubleshooting.
Fast verification
- Use
ssh -vvvfrom the client and inspect the server journal for the same attempt.
- Check the effective daemon configuration with sshd -T, including ListenAddress, authentication and Match blocks.
- Verify host-key trust and network reachability separately from user authentication.
Step 3 Commands Verify boundary
ssh -v user@host
ssh-keygen -t ed25519
ssh-copy-id user@host
sshd -t
Step 4 Verification and output interpretation Verify boundary
Verification path. Show listener/bind address and TCP path first, then capture verbose client negotiation and corresponding server journal/auth log for the same timestamp. Distinguish host-key failure from user-key authentication and from post-auth session failure. Use sshd configuration test/effective config where supported before reload. For tunneling/SFTP/SCP, verify the requested channel/subsystem after authentication rather than assuming login success shows every SSH feature.
Existing fast checks for this Topic. - Capture client/server versions, destination/port, username and the exact requested SSH function.
- Correlate client verbosity with server journal/authentication logs at the same attempt time.
- Verify host-key identity, negotiated algorithms, authentication method and effective sshd policy before changing credentials.
- Repeat the original shell, command, transfer or tunnel and validate the downstream workload after remediation.
Verification chain. client invocation/config → DNS/address + TCP/22 reachability → SSH identification/KEX → server host-key verification → user authentication → sshd authorization/effective policy → session/channel/subsystem/forwarding → remote process or transfer → original workload
Step 5 Verification path Verify boundary
Step 6 Common mistakes Narrow the fault
- Locking yourself out by restarting sshd with a broken config (test with
sshd -t). - Disabling host key checking.
Step 7 Failure modes and next checks Narrow the fault
Suspicious evidence: TCP/22 is reachable but KEX fails, host identity unexpectedly changes, authentication succeeds but session/subsystem setup is denied, or an interactive shell masks a failing transfer/tunnel path.
It does not show behavior outside the captured transport, trust, authentication, policy, session, filesystem or workload scope. An established SSH transport shows only the negotiated encrypted connection and accepted authentication/policy for that attempt; it does not by itself show the remote command, file transfer, forwarded service, privilege transition or application result.
Next check: Continue from the first step that has not been verified: 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.
Step 8 Where it fails Narrow the fault
Walk link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path and stop where observed state diverges.
Common failure classes are wrong namespace/interface, stale route/neighbor, resolver mismatch, firewall shadowing, socket bind conflict, SSH auth/host-key issue, MTU/asymmetry or return-path failure.
Evidence · 2 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Healthy evidence: client and server agree on identity and algorithms, the intended host key is verified, the expected user authentication path succeeds, effective server policy permits the requested channel and the original remote workload completes. Suspicious evidence: TCP/22 is reachable but KEX fails, host identity unexpectedly changes, authentication succeeds but session/subsystem setup is denied, or an interactive shell masks a failing transfer/tunnel path.
command output · Documented exampleSSH local healthy-state checkpointThe expected object, scope, state and counters match a controlled test.
Subtopics
Go one level deeper into this subject.
OpenSSH is the predominant Linux implementation of the SSH protocol suite, providing client tools, sshd, key handling, configuration parsing, authentication methods, subsystems and forwarding; package version and vendor backports materially affect defaults and available algorithms.
Subtopic SSH ClientThe OpenSSH client resolves destination and configuration, selects identity/authentication methods, verifies server host identity, negotiates transport and requests channels such as shell, exec, subsystem or forwarding.
Subtopic SSH ServerAn SSH server exposes remote SSH service through sshd, combining listening sockets, host keys, authentication backends, account restrictions, session setup, subsystems and forwarding policy.
Subtopic sshdsshd 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.
Subtopic ssh_configssh_config defines OpenSSH client policy using first-obtained-value semantics across command-line options, user configuration and system configuration, with Host/Match patterns capable of changing destination, identity, proxy, algorithm and forwarding behavior.
Subtopic sshd_configsshd_config defines OpenSSH server policy for listeners, host keys, authentication, account/session behavior, forwarding and subsystems, with Include and Match blocks producing connection-context-specific effective configuration.
Subtopic Public Key AuthenticationSSH public-key authentication proves possession of a private key corresponding to a server-authorized public key, subject to server algorithm policy, key options, account policy and filesystem safety checks; it is not equivalent to generic account authorization.
Subtopic authorized_keysauthorized_keys is an account-scoped SSH authorization source mapping accepted public keys to optional restrictions such as forced commands, source-address limits, environment constraints and forwarding permissions; file ownership/mode and lookup method affect whether sshd will trust it.
Subtopic known_hostsknown_hosts stores client-side SSH host identity bindings for hostnames/addresses and host keys (including hashed names and CA markers), allowing the client to detect unexpected server identity changes and resist machine-in-the-middle substitution.
Subtopic SCPSCP is an SSH-based file-copy workflow whose transport may use modern SFTP semantics depending on OpenSSH version/options; transfer success depends on SSH authentication plus source/destination path interpretation, permissions, space and write/read completion.
Subtopic SFTPSFTP is the SSH File Transfer Protocol subsystem, a structured remote filesystem protocol carried in an SSH channel; it does not depend on an interactive shell but does depend on sshd subsystem configuration, authentication, chroot/path policy and filesystem authorization.
Subtopic SSH TunnelingSSH tunneling forwards TCP endpoints through SSH channels using local, remote or dynamic forwarding; success depends on bind/listen scope, name-resolution side, sshd forwarding policy, destination reachability from the relevant endpoint and the tunneled application protocol.
Subtopic SSH TroubleshootingSSH 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.
Use key authentication, disable password and root login on internet-facing servers, and keep the server config valid (sshd -t) before restarting. ssh -v and the server journal together show where a login fails.
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 is3 sections · depth on demand
Operational scope
SSH client/server behavior, host keys, authentication, configuration and connection troubleshooting.
What it is
SSH client/server behavior, host keys, authentication, configuration and connection troubleshooting.
Core model
Pin the exact client, server, destination name/address, port, username and requested SSH function. Separate TCP reachability from SSH identification and key exchange, host-key verification from user authentication, authentication from authorization/session setup, and an established SSH transport from success of the shell, remote command, file-transfer subsystem or forwarded application.
ReferenceWhy it matters1 section · depth on demand
When to use it
Use SSH when the problem concerns Linux runtime, services, networking, identity, packages, storage or shell automation.
ReferenceHow it works1 section · depth on demand
How it works
SSH client/server behavior, host keys, authentication, configuration and connection troubleshooting.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
An established SSH transport shows only the negotiated encrypted connection and accepted authentication/policy for that attempt; it does not by itself show the remote command, file transfer, forwarded service, privilege transition or application result.
In depth
How an SSH session is established
Every SSH login goes through the same stages, and knowing them makes failures easier to place. The sshd(8) manual page describes them in order:
1. The server presents its host key, and the client checks it against its known hosts.
2. A Diffie-Hellman key agreement produces a session key. All further traffic is encrypted, with a MAC for integrity.
3. The client authenticates the user: host-based, public key, challenge-response or password.
4. The client may request a pseudo-terminal or forwarding (X11, TCP, agent).
5. The client asks for a shell or a command, which runs through the user's shell.
Mapping symptoms to stages
| Stage | Failure looks like | First check |
|---|---|---|
| TCP connection | Connection refused / timeout | Is sshd running and listening? Firewall? |
| Host key | REMOTE HOST IDENTIFICATION HAS CHANGED | Was the server reinstalled, or is this an attack? |
| Key exchange | no matching key exchange method | Old client or server; algorithm policy |
| Authentication | Permission denied (publickey) | Key, authorized_keys permissions, server policy |
| Session | Login succeeds, then closes | /etc/nologin, shell, ForceCommand, quota |
Login steps after authentication (sshd(8))
sshd checks /etc/nologin, and refuses non-root users if it exists. It then drops privileges, sets up the environment and changes to the home directory. Next it runs ~/.ssh/rc (if permitted) or /etc/ssh/sshrc, and finally starts the shell or command.
admin$ ssh -v admin@srv1.example.net 2>&1 | grep -E "Connecting|Server host key|Authentications that can continue|Authenticated|Offering"
debug1: Connecting to srv1.example.net [10.30.0.11] port 22.
debug1: Server host key: ssh-ed25519 SHA256:pY3...
debug1: Authentications that can continue: publickey
debug1: Offering public key: /home/admin/.ssh/id_ed25519 ED25519 SHA256:Qb...
debug1: Authenticated to srv1.example.net ([10.30.0.11]:22) using "publickey".
srv1$ sudo journalctl -u ssh -u sshd --since -10min | tail
srv1$ sudo ss -tlnp | grep ':22 '
Using both sides of the log
The client's -v output shows how far the exchange got. The server's journal shows why it was refused, for example "Authentication refused: bad ownership or modes". Together they almost always identify the stage and the cause.
Documented example, not captured output.
How it works at runtime
Runtime state ownership and mechanics. OpenSSH connection setup crosses TCP reachability, server process/listener, algorithm negotiation, host-key verification, user authentication, account/PAM policy, authorization and session/subsystem creation. Client and server configuration are assembled from command-line options and multiple config scopes with first-value/Match semantics. Public-key authentication additionally depends on key type/signature support, authorized_keys lookup and file/account policy.
Topic-specific state model. SSH is the secure remote-session and transport boundary for Linux: OpenSSH negotiates protocol algorithms, authenticates the server and client, applies user/account and sshd policy, then creates an encrypted channel whose success must still be distinguished from shell, command, subsystem or tunneled workload success.
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. - TCP connection established ≠ SSH key exchange and host authentication succeeded.
- Server host key accepted ≠ user authentication or authorization succeeded.
- User authenticated ≠ requested shell, command, subsystem or forwarding is permitted and healthy.
- Interactive SSH works ≠ SCP, SFTP or tunneled application behavior is automatically healthy.
Mechanics
Follow the path in order: link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path.
Important negative cases include wrong namespace/interface, stale route/neighbor, resolver mismatch, firewall shadowing, socket bind conflict, SSH auth/host-key issue, MTU/asymmetry or return-path failure.
Limits and how it fails
Primary failure point. An established SSH transport shows only the negotiated encrypted connection and accepted authentication/policy for that attempt; it does not by itself show the remote command, file transfer, forwarded service, privilege transition or application result.
Model. A reachable TCP/22 socket does not show SSH negotiation or authentication. 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. SFTP is an SSH subsystem and does not require the same server-side shell/file-copy path as legacy scp behavior.
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. Understand include and Match scope before editing, because an apparently global directive can be overridden or no longer apply. Keep host keys separate from user keys. authorized_keys permissions/ownership, AuthorizedKeysFile/Command, PAM, Allow/Deny rules and SELinux/AppArmor can all affect authorization. Client config should be checked with effective-option expansion.
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. 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 operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for SSH.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | SSH is the secure remote-session and transport boundary for Linux: OpenSSH negotiates protocol algorithms, authenticates the server and client, applies user/account and sshd policy, then creates an encrypted channel whose success must still be distinguished from shell, command, subsystem or tunneled workload success. | 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 | client invocation/config → DNS/address + TCP/22 reachability → SSH identification/KEX → server host-key verification → user authentication → sshd authorization/effective policy → session/channel/subsystem/forwarding → remote process or transfer → original workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | An established SSH transport proves only the negotiated encrypted connection and accepted authentication/policy for that attempt; it does not by itself prove the remote command, file transfer, forwarded service, privilege transition or application result. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux SSH evidence can establish this proof path: client invocation/config → DNS/address + TCP/22 reachability → SSH identification/KEX → server host-key verification → user authentication → sshd authorization/effective policy → session/channel/subsystem/forwarding → remote process or transfer → original 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. An established SSH transport proves only the negotiated encrypted connection and accepted authentication/policy for that attempt; it does not by itself prove the remote command, file transfer, forwarded service, privilege transition or application result. | 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 · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | SSH |
|---|---|
| Topic path | SSH |
| Runtime state | SSH is the secure remote-session and transport boundary for Linux: OpenSSH negotiates protocol algorithms, authenticates the server and client, applies user/account and sshd policy, then creates an encrypted channel whose success must still be distinguished from shell, command, subsystem or tunneled workload success. |
| Fast checks | - Capture client/server versions, destination/port, username and the exact requested SSH function. - Correlate client verbosity with server journal/authentication logs at the same attempt time. - Verify host-key identity, negotiated algorithms, authentication method and effective sshd policy before changing credentials. - Repeat the original shell, command, transfer or tunnel and validate the downstream workload after remediation. |
| Verification chain | client invocation/config → DNS/address + TCP/22 reachability → SSH identification/KEX → server host-key verification → user authentication → sshd authorization/effective policy → session/channel/subsystem/forwarding → remote process or transfer → original workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | An established SSH transport proves only the negotiated encrypted connection and accepted authentication/policy for that attempt; it does not by itself prove the remote command, file transfer, forwarded service, privilege transition or application result. 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. |