1SSH_CONFIG(5) BSD File Formats Manual SSH_CONFIG(5)
2
4 ssh_config — OpenSSH SSH client configuration files
5
7 ssh(1) obtains configuration data from the following sources in the fol‐
8 lowing order:
9
10 1. command-line options
11 2. user's configuration file (~/.ssh/config)
12 3. system-wide configuration file (/etc/ssh/ssh_config)
13
14 For each parameter, the first obtained value will be used. The configu‐
15 ration files contain sections separated by Host specifications, and that
16 section is only applied for hosts that match one of the patterns given in
17 the specification. The matched host name is usually the one given on the
18 command line (see the CanonicalizeHostname option for exceptions).
19
20 Since the first obtained value for each parameter is used, more host-spe‐
21 cific declarations should be given near the beginning of the file, and
22 general defaults at the end.
23
24 The file contains keyword-argument pairs, one per line. Lines starting
25 with ‘#’ and empty lines are interpreted as comments. Arguments may
26 optionally be enclosed in double quotes (") in order to represent argu‐
27 ments containing spaces. Configuration options may be separated by
28 whitespace or optional whitespace and exactly one ‘=’; the latter format
29 is useful to avoid the need to quote whitespace when specifying configu‐
30 ration options using the ssh, scp, and sftp -o option.
31
32 The possible keywords and their meanings are as follows (note that key‐
33 words are case-insensitive and arguments are case-sensitive):
34
35 Host Restricts the following declarations (up to the next Host or
36 Match keyword) to be only for those hosts that match one of the
37 patterns given after the keyword. If more than one pattern is
38 provided, they should be separated by whitespace. A single ‘*’
39 as a pattern can be used to provide global defaults for all
40 hosts. The host is usually the hostname argument given on the
41 command line (see the CanonicalizeHostname keyword for excep‐
42 tions).
43
44 A pattern entry may be negated by prefixing it with an exclama‐
45 tion mark (‘!’). If a negated entry is matched, then the Host
46 entry is ignored, regardless of whether any other patterns on the
47 line match. Negated matches are therefore useful to provide
48 exceptions for wildcard matches.
49
50 See PATTERNS for more information on patterns.
51
52 Match Restricts the following declarations (up to the next Host or
53 Match keyword) to be used only when the conditions following the
54 Match keyword are satisfied. Match conditions are specified
55 using one or more criteria or the single token all which always
56 matches. The available criteria keywords are: canonical, final,
57 exec, host, originalhost, user, and localuser. The all criteria
58 must appear alone or immediately after canonical or final. Other
59 criteria may be combined arbitrarily. All criteria but all
60 canonical and final require an argument. Criteria may be negated
61 by prepending an exclamation mark (‘!’).
62
63 The canonical keyword matches only when the configuration file is
64 being re-parsed after hostname canonicalization (see the
65 CanonicalizeHostname option.) This may be useful to specify con‐
66 ditions that work with canonical host names only.
67
68 The final keyword requests that the configuration be re-parsed
69 (regardless of whether CanonicalizeHostname is enabled), and
70 matches only during this final pass. If CanonicalizeHostname is
71 enabled, then canonical and final match during the same pass.
72
73 The exec keyword executes the specified command under the user's
74 shell. If the command returns a zero exit status then the condi‐
75 tion is considered true. Commands containing whitespace charac‐
76 ters must be quoted. Arguments to exec accept the tokens
77 described in the TOKENS section.
78
79 The other keywords' criteria must be single entries or comma-sep‐
80 arated lists and may use the wildcard and negation operators
81 described in the PATTERNS section. The criteria for the host
82 keyword are matched against the target hostname, after any sub‐
83 stitution by the Hostname or CanonicalizeHostname options. The
84 originalhost keyword matches against the hostname as it was spec‐
85 ified on the command-line. The user keyword matches against the
86 target username on the remote host. The localuser keyword
87 matches against the name of the local user running ssh(1) (this
88 keyword may be useful in system-wide ssh_config files).
89
90 AddKeysToAgent
91 Specifies whether keys should be automatically added to a running
92 ssh-agent(1). If this option is set to yes and a key is loaded
93 from a file, the key and its passphrase are added to the agent
94 with the default lifetime, as if by ssh-add(1). If this option
95 is set to ask, ssh(1) will require confirmation using the
96 SSH_ASKPASS program before adding a key (see ssh-add(1) for
97 details). If this option is set to confirm, each use of the key
98 must be confirmed, as if the -c option was specified to
99 ssh-add(1). If this option is set to no, no keys are added to
100 the agent. The argument must be yes, confirm, ask, or no (the
101 default).
102
103 AddressFamily
104 Specifies which address family to use when connecting. Valid
105 arguments are any (the default), inet (use IPv4 only), or inet6
106 (use IPv6 only).
107
108 BatchMode
109 If set to yes, passphrase/password querying will be disabled.
110 This option is useful in scripts and other batch jobs where no
111 user is present to supply the password. The argument must be yes
112 or no (the default).
113
114 BindAddress
115 Use the specified address on the local machine as the source
116 address of the connection. Only useful on systems with more than
117 one address.
118
119 BindInterface
120 Use the address of the specified interface on the local machine
121 as the source address of the connection.
122
123 CanonicalDomains
124 When CanonicalizeHostname is enabled, this option specifies the
125 list of domain suffixes in which to search for the specified des‐
126 tination host.
127
128 CanonicalizeFallbackLocal
129 Specifies whether to fail with an error when hostname canonical‐
130 ization fails. The default, yes, will attempt to look up the
131 unqualified hostname using the system resolver's search rules. A
132 value of no will cause ssh(1) to fail instantly if
133 CanonicalizeHostname is enabled and the target hostname cannot be
134 found in any of the domains specified by CanonicalDomains.
135
136 CanonicalizeHostname
137 Controls whether explicit hostname canonicalization is performed.
138 The default, no, is not to perform any name rewriting and let the
139 system resolver handle all hostname lookups. If set to yes then,
140 for connections that do not use a ProxyCommand or ProxyJump,
141 ssh(1) will attempt to canonicalize the hostname specified on the
142 command line using the CanonicalDomains suffixes and
143 CanonicalizePermittedCNAMEs rules. If CanonicalizeHostname is
144 set to always, then canonicalization is applied to proxied con‐
145 nections too.
146
147 If this option is enabled, then the configuration files are pro‐
148 cessed again using the new target name to pick up any new config‐
149 uration in matching Host and Match stanzas.
150
151 CanonicalizeMaxDots
152 Specifies the maximum number of dot characters in a hostname
153 before canonicalization is disabled. The default, 1, allows a
154 single dot (i.e. hostname.subdomain).
155
156 CanonicalizePermittedCNAMEs
157 Specifies rules to determine whether CNAMEs should be followed
158 when canonicalizing hostnames. The rules consist of one or more
159 arguments of source_domain_list:target_domain_list, where
160 source_domain_list is a pattern-list of domains that may follow
161 CNAMEs in canonicalization, and target_domain_list is a pattern-
162 list of domains that they may resolve to.
163
164 For example, "*.a.example.com:*.b.example.com,*.c.example.com"
165 will allow hostnames matching "*.a.example.com" to be canonical‐
166 ized to names in the "*.b.example.com" or "*.c.example.com"
167 domains.
168
169 CASignatureAlgorithms
170 Specifies which algorithms are allowed for signing of certifi‐
171 cates by certificate authorities (CAs). The default is:
172
173 ecdsa-sha2-nistp256.ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
174 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
175
176 ssh(1) will not accept host certificates signed using algorithms
177 other than those specified.
178
179 CertificateFile
180 Specifies a file from which the user's certificate is read. A
181 corresponding private key must be provided separately in order to
182 use this certificate either from an IdentityFile directive or -i
183 flag to ssh(1), via ssh-agent(1), or via a PKCS11Provider.
184
185 Arguments to CertificateFile may use the tilde syntax to refer to
186 a user's home directory or the tokens described in the TOKENS
187 section.
188
189 It is possible to have multiple certificate files specified in
190 configuration files; these certificates will be tried in
191 sequence. Multiple CertificateFile directives will add to the
192 list of certificates used for authentication.
193
194 ChallengeResponseAuthentication
195 Specifies whether to use challenge-response authentication. The
196 argument to this keyword must be yes (the default) or no.
197
198 CheckHostIP
199 If set to yes (the default), ssh(1) will additionally check the
200 host IP address in the known_hosts file. This allows it to
201 detect if a host key changed due to DNS spoofing and will add
202 addresses of destination hosts to ~/.ssh/known_hosts in the
203 process, regardless of the setting of StrictHostKeyChecking. If
204 the option is set to no, the check will not be executed.
205
206 Ciphers
207 Specifies the ciphers allowed and their order of preference.
208 Multiple ciphers must be comma-separated. If the specified value
209 begins with a ‘+’ character, then the specified ciphers will be
210 appended to the default set instead of replacing them. If the
211 specified value begins with a ‘-’ character, then the specified
212 ciphers (including wildcards) will be removed from the default
213 set instead of replacing them.
214
215 The supported ciphers are:
216
217 3des-cbc
218 aes128-cbc
219 aes192-cbc
220 aes256-cbc
221 aes128-ctr
222 aes192-ctr
223 aes256-ctr
224 aes128-gcm@openssh.com
225 aes256-gcm@openssh.com
226 chacha20-poly1305@openssh.com
227
228 The default is:
229
230 chacha20-poly1305@openssh.com,
231 aes128-ctr,aes192-ctr,aes256-ctr,
232 aes128-gcm@openssh.com,aes256-gcm@openssh.com
233
234 The list of available ciphers may also be obtained using "ssh -Q
235 cipher".
236
237 ClearAllForwardings
238 Specifies that all local, remote, and dynamic port forwardings
239 specified in the configuration files or on the command line be
240 cleared. This option is primarily useful when used from the
241 ssh(1) command line to clear port forwardings set in configura‐
242 tion files, and is automatically set by scp(1) and sftp(1). The
243 argument must be yes or no (the default).
244
245 Compression
246 Specifies whether to use compression. The argument must be yes
247 or no (the default).
248
249 ConnectionAttempts
250 Specifies the number of tries (one per second) to make before
251 exiting. The argument must be an integer. This may be useful in
252 scripts if the connection sometimes fails. The default is 1.
253
254 ConnectTimeout
255 Specifies the timeout (in seconds) used when connecting to the
256 SSH server, instead of using the default system TCP timeout.
257 This value is used only when the target is down or really
258 unreachable, not when it refuses the connection.
259
260 ControlMaster
261 Enables the sharing of multiple sessions over a single network
262 connection. When set to yes, ssh(1) will listen for connections
263 on a control socket specified using the ControlPath argument.
264 Additional sessions can connect to this socket using the same
265 ControlPath with ControlMaster set to no (the default). These
266 sessions will try to reuse the master instance's network connec‐
267 tion rather than initiating new ones, but will fall back to con‐
268 necting normally if the control socket does not exist, or is not
269 listening.
270
271 Setting this to ask will cause ssh(1) to listen for control con‐
272 nections, but require confirmation using ssh-askpass(1). If the
273 ControlPath cannot be opened, ssh(1) will continue without con‐
274 necting to a master instance.
275
276 X11 and ssh-agent(1) forwarding is supported over these multi‐
277 plexed connections, however the display and agent forwarded will
278 be the one belonging to the master connection i.e. it is not pos‐
279 sible to forward multiple displays or agents.
280
281 Two additional options allow for opportunistic multiplexing: try
282 to use a master connection but fall back to creating a new one if
283 one does not already exist. These options are: auto and autoask.
284 The latter requires confirmation like the ask option.
285
286 ControlPath
287 Specify the path to the control socket used for connection shar‐
288 ing as described in the ControlMaster section above or the string
289 none to disable connection sharing. Arguments to ControlPath may
290 use the tilde syntax to refer to a user's home directory or the
291 tokens described in the TOKENS section. It is recommended that
292 any ControlPath used for opportunistic connection sharing include
293 at least %h, %p, and %r (or alternatively %C) and be placed in a
294 directory that is not writable by other users. This ensures that
295 shared connections are uniquely identified.
296
297 ControlPersist
298 When used in conjunction with ControlMaster, specifies that the
299 master connection should remain open in the background (waiting
300 for future client connections) after the initial client connec‐
301 tion has been closed. If set to no, then the master connection
302 will not be placed into the background, and will close as soon as
303 the initial client connection is closed. If set to yes or 0,
304 then the master connection will remain in the background indefi‐
305 nitely (until killed or closed via a mechanism such as the "ssh
306 -O exit"). If set to a time in seconds, or a time in any of the
307 formats documented in sshd_config(5), then the backgrounded mas‐
308 ter connection will automatically terminate after it has remained
309 idle (with no client connections) for the specified time.
310
311 DynamicForward
312 Specifies that a TCP port on the local machine be forwarded over
313 the secure channel, and the application protocol is then used to
314 determine where to connect to from the remote machine.
315
316 The argument must be [bind_address:]port. IPv6 addresses can be
317 specified by enclosing addresses in square brackets. By default,
318 the local port is bound in accordance with the GatewayPorts set‐
319 ting. However, an explicit bind_address may be used to bind the
320 connection to a specific address. The bind_address of localhost
321 indicates that the listening port be bound for local use only,
322 while an empty address or ‘*’ indicates that the port should be
323 available from all interfaces.
324
325 Currently the SOCKS4 and SOCKS5 protocols are supported, and
326 ssh(1) will act as a SOCKS server. Multiple forwardings may be
327 specified, and additional forwardings can be given on the command
328 line. Only the superuser can forward privileged ports.
329
330 EnableSSHKeysign
331 Setting this option to yes in the global client configuration
332 file /etc/ssh/ssh_config enables the use of the helper program
333 ssh-keysign(8) during HostbasedAuthentication. The argument must
334 be yes or no (the default). This option should be placed in the
335 non-hostspecific section. See ssh-keysign(8) for more informa‐
336 tion.
337
338 EscapeChar
339 Sets the escape character (default: ‘~’). The escape character
340 can also be set on the command line. The argument should be a
341 single character, ‘^’ followed by a letter, or none to disable
342 the escape character entirely (making the connection transparent
343 for binary data).
344
345 ExitOnForwardFailure
346 Specifies whether ssh(1) should terminate the connection if it
347 cannot set up all requested dynamic, tunnel, local, and remote
348 port forwardings, (e.g. if either end is unable to bind and lis‐
349 ten on a specified port). Note that ExitOnForwardFailure does
350 not apply to connections made over port forwardings and will not,
351 for example, cause ssh(1) to exit if TCP connections to the ulti‐
352 mate forwarding destination fail. The argument must be yes or no
353 (the default).
354
355 FingerprintHash
356 Specifies the hash algorithm used when displaying key finger‐
357 prints. Valid options are: md5 and sha256 (the default).
358
359 ForwardAgent
360 Specifies whether the connection to the authentication agent (if
361 any) will be forwarded to the remote machine. The argument must
362 be yes or no (the default).
363
364 Agent forwarding should be enabled with caution. Users with the
365 ability to bypass file permissions on the remote host (for the
366 agent's Unix-domain socket) can access the local agent through
367 the forwarded connection. An attacker cannot obtain key material
368 from the agent, however they can perform operations on the keys
369 that enable them to authenticate using the identities loaded into
370 the agent.
371
372 ForwardX11
373 Specifies whether X11 connections will be automatically redi‐
374 rected over the secure channel and DISPLAY set. The argument
375 must be yes or no (the default).
376
377 X11 forwarding should be enabled with caution. Users with the
378 ability to bypass file permissions on the remote host (for the
379 user's X11 authorization database) can access the local X11 dis‐
380 play through the forwarded connection. An attacker may then be
381 able to perform activities such as keystroke monitoring if the
382 ForwardX11Trusted option is also enabled.
383
384 ForwardX11Timeout
385 Specify a timeout for untrusted X11 forwarding using the format
386 described in the TIME FORMATS section of sshd_config(5). X11
387 connections received by ssh(1) after this time will be refused.
388 Setting ForwardX11Timeout to zero will disable the timeout and
389 permit X11 forwarding for the life of the connection. The
390 default is to disable untrusted X11 forwarding after twenty min‐
391 utes has elapsed.
392
393 ForwardX11Trusted
394 If this option is set to yes, remote X11 clients will have full
395 access to the original X11 display.
396
397 If this option is set to no (the default), remote X11 clients
398 will be considered untrusted and prevented from stealing or tam‐
399 pering with data belonging to trusted X11 clients. Furthermore,
400 the xauth(1) token used for the session will be set to expire
401 after 20 minutes. Remote clients will be refused access after
402 this time.
403
404 See the X11 SECURITY extension specification for full details on
405 the restrictions imposed on untrusted clients.
406
407 GatewayPorts
408 Specifies whether remote hosts are allowed to connect to local
409 forwarded ports. By default, ssh(1) binds local port forwardings
410 to the loopback address. This prevents other remote hosts from
411 connecting to forwarded ports. GatewayPorts can be used to spec‐
412 ify that ssh should bind local port forwardings to the wildcard
413 address, thus allowing remote hosts to connect to forwarded
414 ports. The argument must be yes or no (the default).
415
416 GlobalKnownHostsFile
417 Specifies one or more files to use for the global host key data‐
418 base, separated by whitespace. The default is
419 /etc/ssh/ssh_known_hosts, /etc/ssh/ssh_known_hosts2.
420
421 GSSAPIAuthentication
422 Specifies whether user authentication based on GSSAPI is allowed.
423 The default is no.
424
425 GSSAPIClientIdentity
426 If set, specifies the GSSAPI client identity that ssh should use
427 when connecting to the server. The default is unset, which means
428 that the default identity will be used.
429
430 GSSAPIDelegateCredentials
431 Forward (delegate) credentials to the server. The default is no.
432
433 GSSAPIKeyExchange
434 Specifies whether key exchange based on GSSAPI may be used. When
435 using GSSAPI key exchange the server need not have a host key.
436 The default is “no”.
437
438 GSSAPIRenewalForcesRekey
439 If set to “yes” then renewal of the client's GSSAPI credentials
440 will force the rekeying of the ssh connection. With a compatible
441 server, this will delegate the renewed credentials to a session
442 on the server.
443
444 Checks are made to ensure that credentials are only propagated
445 when the new credentials match the old ones on the originating
446 client and where the receiving server still has the old set in
447 its cache.
448
449 The default is “no”.
450
451 For this to work GSSAPIKeyExchange needs to be enabled in the
452 server and also used by the client.
453
454 GSSAPIServerIdentity
455 If set, specifies the GSSAPI server identity that ssh should
456 expect when connecting to the server. The default is unset, which
457 means that the expected GSSAPI server identity will be determined
458 from the target hostname.
459
460 GSSAPITrustDns
461 Set to “yes” to indicate that the DNS is trusted to securely
462 canonicalize the name of the host being connected to. If “no”,
463 the hostname entered on the command line will be passed untouched
464 to the GSSAPI library. The default is “no”.
465
466 GSSAPIKexAlgorithms
467 The list of key exchange algorithms that are offered for GSSAPI
468 key exchange. Possible values are
469
470 gss-gex-sha1-,
471 gss-group1-sha1-,
472 gss-group14-sha1-,
473 gss-group14-sha256-,
474 gss-group16-sha512-,
475 gss-nistp256-sha256-,
476 gss-curve25519-sha256-
477
478 The default is “gss-gex-sha1-,gss-group14-sha1-”. This option
479 only applies to protocol version 2 connections using GSSAPI.
480
481 HashKnownHosts
482 Indicates that ssh(1) should hash host names and addresses when
483 they are added to ~/.ssh/known_hosts. These hashed names may be
484 used normally by ssh(1) and sshd(8), but they do not reveal iden‐
485 tifying information should the file's contents be disclosed. The
486 default is no. Note that existing names and addresses in known
487 hosts files will not be converted automatically, but may be manu‐
488 ally hashed using ssh-keygen(1).
489
490 HostbasedAuthentication
491 Specifies whether to try rhosts based authentication with public
492 key authentication. The argument must be yes or no (the
493 default).
494
495 HostbasedKeyTypes
496 Specifies the key types that will be used for hostbased authenti‐
497 cation as a comma-separated list of patterns. Alternately if the
498 specified value begins with a ‘+’ character, then the specified
499 key types will be appended to the default set instead of replac‐
500 ing them. If the specified value begins with a ‘-’ character,
501 then the specified key types (including wildcards) will be
502 removed from the default set instead of replacing them. The
503 default for this option is:
504
505 ecdsa-sha2-nistp256-cert-v01@openssh.com,
506 ecdsa-sha2-nistp384-cert-v01@openssh.com,
507 ecdsa-sha2-nistp521-cert-v01@openssh.com,
508 ssh-ed25519-cert-v01@openssh.com,
509 rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,
510 ssh-rsa-cert-v01@openssh.com,
511 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
512 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
513
514 The -Q option of ssh(1) may be used to list supported key types.
515
516 HostKeyAlgorithms
517 Specifies the host key algorithms that the client wants to use in
518 order of preference. Alternately if the specified value begins
519 with a ‘+’ character, then the specified key types will be
520 appended to the default set instead of replacing them. If the
521 specified value begins with a ‘-’ character, then the specified
522 key types (including wildcards) will be removed from the default
523 set instead of replacing them. The default for this option is:
524
525 ecdsa-sha2-nistp256-cert-v01@openssh.com,
526 ecdsa-sha2-nistp384-cert-v01@openssh.com,
527 ecdsa-sha2-nistp521-cert-v01@openssh.com,
528 ssh-ed25519-cert-v01@openssh.com,
529 rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,
530 ssh-rsa-cert-v01@openssh.com,
531 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
532 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
533
534 If hostkeys are known for the destination host then this default
535 is modified to prefer their algorithms.
536
537 The list of available key types may also be obtained using "ssh
538 -Q key".
539
540 HostKeyAlias
541 Specifies an alias that should be used instead of the real host
542 name when looking up or saving the host key in the host key data‐
543 base files and when validating host certificates. This option is
544 useful for tunneling SSH connections or for multiple servers run‐
545 ning on a single host.
546
547 HostName
548 Specifies the real host name to log into. This can be used to
549 specify nicknames or abbreviations for hosts. Arguments to
550 HostName accept the tokens described in the TOKENS section.
551 Numeric IP addresses are also permitted (both on the command line
552 and in HostName specifications). The default is the name given
553 on the command line.
554
555 IdentitiesOnly
556 Specifies that ssh(1) should only use the authentication identity
557 and certificate files explicitly configured in the ssh_config
558 files or passed on the ssh(1) command-line, even if ssh-agent(1)
559 or a PKCS11Provider offers more identities. The argument to this
560 keyword must be yes or no (the default). This option is intended
561 for situations where ssh-agent offers many different identities.
562
563 IdentityAgent
564 Specifies the UNIX-domain socket used to communicate with the
565 authentication agent.
566
567 This option overrides the SSH_AUTH_SOCK environment variable and
568 can be used to select a specific agent. Setting the socket name
569 to none disables the use of an authentication agent. If the
570 string "SSH_AUTH_SOCK" is specified, the location of the socket
571 will be read from the SSH_AUTH_SOCK environment variable. Other‐
572 wise if the specified value begins with a ‘$’ character, then it
573 will be treated as an environment variable containing the loca‐
574 tion of the socket.
575
576 Arguments to IdentityAgent may use the tilde syntax to refer to a
577 user's home directory or the tokens described in the TOKENS sec‐
578 tion.
579
580 IdentityFile
581 Specifies a file from which the user's DSA, ECDSA, Ed25519 or RSA
582 authentication identity is read. The default is ~/.ssh/id_dsa,
583 ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 and ~/.ssh/id_rsa. Addition‐
584 ally, any identities represented by the authentication agent will
585 be used for authentication unless IdentitiesOnly is set. If no
586 certificates have been explicitly specified by CertificateFile,
587 ssh(1) will try to load certificate information from the filename
588 obtained by appending -cert.pub to the path of a specified
589 IdentityFile.
590
591 Arguments to IdentityFile may use the tilde syntax to refer to a
592 user's home directory or the tokens described in the TOKENS sec‐
593 tion.
594
595 It is possible to have multiple identity files specified in con‐
596 figuration files; all these identities will be tried in sequence.
597 Multiple IdentityFile directives will add to the list of identi‐
598 ties tried (this behaviour differs from that of other configura‐
599 tion directives).
600
601 IdentityFile may be used in conjunction with IdentitiesOnly to
602 select which identities in an agent are offered during authenti‐
603 cation. IdentityFile may also be used in conjunction with
604 CertificateFile in order to provide any certificate also needed
605 for authentication with the identity.
606
607 The authentication identity can be also specified in a form of
608 PKCS#11 URI starting with a string pkcs11:. There is supported a
609 subset of the PKCS#11 URI as defined in RFC 7512 (implemented
610 path arguments id, manufacturer, object, token and query argument
611 module-path ). The URI can not be in quotes.
612
613 IgnoreUnknown
614 Specifies a pattern-list of unknown options to be ignored if they
615 are encountered in configuration parsing. This may be used to
616 suppress errors if ssh_config contains options that are unrecog‐
617 nised by ssh(1). It is recommended that IgnoreUnknown be listed
618 early in the configuration file as it will not be applied to
619 unknown options that appear before it.
620
621 Include
622 Include the specified configuration file(s). Multiple pathnames
623 may be specified and each pathname may contain glob(7) wildcards
624 and, for user configurations, shell-like ‘~’ references to user
625 home directories. Files without absolute paths are assumed to be
626 in ~/.ssh if included in a user configuration file or /etc/ssh if
627 included from the system configuration file. Include directive
628 may appear inside a Match or Host block to perform conditional
629 inclusion.
630
631 IPQoS Specifies the IPv4 type-of-service or DSCP class for connections.
632 Accepted values are af11, af12, af13, af21, af22, af23, af31,
633 af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6,
634 cs7, ef, lowdelay, throughput, reliability, a numeric value, or
635 none to use the operating system default. This option may take
636 one or two arguments, separated by whitespace. If one argument
637 is specified, it is used as the packet class unconditionally. If
638 two values are specified, the first is automatically selected for
639 interactive sessions and the second for non-interactive sessions.
640 The default is af21 (Low-Latency Data) for interactive sessions
641 and cs1 (Lower Effort) for non-interactive sessions.
642
643 KbdInteractiveAuthentication
644 Specifies whether to use keyboard-interactive authentication.
645 The argument to this keyword must be yes (the default) or no.
646
647 KbdInteractiveDevices
648 Specifies the list of methods to use in keyboard-interactive
649 authentication. Multiple method names must be comma-separated.
650 The default is to use the server specified list. The methods
651 available vary depending on what the server supports. For an
652 OpenSSH server, it may be zero or more of: bsdauth and pam.
653
654 KexAlgorithms
655 Specifies the available KEX (Key Exchange) algorithms. Multiple
656 algorithms must be comma-separated. Alternately if the specified
657 value begins with a ‘+’ character, then the specified methods
658 will be appended to the default set instead of replacing them.
659 If the specified value begins with a ‘-’ character, then the
660 specified methods (including wildcards) will be removed from the
661 default set instead of replacing them. The default is:
662
663 curve25519-sha256,curve25519-sha256@libssh.org,
664 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
665 diffie-hellman-group-exchange-sha256,
666 diffie-hellman-group16-sha512,
667 diffie-hellman-group18-sha512,
668 diffie-hellman-group-exchange-sha1,
669 diffie-hellman-group14-sha256,
670 diffie-hellman-group14-sha1
671
672 The list of available key exchange algorithms may also be
673 obtained using "ssh -Q kex".
674
675 LocalCommand
676 Specifies a command to execute on the local machine after suc‐
677 cessfully connecting to the server. The command string extends
678 to the end of the line, and is executed with the user's shell.
679 Arguments to LocalCommand accept the tokens described in the
680 TOKENS section.
681
682 The command is run synchronously and does not have access to the
683 session of the ssh(1) that spawned it. It should not be used for
684 interactive commands.
685
686 This directive is ignored unless PermitLocalCommand has been
687 enabled.
688
689 LocalForward
690 Specifies that a TCP port on the local machine be forwarded over
691 the secure channel to the specified host and port from the remote
692 machine. The first argument must be [bind_address:]port and the
693 second argument must be host:hostport. IPv6 addresses can be
694 specified by enclosing addresses in square brackets. Multiple
695 forwardings may be specified, and additional forwardings can be
696 given on the command line. Only the superuser can forward privi‐
697 leged ports. By default, the local port is bound in accordance
698 with the GatewayPorts setting. However, an explicit bind_address
699 may be used to bind the connection to a specific address. The
700 bind_address of localhost indicates that the listening port be
701 bound for local use only, while an empty address or ‘*’ indicates
702 that the port should be available from all interfaces.
703
704 LogLevel
705 Gives the verbosity level that is used when logging messages from
706 ssh(1). The possible values are: QUIET, FATAL, ERROR, INFO, VER‐
707 BOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
708 DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify
709 higher levels of verbose output.
710
711 MACs Specifies the MAC (message authentication code) algorithms in
712 order of preference. The MAC algorithm is used for data
713 integrity protection. Multiple algorithms must be comma-sepa‐
714 rated. If the specified value begins with a ‘+’ character, then
715 the specified algorithms will be appended to the default set
716 instead of replacing them. If the specified value begins with a
717 ‘-’ character, then the specified algorithms (including wild‐
718 cards) will be removed from the default set instead of replacing
719 them.
720
721 The algorithms that contain "-etm" calculate the MAC after
722 encryption (encrypt-then-mac). These are considered safer and
723 their use recommended.
724
725 The default is:
726
727 umac-64-etm@openssh.com,umac-128-etm@openssh.com,
728 hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
729 hmac-sha1-etm@openssh.com,
730 umac-64@openssh.com,umac-128@openssh.com,
731 hmac-sha2-256,hmac-sha2-512,hmac-sha1
732
733 The list of available MAC algorithms may also be obtained using
734 "ssh -Q mac".
735
736 NoHostAuthenticationForLocalhost
737 Disable host authentication for localhost (loopback addresses).
738 The argument to this keyword must be yes or no (the default).
739
740 NumberOfPasswordPrompts
741 Specifies the number of password prompts before giving up. The
742 argument to this keyword must be an integer. The default is 3.
743
744 PasswordAuthentication
745 Specifies whether to use password authentication. The argument
746 to this keyword must be yes (the default) or no.
747
748 PermitLocalCommand
749 Allow local command execution via the LocalCommand option or
750 using the !command escape sequence in ssh(1). The argument must
751 be yes or no (the default).
752
753 PKCS11Provider
754 Specifies which PKCS#11 provider to use. The argument to this
755 keyword is the PKCS#11 shared library ssh(1) should use to commu‐
756 nicate with a PKCS#11 token providing the user's private RSA key.
757
758 Port Specifies the port number to connect on the remote host. The
759 default is 22.
760
761 PreferredAuthentications
762 Specifies the order in which the client should try authentication
763 methods. This allows a client to prefer one method (e.g.
764 keyboard-interactive) over another method (e.g. password). The
765 default is:
766
767 gssapi-with-mic,hostbased,publickey,
768 keyboard-interactive,password
769
770 ProxyCommand
771 Specifies the command to use to connect to the server. The com‐
772 mand string extends to the end of the line, and is executed using
773 the user's shell ‘exec’ directive to avoid a lingering shell
774 process.
775
776 Arguments to ProxyCommand accept the tokens described in the
777 TOKENS section. The command can be basically anything, and
778 should read from its standard input and write to its standard
779 output. It should eventually connect an sshd(8) server running
780 on some machine, or execute sshd -i somewhere. Host key manage‐
781 ment will be done using the HostName of the host being connected
782 (defaulting to the name typed by the user). Setting the command
783 to none disables this option entirely. Note that CheckHostIP is
784 not available for connects with a proxy command.
785
786 This directive is useful in conjunction with nc(1) and its proxy
787 support. For example, the following directive would connect via
788 an HTTP proxy at 192.0.2.0:
789
790 ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p
791
792 ProxyJump
793 Specifies one or more jump proxies as either [user@]host[:port]
794 or an ssh URI. Multiple proxies may be separated by comma char‐
795 acters and will be visited sequentially. Setting this option
796 will cause ssh(1) to connect to the target host by first making a
797 ssh(1) connection to the specified ProxyJump host and then estab‐
798 lishing a TCP forwarding to the ultimate target from there.
799
800 Note that this option will compete with the ProxyCommand option -
801 whichever is specified first will prevent later instances of the
802 other from taking effect.
803
804 ProxyUseFdpass
805 Specifies that ProxyCommand will pass a connected file descriptor
806 back to ssh(1) instead of continuing to execute and pass data.
807 The default is no.
808
809 PubkeyAcceptedKeyTypes
810 Specifies the key types that will be used for public key authen‐
811 tication as a comma-separated list of patterns. Alternately if
812 the specified value begins with a ‘+’ character, then the key
813 types after it will be appended to the default instead of replac‐
814 ing it. If the specified value begins with a ‘-’ character, then
815 the specified key types (including wildcards) will be removed
816 from the default set instead of replacing them. The default for
817 this option is:
818
819 ecdsa-sha2-nistp256-cert-v01@openssh.com,
820 ecdsa-sha2-nistp384-cert-v01@openssh.com,
821 ecdsa-sha2-nistp521-cert-v01@openssh.com,
822 ssh-ed25519-cert-v01@openssh.com,
823 rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,
824 ssh-rsa-cert-v01@openssh.com,
825 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
826 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
827
828 The list of available key types may also be obtained using "ssh
829 -Q key".
830
831 PubkeyAuthentication
832 Specifies whether to try public key authentication. The argument
833 to this keyword must be yes (the default) or no.
834
835 RekeyLimit
836 Specifies the maximum amount of data that may be transmitted
837 before the session key is renegotiated, optionally followed a
838 maximum amount of time that may pass before the session key is
839 renegotiated. The first argument is specified in bytes and may
840 have a suffix of ‘K’, ‘M’, or ‘G’ to indicate Kilobytes,
841 Megabytes, or Gigabytes, respectively. The default is between
842 ‘1G’ and ‘4G’, depending on the cipher. The optional second
843 value is specified in seconds and may use any of the units docu‐
844 mented in the TIME FORMATS section of sshd_config(5). The
845 default value for RekeyLimit is default none, which means that
846 rekeying is performed after the cipher's default amount of data
847 has been sent or received and no time based rekeying is done.
848
849 RemoteCommand
850 Specifies a command to execute on the remote machine after suc‐
851 cessfully connecting to the server. The command string extends
852 to the end of the line, and is executed with the user's shell.
853 Arguments to RemoteCommand accept the tokens described in the
854 TOKENS section.
855
856 RemoteForward
857 Specifies that a TCP port on the remote machine be forwarded over
858 the secure channel. The remote port may either be forwarded to a
859 specified host and port from the local machine, or may act as a
860 SOCKS 4/5 proxy that allows a remote client to connect to arbi‐
861 trary destinations from the local machine. The first argument
862 must be [bind_address:]port If forwarding to a specific destina‐
863 tion then the second argument must be host:hostport, otherwise if
864 no destination argument is specified then the remote forwarding
865 will be established as a SOCKS proxy.
866
867 IPv6 addresses can be specified by enclosing addresses in square
868 brackets. Multiple forwardings may be specified, and additional
869 forwardings can be given on the command line. Privileged ports
870 can be forwarded only when logging in as root on the remote
871 machine.
872
873 If the port argument is 0, the listen port will be dynamically
874 allocated on the server and reported to the client at run time.
875
876 If the bind_address is not specified, the default is to only bind
877 to loopback addresses. If the bind_address is ‘*’ or an empty
878 string, then the forwarding is requested to listen on all inter‐
879 faces. Specifying a remote bind_address will only succeed if the
880 server's GatewayPorts option is enabled (see sshd_config(5)).
881
882 RequestTTY
883 Specifies whether to request a pseudo-tty for the session. The
884 argument may be one of: no (never request a TTY), yes (always
885 request a TTY when standard input is a TTY), force (always
886 request a TTY) or auto (request a TTY when opening a login ses‐
887 sion). This option mirrors the -t and -T flags for ssh(1).
888
889 RevokedHostKeys
890 Specifies revoked host public keys. Keys listed in this file
891 will be refused for host authentication. Note that if this file
892 does not exist or is not readable, then host authentication will
893 be refused for all hosts. Keys may be specified as a text file,
894 listing one public key per line, or as an OpenSSH Key Revocation
895 List (KRL) as generated by ssh-keygen(1). For more information
896 on KRLs, see the KEY REVOCATION LISTS section in ssh-keygen(1).
897
898 SendEnv
899 Specifies what variables from the local environ(7) should be sent
900 to the server. The server must also support it, and the server
901 must be configured to accept these environment variables. Note
902 that the TERM environment variable is always sent whenever a
903 pseudo-terminal is requested as it is required by the protocol.
904 Refer to AcceptEnv in sshd_config(5) for how to configure the
905 server. Variables are specified by name, which may contain wild‐
906 card characters. Multiple environment variables may be separated
907 by whitespace or spread across multiple SendEnv directives.
908
909 See PATTERNS for more information on patterns.
910
911 It is possible to clear previously set SendEnv variable names by
912 prefixing patterns with -. The default is not to send any envi‐
913 ronment variables.
914
915 ServerAliveCountMax
916 Sets the number of server alive messages (see below) which may be
917 sent without ssh(1) receiving any messages back from the server.
918 If this threshold is reached while server alive messages are
919 being sent, ssh will disconnect from the server, terminating the
920 session. It is important to note that the use of server alive
921 messages is very different from TCPKeepAlive (below). The server
922 alive messages are sent through the encrypted channel and there‐
923 fore will not be spoofable. The TCP keepalive option enabled by
924 TCPKeepAlive is spoofable. The server alive mechanism is valu‐
925 able when the client or server depend on knowing when a connec‐
926 tion has become inactive.
927
928 The default value is 3. If, for example, ServerAliveInterval
929 (see below) is set to 15 and ServerAliveCountMax is left at the
930 default, if the server becomes unresponsive, ssh will disconnect
931 after approximately 45 seconds.
932
933 ServerAliveInterval
934 Sets a timeout interval in seconds after which if no data has
935 been received from the server, ssh(1) will send a message through
936 the encrypted channel to request a response from the server. The
937 default is 0, indicating that these messages will not be sent to
938 the server.
939
940 SetEnv Directly specify one or more environment variables and their con‐
941 tents to be sent to the server. Similarly to SendEnv, the server
942 must be prepared to accept the environment variable.
943
944 StreamLocalBindMask
945 Sets the octal file creation mode mask (umask) used when creating
946 a Unix-domain socket file for local or remote port forwarding.
947 This option is only used for port forwarding to a Unix-domain
948 socket file.
949
950 The default value is 0177, which creates a Unix-domain socket
951 file that is readable and writable only by the owner. Note that
952 not all operating systems honor the file mode on Unix-domain
953 socket files.
954
955 StreamLocalBindUnlink
956 Specifies whether to remove an existing Unix-domain socket file
957 for local or remote port forwarding before creating a new one.
958 If the socket file already exists and StreamLocalBindUnlink is
959 not enabled, ssh will be unable to forward the port to the Unix-
960 domain socket file. This option is only used for port forwarding
961 to a Unix-domain socket file.
962
963 The argument must be yes or no (the default).
964
965 StrictHostKeyChecking
966 If this flag is set to yes, ssh(1) will never automatically add
967 host keys to the ~/.ssh/known_hosts file, and refuses to connect
968 to hosts whose host key has changed. This provides maximum pro‐
969 tection against man-in-the-middle (MITM) attacks, though it can
970 be annoying when the /etc/ssh/ssh_known_hosts file is poorly
971 maintained or when connections to new hosts are frequently made.
972 This option forces the user to manually add all new hosts.
973
974 If this flag is set to “accept-new” then ssh will automatically
975 add new host keys to the user known hosts files, but will not
976 permit connections to hosts with changed host keys. If this flag
977 is set to “no” or “off”, ssh will automatically add new host keys
978 to the user known hosts files and allow connections to hosts with
979 changed hostkeys to proceed, subject to some restrictions. If
980 this flag is set to ask (the default), new host keys will be
981 added to the user known host files only after the user has con‐
982 firmed that is what they really want to do, and ssh will refuse
983 to connect to hosts whose host key has changed. The host keys of
984 known hosts will be verified automatically in all cases.
985
986 SyslogFacility
987 Gives the facility code that is used when logging messages from
988 ssh(1). The possible values are: DAEMON, USER, AUTH, LOCAL0,
989 LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The
990 default is USER.
991
992 TCPKeepAlive
993 Specifies whether the system should send TCP keepalive messages
994 to the other side. If they are sent, death of the connection or
995 crash of one of the machines will be properly noticed. However,
996 this means that connections will die if the route is down tempo‐
997 rarily, and some people find it annoying.
998
999 The default is yes (to send TCP keepalive messages), and the
1000 client will notice if the network goes down or the remote host
1001 dies. This is important in scripts, and many users want it too.
1002
1003 To disable TCP keepalive messages, the value should be set to no.
1004 See also ServerAliveInterval for protocol-level keepalives.
1005
1006 Tunnel Request tun(4) device forwarding between the client and the
1007 server. The argument must be yes, point-to-point (layer 3),
1008 ethernet (layer 2), or no (the default). Specifying yes requests
1009 the default tunnel mode, which is point-to-point.
1010
1011 TunnelDevice
1012 Specifies the tun(4) devices to open on the client (local_tun)
1013 and the server (remote_tun).
1014
1015 The argument must be local_tun[:remote_tun]. The devices may be
1016 specified by numerical ID or the keyword any, which uses the next
1017 available tunnel device. If remote_tun is not specified, it
1018 defaults to any. The default is any:any.
1019
1020 UpdateHostKeys
1021 Specifies whether ssh(1) should accept notifications of addi‐
1022 tional hostkeys from the server sent after authentication has
1023 completed and add them to UserKnownHostsFile. The argument must
1024 be yes, no (the default) or ask. Enabling this option allows
1025 learning alternate hostkeys for a server and supports graceful
1026 key rotation by allowing a server to send replacement public keys
1027 before old ones are removed. Additional hostkeys are only
1028 accepted if the key used to authenticate the host was already
1029 trusted or explicitly accepted by the user. If UpdateHostKeys is
1030 set to ask, then the user is asked to confirm the modifications
1031 to the known_hosts file. Confirmation is currently incompatible
1032 with ControlPersist, and will be disabled if it is enabled.
1033
1034 Presently, only sshd(8) from OpenSSH 6.8 and greater support the
1035 "hostkeys@openssh.com" protocol extension used to inform the
1036 client of all the server's hostkeys.
1037
1038 User Specifies the user to log in as. This can be useful when a dif‐
1039 ferent user name is used on different machines. This saves the
1040 trouble of having to remember to give the user name on the com‐
1041 mand line.
1042
1043 UserKnownHostsFile
1044 Specifies one or more files to use for the user host key data‐
1045 base, separated by whitespace. The default is
1046 ~/.ssh/known_hosts, ~/.ssh/known_hosts2.
1047
1048 VerifyHostKeyDNS
1049 Specifies whether to verify the remote key using DNS and SSHFP
1050 resource records. If this option is set to yes, the client will
1051 implicitly trust keys that match a secure fingerprint from DNS.
1052 Insecure fingerprints will be handled as if this option was set
1053 to ask. If this option is set to ask, information on fingerprint
1054 match will be displayed, but the user will still need to confirm
1055 new host keys according to the StrictHostKeyChecking option. The
1056 default is no.
1057
1058 See also VERIFYING HOST KEYS in ssh(1).
1059
1060 VisualHostKey
1061 If this flag is set to yes, an ASCII art representation of the
1062 remote host key fingerprint is printed in addition to the finger‐
1063 print string at login and for unknown host keys. If this flag is
1064 set to no (the default), no fingerprint strings are printed at
1065 login and only the fingerprint string will be printed for unknown
1066 host keys.
1067
1068 XAuthLocation
1069 Specifies the full pathname of the xauth(1) program. The default
1070 is /usr/bin/xauth.
1071
1073 A pattern consists of zero or more non-whitespace characters, ‘*’ (a
1074 wildcard that matches zero or more characters), or ‘?’ (a wildcard that
1075 matches exactly one character). For example, to specify a set of decla‐
1076 rations for any host in the ".co.uk" set of domains, the following pat‐
1077 tern could be used:
1078
1079 Host *.co.uk
1080
1081 The following pattern would match any host in the 192.168.0.[0-9] network
1082 range:
1083
1084 Host 192.168.0.?
1085
1086 A pattern-list is a comma-separated list of patterns. Patterns within
1087 pattern-lists may be negated by preceding them with an exclamation mark
1088 (‘!’). For example, to allow a key to be used from anywhere within an
1089 organization except from the "dialup" pool, the following entry (in
1090 authorized_keys) could be used:
1091
1092 from="!*.dialup.example.com,*.example.com"
1093
1094 Note that a negated match will never produce a positive result by itself.
1095 For example, attempting to match "host3" against the following pattern-
1096 list will fail:
1097
1098 from="!host1,!host2"
1099
1100 The solution here is to include a term that will yield a positive match,
1101 such as a wildcard:
1102
1103 from="!host1,!host2,*"
1104
1106 Arguments to some keywords can make use of tokens, which are expanded at
1107 runtime:
1108
1109 %% A literal ‘%’.
1110 %C Hash of %l%h%p%r.
1111 %d Local user's home directory.
1112 %h The remote hostname.
1113 %i The local user ID.
1114 %L The local hostname.
1115 %l The local hostname, including the domain name.
1116 %n The original remote hostname, as given on the command line.
1117 %p The remote port.
1118 %r The remote username.
1119 %T The local tun(4) or tap(4) network interface assigned if tun‐
1120 nel forwarding was requested, or "NONE" otherwise.
1121 %u The local username.
1122
1123 Match exec accepts the tokens %%, %h, %i, %L, %l, %n, %p, %r, and %u.
1124
1125 CertificateFile accepts the tokens %%, %d, %h, %i, %l, %r, and %u.
1126
1127 ControlPath accepts the tokens %%, %C, %h, %i, %L, %l, %n, %p, %r, and
1128 %u.
1129
1130 HostName accepts the tokens %% and %h.
1131
1132 IdentityAgent and IdentityFile accept the tokens %%, %d, %h, %i, %l, %r,
1133 and %u.
1134
1135 LocalCommand accepts the tokens %%, %C, %d, %h, %i, %l, %n, %p, %r, %T,
1136 and %u.
1137
1138 ProxyCommand accepts the tokens %%, %h, %p, and %r.
1139
1140 RemoteCommand accepts the tokens %%, %C, %d, %h, %i, %l, %n, %p, %r, and
1141 %u.
1142
1144 ~/.ssh/config
1145 This is the per-user configuration file. The format of this file
1146 is described above. This file is used by the SSH client.
1147 Because of the potential for abuse, this file must have strict
1148 permissions: read/write for the user, and not accessible by oth‐
1149 ers.
1150
1151 /etc/ssh/ssh_config
1152 Systemwide configuration file. This file provides defaults for
1153 those values that are not specified in the user's configuration
1154 file, and for those users who do not have a configuration file.
1155 This file must be world-readable.
1156
1158 ssh(1)
1159
1161 OpenSSH is a derivative of the original and free ssh 1.2.12 release by
1162 Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
1163 de Raadt and Dug Song removed many bugs, re-added newer features and cre‐
1164 ated OpenSSH. Markus Friedl contributed the support for SSH protocol
1165 versions 1.5 and 2.0.
1166
1167BSD June 20, 2019 BSD