Use it to simplify connections and set per-host options, or when the client uses unexpected settings.
ssh_config
ssh_config is the SSH client configuration: /etc/ssh/ssh_config (system) and ~/.ssh/config (user), with Host blocks that set HostName, User, Port, IdentityFile, ProxyJump and more.
1. ssh -G <host> | grep -E 'hostname|user|port|identityfile|proxyjump' — effective settings.
2. Wrong value → an earlier matching Host block?
3. Permissions: chmod 600 ~/.ssh/config.
4. Use ProxyJump for bastions.
5. Connect and confirm with ssh -v.
ssh reads command line → user config → system config → first match per option → connection
For SSH → ssh_config, continue with the first unproven Topic check: Identify command-line options plus user/system ssh_config and Include files. If that boundary is healthy, advance to the adjacent check: Resolve Host/Match patterns for the exact destination and inspect effective configuration. 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
command-line → user config/includes → system config/includes → Host/Match evaluation → effective client options → transport/auth/channel request → outcome
Healthy evidence: matched stanzas and precedence resolve to the intended destination, user, port, identity, trust, proxy and forwarding options and the original operation succeeds.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Identify command-line options plus user/system ssh_config and Include files.
- Resolve Host/Match patterns for the exact destination and inspect effective configuration.
- Check destination/user/port, proxy/jump, identities, host-key and algorithm settings for surprises.
- Retest the exact client operation after a minimal configuration change.
Verification chain. command-line → user config/includes → system config/includes → Host/Match evaluation → effective client options → transport/auth/channel request → outcome
Step 3 Commands Verify boundary
cat ~/.ssh/config
ssh -G host | head
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: a broad Host stanza wins early, Include content changes effective options, wrong proxy/identity is selected or file contents are inspected without checking effective resolution.
Step 5 Common mistakes Narrow the fault
- Host patterns matching more hosts than intended.
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.
The first value found wins, so put specific Host blocks before Host *. ssh -G <host> prints the effective settings. ~/.ssh/config must not be writable by others.
ssh -G <host>— effective client settingsssh -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
Evaluate configuration for the exact destination alias instead of reading files linearly. Determine precedence and matched stanzas, then inspect the effective client settings; this is critical because a syntactically valid file can still produce an unintended destination, user, key or proxy path.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Effective ssh_config shows client-side option resolution for a destination, but it does not show server acceptance, network path or remote session behavior.
ssh_config owns client configuration syntax, matching and precedence.
In depth
ssh_config: per-host client configuration
~/.ssh/config lets you give hosts short names and per-host settings, so long command lines aren't needed. The ssh_config(5) manual page defines how values are chosen:
- Settings come from the command line, then
~/.ssh/config, then/etc/ssh/ssh_config. - For most keywords, the first value obtained is used. Specific
Hostblocks therefore belong at the top, and general defaults (Host *) at the end. Hostpatterns support*and negation with!.Matchcan testhost,user,localuser,execand more.Includereads other files, and relative paths resolve to~/.ssh.
Useful keywords (manual)
| Keyword | Purpose |
|---|---|
HostName, User, Port | Real host name or IP, login name, port (default 22) |
IdentityFile, IdentitiesOnly yes | Which keys to offer; offer only those (avoids "too many authentication failures") |
ProxyJump | Jump hosts |
LocalForward, RemoteForward, DynamicForward | Port forwarding |
ServerAliveInterval, ServerAliveCountMax | Keepalives (default interval 0 = off, count 3) |
ControlMaster, ControlPath, ControlPersist | Reuse one connection for many sessions |
StrictHostKeyChecking | ask (default), accept-new, yes, no |
ForwardAgent | Default no; the manual advises caution |
An example layout
admin$ cat ~/.ssh/config
Host bastion
HostName bastion.example.net
User admin
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Host srv-* 10.30.*
User admin
ProxyJump bastion
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Host *
ServerAliveInterval 30
ControlMaster auto
ControlPath ~/.ssh/cm-%r@%h:%p
ControlPersist 10m
StrictHostKeyChecking accept-new
admin$ ssh -G srv-db1 | grep -E "^(hostname|user|proxyjump|identityfile|controlpersist)"
admin$ ssh srv-db1
Checking what applies
ssh -G <host> prints the configuration ssh would use for that host, after all matching. It's the quickest way to see why a setting isn't taking effect. Usually an earlier block has already set it.
About accept-new
StrictHostKeyChecking accept-new adds new hosts automatically, but still refuses changed keys. That's a reasonable middle ground for large fleets, where ask trains people to type "yes" without checking.
Documented example, not captured output.
How it works at runtime
ssh_config is part of SSH → ssh_config. ssh_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.
Topic-specific state model. ssh_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.
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. - Later matching line ≠ always overrides an earlier value; many options use first obtained value.
- Config file contains intended option ≠ that option applies to this host pattern.
- Valid syntax ≠ safe or intended proxy/forwarding/identity behavior.
- User config ≠ only source; system config and included files may also contribute.
Quick reference
Client configuration in ~/.ssh/config (and /etc/ssh/ssh_config):
Host bastion
HostName bastion.example.com
User alice
IdentityFile ~/.ssh/id_ed25519
Host 10.0.30.* *.internal
ProxyJump bastion
User ops
Host *
ServerAliveInterval 60
IdentitiesOnly yes
HashKnownHosts yes
ControlMaster auto
ControlPath ~/.ssh/cm-%r@%h:%p
ControlPersist 10m
First matching value wins, so put specific hosts first. ControlMaster reuses connections — big speed-up for Ansible and repeated commands.
Limits and how it fails
Primary failure point. Effective ssh_config shows client-side option resolution for a destination, but it does not show server acceptance, network path or remote session behavior.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. ssh_config owns client configuration syntax, matching and precedence. SSH Client owns runtime client behavior; known_hosts and public-key Topics own trust/authentication data.
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_config. 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_config operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for ssh_config.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | ssh_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. | 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 | command-line → user config/includes → system config/includes → Host/Match evaluation → effective client options → transport/auth/channel request → outcome | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Effective ssh_config proves client-side option resolution for a destination; it does not prove server acceptance, network path or remote session behavior. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux SSH evidence can establish this proof path: command-line → user config/includes → system config/includes → Host/Match evaluation → effective client options → transport/auth/channel request → outcome | 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. Effective ssh_config proves client-side option resolution for a destination; it does not prove server acceptance, network path or remote session behavior. | 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_config · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | ssh_config |
|---|---|
| Topic path | SSH → ssh_config |
| Runtime state | ssh_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. |
| Fast checks | - Identify command-line options plus user/system ssh_config and Include files. - Resolve Host/Match patterns for the exact destination and inspect effective configuration. - Check destination/user/port, proxy/jump, identities, host-key and algorithm settings for surprises. - Retest the exact client operation after a minimal configuration change. |
| Verification chain | command-line → user config/includes → system config/includes → Host/Match evaluation → effective client options → transport/auth/channel request → outcome 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 | Effective ssh_config proves client-side option resolution for a destination; it does not prove server acceptance, network path or remote session behavior. 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. |