Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

ssh_config

Direct answer

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.

When to use this

Use it to simplify connections and set per-host options, or when the client uses unexpected settings.

First 30 seconds

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.

Operational verification

ssh reads command line → user config → system config → first match per option → connection

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it to simplify connections and set per-host options, or when the client uses unexpected settings.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points

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.

Key checks
  • ssh -G <host> — effective client settings
  • ssh -v user@host — client-side connection and authentication steps
  • journalctl -u ssh -u sshd -e — server log
  • sshd -T — effective server settings
  • ss -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 Host blocks therefore belong at the top, and general defaults (Host *) at the end.
  • Host patterns support * and negation with !.
  • Match can test host, user, localuser, exec and more.
  • Include reads other files, and relative paths resolve to ~/.ssh.

Useful keywords (manual)

KeywordPurpose
HostName, User, PortReal host name or IP, login name, port (default 22)
IdentityFile, IdentitiesOnly yesWhich keys to offer; offer only those (avoids "too many authentication failures")
ProxyJumpJump hosts
LocalForward, RemoteForward, DynamicForwardPort forwarding
ServerAliveInterval, ServerAliveCountMaxKeepalives (default interval 0 = off, count 3)
ControlMaster, ControlPath, ControlPersistReuse one connection for many sessions
StrictHostKeyCheckingask (default), accept-new, yes, no
ForwardAgentDefault 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
ssh_configssh client configopenssh client configurationhost stanza ssh
Embedded reference data

Quick lookup tables

ssh_config operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for ssh_config.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective statessh_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 verificationPin 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 chaincommand-line → user config/includes → system config/includes → Host/Match evaluation → effective client options → transport/auth/channel request → outcomeTrace requested/configured state through effective state to the observed workload result.
Failure boundaryEffective 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 evidenceCorrelated 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 → outcomeUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 boundaryssh_config
Topic pathSSH → ssh_config
Runtime statessh_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 chaincommand-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 boundaryEffective 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?