xref: /openbsd-src/usr.bin/ssh/ssh_config.5 (revision 24bb5fcea3ed904bc467217bdaadb5dfc618d5bf)
1.\"
2.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
3.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4.\"                    All rights reserved
5.\"
6.\" As far as I am concerned, the code I have written for this software
7.\" can be used freely for any purpose.  Any derived versions of this
8.\" software must be clearly marked as such, and if the derived work is
9.\" incompatible with the protocol description in the RFC file, it must be
10.\" called by a name other than "ssh" or "Secure Shell".
11.\"
12.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
13.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
14.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
15.\"
16.\" Redistribution and use in source and binary forms, with or without
17.\" modification, are permitted provided that the following conditions
18.\" are met:
19.\" 1. Redistributions of source code must retain the above copyright
20.\"    notice, this list of conditions and the following disclaimer.
21.\" 2. Redistributions in binary form must reproduce the above copyright
22.\"    notice, this list of conditions and the following disclaimer in the
23.\"    documentation and/or other materials provided with the distribution.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\"
36.\" $OpenBSD: ssh_config.5,v 1.359 2021/07/23 04:04:52 djm Exp $
37.Dd $Mdocdate: July 23 2021 $
38.Dt SSH_CONFIG 5
39.Os
40.Sh NAME
41.Nm ssh_config
42.Nd OpenSSH client configuration file
43.Sh DESCRIPTION
44.Xr ssh 1
45obtains configuration data from the following sources in
46the following order:
47.Pp
48.Bl -enum -offset indent -compact
49.It
50command-line options
51.It
52user's configuration file
53.Pq Pa ~/.ssh/config
54.It
55system-wide configuration file
56.Pq Pa /etc/ssh/ssh_config
57.El
58.Pp
59For each parameter, the first obtained value
60will be used.
61The configuration files contain sections separated by
62.Cm Host
63specifications, and that section is only applied for hosts that
64match one of the patterns given in the specification.
65The matched host name is usually the one given on the command line
66(see the
67.Cm CanonicalizeHostname
68option for exceptions).
69.Pp
70Since the first obtained value for each parameter is used, more
71host-specific declarations should be given near the beginning of the
72file, and general defaults at the end.
73.Pp
74The file contains keyword-argument pairs, one per line.
75Lines starting with
76.Ql #
77and empty lines are interpreted as comments.
78Arguments may optionally be enclosed in double quotes
79.Pq \&"
80in order to represent arguments containing spaces.
81Configuration options may be separated by whitespace or
82optional whitespace and exactly one
83.Ql = ;
84the latter format is useful to avoid the need to quote whitespace
85when specifying configuration options using the
86.Nm ssh ,
87.Nm scp ,
88and
89.Nm sftp
90.Fl o
91option.
92.Pp
93The possible
94keywords and their meanings are as follows (note that
95keywords are case-insensitive and arguments are case-sensitive):
96.Bl -tag -width Ds
97.It Cm Host
98Restricts the following declarations (up to the next
99.Cm Host
100or
101.Cm Match
102keyword) to be only for those hosts that match one of the patterns
103given after the keyword.
104If more than one pattern is provided, they should be separated by whitespace.
105A single
106.Ql *
107as a pattern can be used to provide global
108defaults for all hosts.
109The host is usually the
110.Ar hostname
111argument given on the command line
112(see the
113.Cm CanonicalizeHostname
114keyword for exceptions).
115.Pp
116A pattern entry may be negated by prefixing it with an exclamation mark
117.Pq Sq !\& .
118If a negated entry is matched, then the
119.Cm Host
120entry is ignored, regardless of whether any other patterns on the line
121match.
122Negated matches are therefore useful to provide exceptions for wildcard
123matches.
124.Pp
125See
126.Sx PATTERNS
127for more information on patterns.
128.It Cm Match
129Restricts the following declarations (up to the next
130.Cm Host
131or
132.Cm Match
133keyword) to be used only when the conditions following the
134.Cm Match
135keyword are satisfied.
136Match conditions are specified using one or more criteria
137or the single token
138.Cm all
139which always matches.
140The available criteria keywords are:
141.Cm canonical ,
142.Cm final ,
143.Cm exec ,
144.Cm host ,
145.Cm originalhost ,
146.Cm user ,
147and
148.Cm localuser .
149The
150.Cm all
151criteria must appear alone or immediately after
152.Cm canonical
153or
154.Cm final .
155Other criteria may be combined arbitrarily.
156All criteria but
157.Cm all ,
158.Cm canonical ,
159and
160.Cm final
161require an argument.
162Criteria may be negated by prepending an exclamation mark
163.Pq Sq !\& .
164.Pp
165The
166.Cm canonical
167keyword matches only when the configuration file is being re-parsed
168after hostname canonicalization (see the
169.Cm CanonicalizeHostname
170option).
171This may be useful to specify conditions that work with canonical host
172names only.
173.Pp
174The
175.Cm final
176keyword requests that the configuration be re-parsed (regardless of whether
177.Cm CanonicalizeHostname
178is enabled), and matches only during this final pass.
179If
180.Cm CanonicalizeHostname
181is enabled, then
182.Cm canonical
183and
184.Cm final
185match during the same pass.
186.Pp
187The
188.Cm exec
189keyword executes the specified command under the user's shell.
190If the command returns a zero exit status then the condition is considered true.
191Commands containing whitespace characters must be quoted.
192Arguments to
193.Cm exec
194accept the tokens described in the
195.Sx TOKENS
196section.
197.Pp
198The other keywords' criteria must be single entries or comma-separated
199lists and may use the wildcard and negation operators described in the
200.Sx PATTERNS
201section.
202The criteria for the
203.Cm host
204keyword are matched against the target hostname, after any substitution
205by the
206.Cm Hostname
207or
208.Cm CanonicalizeHostname
209options.
210The
211.Cm originalhost
212keyword matches against the hostname as it was specified on the command-line.
213The
214.Cm user
215keyword matches against the target username on the remote host.
216The
217.Cm localuser
218keyword matches against the name of the local user running
219.Xr ssh 1
220(this keyword may be useful in system-wide
221.Nm
222files).
223.It Cm AddKeysToAgent
224Specifies whether keys should be automatically added to a running
225.Xr ssh-agent 1 .
226If this option is set to
227.Cm yes
228and a key is loaded from a file, the key and its passphrase are added to
229the agent with the default lifetime, as if by
230.Xr ssh-add 1 .
231If this option is set to
232.Cm ask ,
233.Xr ssh 1
234will require confirmation using the
235.Ev SSH_ASKPASS
236program before adding a key (see
237.Xr ssh-add 1
238for details).
239If this option is set to
240.Cm confirm ,
241each use of the key must be confirmed, as if the
242.Fl c
243option was specified to
244.Xr ssh-add 1 .
245If this option is set to
246.Cm no ,
247no keys are added to the agent.
248Alternately, this option may be specified as a time interval
249using the format described in the
250.Sx TIME FORMATS
251section of
252.Xr sshd_config 5
253to specify the key's lifetime in
254.Xr ssh-agent 1 ,
255after which it will automatically be removed.
256The argument must be
257.Cm no
258(the default),
259.Cm yes ,
260.Cm confirm
261(optionally followed by a time interval),
262.Cm ask
263or a time interval.
264.It Cm AddressFamily
265Specifies which address family to use when connecting.
266Valid arguments are
267.Cm any
268(the default),
269.Cm inet
270(use IPv4 only), or
271.Cm inet6
272(use IPv6 only).
273.It Cm BatchMode
274If set to
275.Cm yes ,
276user interaction such as password prompts and host key confirmation requests
277will be disabled.
278This option is useful in scripts and other batch jobs where no user
279is present to interact with
280.Xr ssh 1 .
281The argument must be
282.Cm yes
283or
284.Cm no
285(the default).
286.It Cm BindAddress
287Use the specified address on the local machine as the source address of
288the connection.
289Only useful on systems with more than one address.
290.It Cm BindInterface
291Use the address of the specified interface on the local machine as the
292source address of the connection.
293.It Cm CanonicalDomains
294When
295.Cm CanonicalizeHostname
296is enabled, this option specifies the list of domain suffixes in which to
297search for the specified destination host.
298.It Cm CanonicalizeFallbackLocal
299Specifies whether to fail with an error when hostname canonicalization fails.
300The default,
301.Cm yes ,
302will attempt to look up the unqualified hostname using the system resolver's
303search rules.
304A value of
305.Cm no
306will cause
307.Xr ssh 1
308to fail instantly if
309.Cm CanonicalizeHostname
310is enabled and the target hostname cannot be found in any of the domains
311specified by
312.Cm CanonicalDomains .
313.It Cm CanonicalizeHostname
314Controls whether explicit hostname canonicalization is performed.
315The default,
316.Cm no ,
317is not to perform any name rewriting and let the system resolver handle all
318hostname lookups.
319If set to
320.Cm yes
321then, for connections that do not use a
322.Cm ProxyCommand
323or
324.Cm ProxyJump ,
325.Xr ssh 1
326will attempt to canonicalize the hostname specified on the command line
327using the
328.Cm CanonicalDomains
329suffixes and
330.Cm CanonicalizePermittedCNAMEs
331rules.
332If
333.Cm CanonicalizeHostname
334is set to
335.Cm always ,
336then canonicalization is applied to proxied connections too.
337.Pp
338If this option is enabled, then the configuration files are processed
339again using the new target name to pick up any new configuration in matching
340.Cm Host
341and
342.Cm Match
343stanzas.
344.It Cm CanonicalizeMaxDots
345Specifies the maximum number of dot characters in a hostname before
346canonicalization is disabled.
347The default, 1,
348allows a single dot (i.e. hostname.subdomain).
349.It Cm CanonicalizePermittedCNAMEs
350Specifies rules to determine whether CNAMEs should be followed when
351canonicalizing hostnames.
352The rules consist of one or more arguments of
353.Ar source_domain_list : Ns Ar target_domain_list ,
354where
355.Ar source_domain_list
356is a pattern-list of domains that may follow CNAMEs in canonicalization,
357and
358.Ar target_domain_list
359is a pattern-list of domains that they may resolve to.
360.Pp
361For example,
362.Qq *.a.example.com:*.b.example.com,*.c.example.com
363will allow hostnames matching
364.Qq *.a.example.com
365to be canonicalized to names in the
366.Qq *.b.example.com
367or
368.Qq *.c.example.com
369domains.
370.It Cm CASignatureAlgorithms
371Specifies which algorithms are allowed for signing of certificates
372by certificate authorities (CAs).
373The default is:
374.Bd -literal -offset indent
375ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
376sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,
377rsa-sha2-512,rsa-sha2-256
378.Ed
379.Pp
380.Xr ssh 1
381will not accept host certificates signed using algorithms other than those
382specified.
383.It Cm CertificateFile
384Specifies a file from which the user's certificate is read.
385A corresponding private key must be provided separately in order
386to use this certificate either
387from an
388.Cm IdentityFile
389directive or
390.Fl i
391flag to
392.Xr ssh 1 ,
393via
394.Xr ssh-agent 1 ,
395or via a
396.Cm PKCS11Provider
397or
398.Cm SecurityKeyProvider .
399.Pp
400Arguments to
401.Cm CertificateFile
402may use the tilde syntax to refer to a user's home directory,
403the tokens described in the
404.Sx TOKENS
405section and environment variables as described in the
406.Sx ENVIRONMENT VARIABLES
407section.
408.Pp
409It is possible to have multiple certificate files specified in
410configuration files; these certificates will be tried in sequence.
411Multiple
412.Cm CertificateFile
413directives will add to the list of certificates used for
414authentication.
415.It Cm CheckHostIP
416If set to
417.Cm yes
418.Xr ssh 1
419will additionally check the host IP address in the
420.Pa known_hosts
421file.
422This allows it to detect if a host key changed due to DNS spoofing
423and will add addresses of destination hosts to
424.Pa ~/.ssh/known_hosts
425in the process, regardless of the setting of
426.Cm StrictHostKeyChecking .
427If the option is set to
428.Cm no
429(the default),
430the check will not be executed.
431.It Cm Ciphers
432Specifies the ciphers allowed and their order of preference.
433Multiple ciphers must be comma-separated.
434If the specified list begins with a
435.Sq +
436character, then the specified ciphers will be appended to the default set
437instead of replacing them.
438If the specified list begins with a
439.Sq -
440character, then the specified ciphers (including wildcards) will be removed
441from the default set instead of replacing them.
442If the specified list begins with a
443.Sq ^
444character, then the specified ciphers will be placed at the head of the
445default set.
446.Pp
447The supported ciphers are:
448.Bd -literal -offset indent
4493des-cbc
450aes128-cbc
451aes192-cbc
452aes256-cbc
453aes128-ctr
454aes192-ctr
455aes256-ctr
456aes128-gcm@openssh.com
457aes256-gcm@openssh.com
458chacha20-poly1305@openssh.com
459.Ed
460.Pp
461The default is:
462.Bd -literal -offset indent
463chacha20-poly1305@openssh.com,
464aes128-ctr,aes192-ctr,aes256-ctr,
465aes128-gcm@openssh.com,aes256-gcm@openssh.com
466.Ed
467.Pp
468The list of available ciphers may also be obtained using
469.Qq ssh -Q cipher .
470.It Cm ClearAllForwardings
471Specifies that all local, remote, and dynamic port forwardings
472specified in the configuration files or on the command line be
473cleared.
474This option is primarily useful when used from the
475.Xr ssh 1
476command line to clear port forwardings set in
477configuration files, and is automatically set by
478.Xr scp 1
479and
480.Xr sftp 1 .
481The argument must be
482.Cm yes
483or
484.Cm no
485(the default).
486.It Cm Compression
487Specifies whether to use compression.
488The argument must be
489.Cm yes
490or
491.Cm no
492(the default).
493.It Cm ConnectionAttempts
494Specifies the number of tries (one per second) to make before exiting.
495The argument must be an integer.
496This may be useful in scripts if the connection sometimes fails.
497The default is 1.
498.It Cm ConnectTimeout
499Specifies the timeout (in seconds) used when connecting to the
500SSH server, instead of using the default system TCP timeout.
501This timeout is applied both to establishing the connection and to performing
502the initial SSH protocol handshake and key exchange.
503.It Cm ControlMaster
504Enables the sharing of multiple sessions over a single network connection.
505When set to
506.Cm yes ,
507.Xr ssh 1
508will listen for connections on a control socket specified using the
509.Cm ControlPath
510argument.
511Additional sessions can connect to this socket using the same
512.Cm ControlPath
513with
514.Cm ControlMaster
515set to
516.Cm no
517(the default).
518These sessions will try to reuse the master instance's network connection
519rather than initiating new ones, but will fall back to connecting normally
520if the control socket does not exist, or is not listening.
521.Pp
522Setting this to
523.Cm ask
524will cause
525.Xr ssh 1
526to listen for control connections, but require confirmation using
527.Xr ssh-askpass 1 .
528If the
529.Cm ControlPath
530cannot be opened,
531.Xr ssh 1
532will continue without connecting to a master instance.
533.Pp
534X11 and
535.Xr ssh-agent 1
536forwarding is supported over these multiplexed connections, however the
537display and agent forwarded will be the one belonging to the master
538connection i.e. it is not possible to forward multiple displays or agents.
539.Pp
540Two additional options allow for opportunistic multiplexing: try to use a
541master connection but fall back to creating a new one if one does not already
542exist.
543These options are:
544.Cm auto
545and
546.Cm autoask .
547The latter requires confirmation like the
548.Cm ask
549option.
550.It Cm ControlPath
551Specify the path to the control socket used for connection sharing as described
552in the
553.Cm ControlMaster
554section above or the string
555.Cm none
556to disable connection sharing.
557Arguments to
558.Cm ControlPath
559may use the tilde syntax to refer to a user's home directory,
560the tokens described in the
561.Sx TOKENS
562section and environment variables as described in the
563.Sx ENVIRONMENT VARIABLES
564section.
565It is recommended that any
566.Cm ControlPath
567used for opportunistic connection sharing include
568at least %h, %p, and %r (or alternatively %C) and be placed in a directory
569that is not writable by other users.
570This ensures that shared connections are uniquely identified.
571.It Cm ControlPersist
572When used in conjunction with
573.Cm ControlMaster ,
574specifies that the master connection should remain open
575in the background (waiting for future client connections)
576after the initial client connection has been closed.
577If set to
578.Cm no
579(the default),
580then the master connection will not be placed into the background,
581and will close as soon as the initial client connection is closed.
582If set to
583.Cm yes
584or 0,
585then the master connection will remain in the background indefinitely
586(until killed or closed via a mechanism such as the
587.Qq ssh -O exit ) .
588If set to a time in seconds, or a time in any of the formats documented in
589.Xr sshd_config 5 ,
590then the backgrounded master connection will automatically terminate
591after it has remained idle (with no client connections) for the
592specified time.
593.It Cm DynamicForward
594Specifies that a TCP port on the local machine be forwarded
595over the secure channel, and the application
596protocol is then used to determine where to connect to from the
597remote machine.
598.Pp
599The argument must be
600.Sm off
601.Oo Ar bind_address : Oc Ar port .
602.Sm on
603IPv6 addresses can be specified by enclosing addresses in square brackets.
604By default, the local port is bound in accordance with the
605.Cm GatewayPorts
606setting.
607However, an explicit
608.Ar bind_address
609may be used to bind the connection to a specific address.
610The
611.Ar bind_address
612of
613.Cm localhost
614indicates that the listening port be bound for local use only, while an
615empty address or
616.Sq *
617indicates that the port should be available from all interfaces.
618.Pp
619Currently the SOCKS4 and SOCKS5 protocols are supported, and
620.Xr ssh 1
621will act as a SOCKS server.
622Multiple forwardings may be specified, and
623additional forwardings can be given on the command line.
624Only the superuser can forward privileged ports.
625.It Cm EnableSSHKeysign
626Setting this option to
627.Cm yes
628in the global client configuration file
629.Pa /etc/ssh/ssh_config
630enables the use of the helper program
631.Xr ssh-keysign 8
632during
633.Cm HostbasedAuthentication .
634The argument must be
635.Cm yes
636or
637.Cm no
638(the default).
639This option should be placed in the non-hostspecific section.
640See
641.Xr ssh-keysign 8
642for more information.
643.It Cm EscapeChar
644Sets the escape character (default:
645.Ql ~ ) .
646The escape character can also
647be set on the command line.
648The argument should be a single character,
649.Ql ^
650followed by a letter, or
651.Cm none
652to disable the escape
653character entirely (making the connection transparent for binary
654data).
655.It Cm ExitOnForwardFailure
656Specifies whether
657.Xr ssh 1
658should terminate the connection if it cannot set up all requested
659dynamic, tunnel, local, and remote port forwardings, (e.g.\&
660if either end is unable to bind and listen on a specified port).
661Note that
662.Cm ExitOnForwardFailure
663does not apply to connections made over port forwardings and will not,
664for example, cause
665.Xr ssh 1
666to exit if TCP connections to the ultimate forwarding destination fail.
667The argument must be
668.Cm yes
669or
670.Cm no
671(the default).
672.It Cm FingerprintHash
673Specifies the hash algorithm used when displaying key fingerprints.
674Valid options are:
675.Cm md5
676and
677.Cm sha256
678(the default).
679.It Cm ForkAfterAuthentication
680Requests
681.Nm ssh
682to go to background just before command execution.
683This is useful if
684.Nm ssh
685is going to ask for passwords or passphrases, but the user
686wants it in the background.
687This implies the
688.Cm StdinNull
689configuration option being set to
690.Dq yes .
691The recommended way to start X11 programs at a remote site is with
692something like
693.Ic ssh -f host xterm ,
694which is the same as
695.Ic ssh host xterm
696if the
697.Cm ForkAfterAuthentication
698configuration option is set to
699.Dq yes .
700.Pp
701If the
702.Cm ExitOnForwardFailure
703configuration option is set to
704.Dq yes ,
705then a client started with the
706.Cm ForkAfterAuthentication
707configuration option being set to
708.Dq yes
709will wait for all remote port forwards to be successfully established
710before placing itself in the background.
711The argument to this keyword must be
712.Cm yes
713(same as the
714.Fl f
715option) or
716.Cm no
717(the default).
718.It Cm ForwardAgent
719Specifies whether the connection to the authentication agent (if any)
720will be forwarded to the remote machine.
721The argument may be
722.Cm yes ,
723.Cm no
724(the default),
725an explicit path to an agent socket or the name of an environment variable
726(beginning with
727.Sq $ )
728in which to find the path.
729.Pp
730Agent forwarding should be enabled with caution.
731Users with the ability to bypass file permissions on the remote host
732(for the agent's Unix-domain socket)
733can access the local agent through the forwarded connection.
734An attacker cannot obtain key material from the agent,
735however they can perform operations on the keys that enable them to
736authenticate using the identities loaded into the agent.
737.It Cm ForwardX11
738Specifies whether X11 connections will be automatically redirected
739over the secure channel and
740.Ev DISPLAY
741set.
742The argument must be
743.Cm yes
744or
745.Cm no
746(the default).
747.Pp
748X11 forwarding should be enabled with caution.
749Users with the ability to bypass file permissions on the remote host
750(for the user's X11 authorization database)
751can access the local X11 display through the forwarded connection.
752An attacker may then be able to perform activities such as keystroke monitoring
753if the
754.Cm ForwardX11Trusted
755option is also enabled.
756.It Cm ForwardX11Timeout
757Specify a timeout for untrusted X11 forwarding
758using the format described in the
759.Sx TIME FORMATS
760section of
761.Xr sshd_config 5 .
762X11 connections received by
763.Xr ssh 1
764after this time will be refused.
765Setting
766.Cm ForwardX11Timeout
767to zero will disable the timeout and permit X11 forwarding for the life
768of the connection.
769The default is to disable untrusted X11 forwarding after twenty minutes has
770elapsed.
771.It Cm ForwardX11Trusted
772If this option is set to
773.Cm yes ,
774remote X11 clients will have full access to the original X11 display.
775.Pp
776If this option is set to
777.Cm no
778(the default),
779remote X11 clients will be considered untrusted and prevented
780from stealing or tampering with data belonging to trusted X11
781clients.
782Furthermore, the
783.Xr xauth 1
784token used for the session will be set to expire after 20 minutes.
785Remote clients will be refused access after this time.
786.Pp
787See the X11 SECURITY extension specification for full details on
788the restrictions imposed on untrusted clients.
789.It Cm GatewayPorts
790Specifies whether remote hosts are allowed to connect to local
791forwarded ports.
792By default,
793.Xr ssh 1
794binds local port forwardings to the loopback address.
795This prevents other remote hosts from connecting to forwarded ports.
796.Cm GatewayPorts
797can be used to specify that ssh
798should bind local port forwardings to the wildcard address,
799thus allowing remote hosts to connect to forwarded ports.
800The argument must be
801.Cm yes
802or
803.Cm no
804(the default).
805.It Cm GlobalKnownHostsFile
806Specifies one or more files to use for the global
807host key database, separated by whitespace.
808The default is
809.Pa /etc/ssh/ssh_known_hosts ,
810.Pa /etc/ssh/ssh_known_hosts2 .
811.It Cm GSSAPIAuthentication
812Specifies whether user authentication based on GSSAPI is allowed.
813The default is
814.Cm no .
815.It Cm GSSAPIDelegateCredentials
816Forward (delegate) credentials to the server.
817The default is
818.Cm no .
819.It Cm HashKnownHosts
820Indicates that
821.Xr ssh 1
822should hash host names and addresses when they are added to
823.Pa ~/.ssh/known_hosts .
824These hashed names may be used normally by
825.Xr ssh 1
826and
827.Xr sshd 8 ,
828but they do not visually reveal identifying information if the
829file's contents are disclosed.
830The default is
831.Cm no .
832Note that existing names and addresses in known hosts files
833will not be converted automatically,
834but may be manually hashed using
835.Xr ssh-keygen 1 .
836.It Cm HostbasedAcceptedAlgorithms
837Specifies the signature algorithms that will be used for hostbased
838authentication as a comma-separated list of patterns.
839Alternately if the specified list begins with a
840.Sq +
841character, then the specified signature algorithms will be appended
842to the default set instead of replacing them.
843If the specified list begins with a
844.Sq -
845character, then the specified signature algorithms (including wildcards)
846will be removed from the default set instead of replacing them.
847If the specified list begins with a
848.Sq ^
849character, then the specified signature algorithms will be placed
850at the head of the default set.
851The default for this option is:
852.Bd -literal -offset 3n
853ssh-ed25519-cert-v01@openssh.com,
854ecdsa-sha2-nistp256-cert-v01@openssh.com,
855ecdsa-sha2-nistp384-cert-v01@openssh.com,
856ecdsa-sha2-nistp521-cert-v01@openssh.com,
857sk-ssh-ed25519-cert-v01@openssh.com,
858sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
859rsa-sha2-512-cert-v01@openssh.com,
860rsa-sha2-256-cert-v01@openssh.com,
861ssh-rsa-cert-v01@openssh.com,
862ssh-ed25519,
863ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
864sk-ssh-ed25519@openssh.com,
865sk-ecdsa-sha2-nistp256@openssh.com,
866rsa-sha2-512,rsa-sha2-256,ssh-rsa
867.Ed
868.Pp
869The
870.Fl Q
871option of
872.Xr ssh 1
873may be used to list supported signature algorithms.
874This was formerly named HostbasedKeyTypes.
875.It Cm HostbasedAuthentication
876Specifies whether to try rhosts based authentication with public key
877authentication.
878The argument must be
879.Cm yes
880or
881.Cm no
882(the default).
883.It Cm HostKeyAlgorithms
884Specifies the host key signature algorithms
885that the client wants to use in order of preference.
886Alternately if the specified list begins with a
887.Sq +
888character, then the specified signature algorithms will be appended to
889the default set instead of replacing them.
890If the specified list begins with a
891.Sq -
892character, then the specified signature algorithms (including wildcards)
893will be removed from the default set instead of replacing them.
894If the specified list begins with a
895.Sq ^
896character, then the specified signature algorithms will be placed
897at the head of the default set.
898The default for this option is:
899.Bd -literal -offset 3n
900ssh-ed25519-cert-v01@openssh.com,
901ecdsa-sha2-nistp256-cert-v01@openssh.com,
902ecdsa-sha2-nistp384-cert-v01@openssh.com,
903ecdsa-sha2-nistp521-cert-v01@openssh.com,
904sk-ssh-ed25519-cert-v01@openssh.com,
905sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
906rsa-sha2-512-cert-v01@openssh.com,
907rsa-sha2-256-cert-v01@openssh.com,
908ssh-rsa-cert-v01@openssh.com,
909ssh-ed25519,
910ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
911sk-ecdsa-sha2-nistp256@openssh.com,
912sk-ssh-ed25519@openssh.com,
913rsa-sha2-512,rsa-sha2-256,ssh-rsa
914.Ed
915.Pp
916If hostkeys are known for the destination host then this default is modified
917to prefer their algorithms.
918.Pp
919The list of available signature algorithms may also be obtained using
920.Qq ssh -Q HostKeyAlgorithms .
921.It Cm HostKeyAlias
922Specifies an alias that should be used instead of the
923real host name when looking up or saving the host key
924in the host key database files and when validating host certificates.
925This option is useful for tunneling SSH connections
926or for multiple servers running on a single host.
927.It Cm Hostname
928Specifies the real host name to log into.
929This can be used to specify nicknames or abbreviations for hosts.
930Arguments to
931.Cm Hostname
932accept the tokens described in the
933.Sx TOKENS
934section.
935Numeric IP addresses are also permitted (both on the command line and in
936.Cm Hostname
937specifications).
938The default is the name given on the command line.
939.It Cm IdentitiesOnly
940Specifies that
941.Xr ssh 1
942should only use the configured authentication identity and certificate files
943(either the default files, or those explicitly configured in the
944.Nm
945files
946or passed on the
947.Xr ssh 1
948command-line),
949even if
950.Xr ssh-agent 1
951or a
952.Cm PKCS11Provider
953or
954.Cm SecurityKeyProvider
955offers more identities.
956The argument to this keyword must be
957.Cm yes
958or
959.Cm no
960(the default).
961This option is intended for situations where ssh-agent
962offers many different identities.
963.It Cm IdentityAgent
964Specifies the
965.Ux Ns -domain
966socket used to communicate with the authentication agent.
967.Pp
968This option overrides the
969.Ev SSH_AUTH_SOCK
970environment variable and can be used to select a specific agent.
971Setting the socket name to
972.Cm none
973disables the use of an authentication agent.
974If the string
975.Qq SSH_AUTH_SOCK
976is specified, the location of the socket will be read from the
977.Ev SSH_AUTH_SOCK
978environment variable.
979Otherwise if the specified value begins with a
980.Sq $
981character, then it will be treated as an environment variable containing
982the location of the socket.
983.Pp
984Arguments to
985.Cm IdentityAgent
986may use the tilde syntax to refer to a user's home directory,
987the tokens described in the
988.Sx TOKENS
989section and environment variables as described in the
990.Sx ENVIRONMENT VARIABLES
991section.
992.It Cm IdentityFile
993Specifies a file from which the user's DSA, ECDSA, authenticator-hosted ECDSA,
994Ed25519, authenticator-hosted Ed25519 or RSA authentication identity is read.
995The default is
996.Pa ~/.ssh/id_dsa ,
997.Pa ~/.ssh/id_ecdsa ,
998.Pa ~/.ssh/id_ecdsa_sk ,
999.Pa ~/.ssh/id_ed25519 ,
1000.Pa ~/.ssh/id_ed25519_sk
1001and
1002.Pa ~/.ssh/id_rsa .
1003Additionally, any identities represented by the authentication agent
1004will be used for authentication unless
1005.Cm IdentitiesOnly
1006is set.
1007If no certificates have been explicitly specified by
1008.Cm CertificateFile ,
1009.Xr ssh 1
1010will try to load certificate information from the filename obtained by
1011appending
1012.Pa -cert.pub
1013to the path of a specified
1014.Cm IdentityFile .
1015.Pp
1016Arguments to
1017.Cm IdentityFile
1018may use the tilde syntax to refer to a user's home directory
1019or the tokens described in the
1020.Sx TOKENS
1021section.
1022.Pp
1023It is possible to have
1024multiple identity files specified in configuration files; all these
1025identities will be tried in sequence.
1026Multiple
1027.Cm IdentityFile
1028directives will add to the list of identities tried (this behaviour
1029differs from that of other configuration directives).
1030.Pp
1031.Cm IdentityFile
1032may be used in conjunction with
1033.Cm IdentitiesOnly
1034to select which identities in an agent are offered during authentication.
1035.Cm IdentityFile
1036may also be used in conjunction with
1037.Cm CertificateFile
1038in order to provide any certificate also needed for authentication with
1039the identity.
1040.It Cm IgnoreUnknown
1041Specifies a pattern-list of unknown options to be ignored if they are
1042encountered in configuration parsing.
1043This may be used to suppress errors if
1044.Nm
1045contains options that are unrecognised by
1046.Xr ssh 1 .
1047It is recommended that
1048.Cm IgnoreUnknown
1049be listed early in the configuration file as it will not be applied
1050to unknown options that appear before it.
1051.It Cm Include
1052Include the specified configuration file(s).
1053Multiple pathnames may be specified and each pathname may contain
1054.Xr glob 7
1055wildcards and, for user configurations, shell-like
1056.Sq ~
1057references to user home directories.
1058Wildcards will be expanded and processed in lexical order.
1059Files without absolute paths are assumed to be in
1060.Pa ~/.ssh
1061if included in a user configuration file or
1062.Pa /etc/ssh
1063if included from the system configuration file.
1064.Cm Include
1065directive may appear inside a
1066.Cm Match
1067or
1068.Cm Host
1069block
1070to perform conditional inclusion.
1071.It Cm IPQoS
1072Specifies the IPv4 type-of-service or DSCP class for connections.
1073Accepted values are
1074.Cm af11 ,
1075.Cm af12 ,
1076.Cm af13 ,
1077.Cm af21 ,
1078.Cm af22 ,
1079.Cm af23 ,
1080.Cm af31 ,
1081.Cm af32 ,
1082.Cm af33 ,
1083.Cm af41 ,
1084.Cm af42 ,
1085.Cm af43 ,
1086.Cm cs0 ,
1087.Cm cs1 ,
1088.Cm cs2 ,
1089.Cm cs3 ,
1090.Cm cs4 ,
1091.Cm cs5 ,
1092.Cm cs6 ,
1093.Cm cs7 ,
1094.Cm ef ,
1095.Cm le ,
1096.Cm lowdelay ,
1097.Cm throughput ,
1098.Cm reliability ,
1099a numeric value, or
1100.Cm none
1101to use the operating system default.
1102This option may take one or two arguments, separated by whitespace.
1103If one argument is specified, it is used as the packet class unconditionally.
1104If two values are specified, the first is automatically selected for
1105interactive sessions and the second for non-interactive sessions.
1106The default is
1107.Cm af21
1108(Low-Latency Data)
1109for interactive sessions and
1110.Cm cs1
1111(Lower Effort)
1112for non-interactive sessions.
1113.It Cm KbdInteractiveAuthentication
1114Specifies whether to use keyboard-interactive authentication.
1115The argument to this keyword must be
1116.Cm yes
1117(the default)
1118or
1119.Cm no .
1120.Cm ChallengeResponseAuthentication
1121is a deprecated alias for this.
1122.It Cm KbdInteractiveDevices
1123Specifies the list of methods to use in keyboard-interactive authentication.
1124Multiple method names must be comma-separated.
1125The default is to use the server specified list.
1126The methods available vary depending on what the server supports.
1127For an OpenSSH server,
1128it may be zero or more of:
1129.Cm bsdauth ,
1130.Cm pam ,
1131and
1132.Cm skey .
1133.It Cm KexAlgorithms
1134Specifies the available KEX (Key Exchange) algorithms.
1135Multiple algorithms must be comma-separated.
1136If the specified list begins with a
1137.Sq +
1138character, then the specified methods will be appended to the default set
1139instead of replacing them.
1140If the specified list begins with a
1141.Sq -
1142character, then the specified methods (including wildcards) will be removed
1143from the default set instead of replacing them.
1144If the specified list begins with a
1145.Sq ^
1146character, then the specified methods will be placed at the head of the
1147default set.
1148The default is:
1149.Bd -literal -offset indent
1150curve25519-sha256,curve25519-sha256@libssh.org,
1151ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
1152diffie-hellman-group-exchange-sha256,
1153diffie-hellman-group16-sha512,
1154diffie-hellman-group18-sha512,
1155diffie-hellman-group14-sha256
1156.Ed
1157.Pp
1158The list of available key exchange algorithms may also be obtained using
1159.Qq ssh -Q kex .
1160.It Cm KnownHostsCommand
1161Specifies a command to use to obtain a list of host keys, in addition to
1162those listed in
1163.Cm UserKnownHostsFile
1164and
1165.Cm GlobalKnownHostsFile .
1166This command is executed after the files have been read.
1167It may write host key lines to standard output in identical format to the
1168usual files (described in the
1169.Sx VERIFYING HOST KEYS
1170section in
1171.Xr ssh 1 ) .
1172Arguments to
1173.Cm KnownHostsCommand
1174accept the tokens described in the
1175.Sx TOKENS
1176section.
1177The command may be invoked multiple times per connection: once when preparing
1178the preference list of host key algorithms to use, again to obtain the
1179host key for the requested host name and, if
1180.Cm CheckHostIP
1181is enabled, one more time to obtain the host key matching the server's
1182address.
1183If the command exits abnormally or returns a non-zero exit status then the
1184connection is terminated.
1185.It Cm LocalCommand
1186Specifies a command to execute on the local machine after successfully
1187connecting to the server.
1188The command string extends to the end of the line, and is executed with
1189the user's shell.
1190Arguments to
1191.Cm LocalCommand
1192accept the tokens described in the
1193.Sx TOKENS
1194section.
1195.Pp
1196The command is run synchronously and does not have access to the
1197session of the
1198.Xr ssh 1
1199that spawned it.
1200It should not be used for interactive commands.
1201.Pp
1202This directive is ignored unless
1203.Cm PermitLocalCommand
1204has been enabled.
1205.It Cm LocalForward
1206Specifies that a TCP port on the local machine be forwarded over
1207the secure channel to the specified host and port from the remote machine.
1208The first argument specifies the listener and may be
1209.Sm off
1210.Oo Ar bind_address : Oc Ar port
1211.Sm on
1212or a Unix domain socket path.
1213The second argument is the destination and may be
1214.Ar host : Ns Ar hostport
1215or a Unix domain socket path if the remote host supports it.
1216.Pp
1217IPv6 addresses can be specified by enclosing addresses in square brackets.
1218Multiple forwardings may be specified, and additional forwardings can be
1219given on the command line.
1220Only the superuser can forward privileged ports.
1221By default, the local port is bound in accordance with the
1222.Cm GatewayPorts
1223setting.
1224However, an explicit
1225.Ar bind_address
1226may be used to bind the connection to a specific address.
1227The
1228.Ar bind_address
1229of
1230.Cm localhost
1231indicates that the listening port be bound for local use only, while an
1232empty address or
1233.Sq *
1234indicates that the port should be available from all interfaces.
1235Unix domain socket paths may use the tokens described in the
1236.Sx TOKENS
1237section and environment variables as described in the
1238.Sx ENVIRONMENT VARIABLES
1239section.
1240.It Cm LogLevel
1241Gives the verbosity level that is used when logging messages from
1242.Xr ssh 1 .
1243The possible values are:
1244QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
1245The default is INFO.
1246DEBUG and DEBUG1 are equivalent.
1247DEBUG2 and DEBUG3 each specify higher levels of verbose output.
1248.It Cm LogVerbose
1249Specify one or more overrides to LogLevel.
1250An override consists of a pattern lists that matches the source file, function
1251and line number to force detailed logging for.
1252For example, an override pattern of:
1253.Bd -literal -offset indent
1254kex.c:*:1000,*:kex_exchange_identification():*,packet.c:*
1255.Ed
1256.Pp
1257would enable detailed logging for line 1000 of
1258.Pa kex.c ,
1259everything in the
1260.Fn kex_exchange_identification
1261function, and all code in the
1262.Pa packet.c
1263file.
1264This option is intended for debugging and no overrides are enabled by default.
1265.It Cm MACs
1266Specifies the MAC (message authentication code) algorithms
1267in order of preference.
1268The MAC algorithm is used for data integrity protection.
1269Multiple algorithms must be comma-separated.
1270If the specified list begins with a
1271.Sq +
1272character, then the specified algorithms will be appended to the default set
1273instead of replacing them.
1274If the specified list begins with a
1275.Sq -
1276character, then the specified algorithms (including wildcards) will be removed
1277from the default set instead of replacing them.
1278If the specified list begins with a
1279.Sq ^
1280character, then the specified algorithms will be placed at the head of the
1281default set.
1282.Pp
1283The algorithms that contain
1284.Qq -etm
1285calculate the MAC after encryption (encrypt-then-mac).
1286These are considered safer and their use recommended.
1287.Pp
1288The default is:
1289.Bd -literal -offset indent
1290umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1291hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1292hmac-sha1-etm@openssh.com,
1293umac-64@openssh.com,umac-128@openssh.com,
1294hmac-sha2-256,hmac-sha2-512,hmac-sha1
1295.Ed
1296.Pp
1297The list of available MAC algorithms may also be obtained using
1298.Qq ssh -Q mac .
1299.It Cm NoHostAuthenticationForLocalhost
1300Disable host authentication for localhost (loopback addresses).
1301The argument to this keyword must be
1302.Cm yes
1303or
1304.Cm no
1305(the default).
1306.It Cm NumberOfPasswordPrompts
1307Specifies the number of password prompts before giving up.
1308The argument to this keyword must be an integer.
1309The default is 3.
1310.It Cm PasswordAuthentication
1311Specifies whether to use password authentication.
1312The argument to this keyword must be
1313.Cm yes
1314(the default)
1315or
1316.Cm no .
1317.It Cm PermitLocalCommand
1318Allow local command execution via the
1319.Ic LocalCommand
1320option or using the
1321.Ic !\& Ns Ar command
1322escape sequence in
1323.Xr ssh 1 .
1324The argument must be
1325.Cm yes
1326or
1327.Cm no
1328(the default).
1329.It Cm PermitRemoteOpen
1330Specifies the destinations to which remote TCP port forwarding is permitted when
1331.Cm RemoteForward
1332is used as a SOCKS proxy.
1333The forwarding specification must be one of the following forms:
1334.Pp
1335.Bl -item -offset indent -compact
1336.It
1337.Cm PermitRemoteOpen
1338.Sm off
1339.Ar host : port
1340.Sm on
1341.It
1342.Cm PermitRemoteOpen
1343.Sm off
1344.Ar IPv4_addr : port
1345.Sm on
1346.It
1347.Cm PermitRemoteOpen
1348.Sm off
1349.Ar \&[ IPv6_addr \&] : port
1350.Sm on
1351.El
1352.Pp
1353Multiple forwards may be specified by separating them with whitespace.
1354An argument of
1355.Cm any
1356can be used to remove all restrictions and permit any forwarding requests.
1357An argument of
1358.Cm none
1359can be used to prohibit all forwarding requests.
1360The wildcard
1361.Sq *
1362can be used for host or port to allow all hosts or ports respectively.
1363Otherwise, no pattern matching or address lookups are performed on supplied
1364names.
1365.It Cm PKCS11Provider
1366Specifies which PKCS#11 provider to use or
1367.Cm none
1368to indicate that no provider should be used (the default).
1369The argument to this keyword is a path to the PKCS#11 shared library
1370.Xr ssh 1
1371should use to communicate with a PKCS#11 token providing keys for user
1372authentication.
1373.It Cm Port
1374Specifies the port number to connect on the remote host.
1375The default is 22.
1376.It Cm PreferredAuthentications
1377Specifies the order in which the client should try authentication methods.
1378This allows a client to prefer one method (e.g.\&
1379.Cm keyboard-interactive )
1380over another method (e.g.\&
1381.Cm password ) .
1382The default is:
1383.Bd -literal -offset indent
1384gssapi-with-mic,hostbased,publickey,
1385keyboard-interactive,password
1386.Ed
1387.It Cm ProxyCommand
1388Specifies the command to use to connect to the server.
1389The command
1390string extends to the end of the line, and is executed
1391using the user's shell
1392.Ql exec
1393directive to avoid a lingering shell process.
1394.Pp
1395Arguments to
1396.Cm ProxyCommand
1397accept the tokens described in the
1398.Sx TOKENS
1399section.
1400The command can be basically anything,
1401and should read from its standard input and write to its standard output.
1402It should eventually connect an
1403.Xr sshd 8
1404server running on some machine, or execute
1405.Ic sshd -i
1406somewhere.
1407Host key management will be done using the
1408.Cm Hostname
1409of the host being connected (defaulting to the name typed by the user).
1410Setting the command to
1411.Cm none
1412disables this option entirely.
1413Note that
1414.Cm CheckHostIP
1415is not available for connects with a proxy command.
1416.Pp
1417This directive is useful in conjunction with
1418.Xr nc 1
1419and its proxy support.
1420For example, the following directive would connect via an HTTP proxy at
1421192.0.2.0:
1422.Bd -literal -offset 3n
1423ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p
1424.Ed
1425.It Cm ProxyJump
1426Specifies one or more jump proxies as either
1427.Xo
1428.Sm off
1429.Op Ar user No @
1430.Ar host
1431.Op : Ns Ar port
1432.Sm on
1433or an ssh URI
1434.Xc .
1435Multiple proxies may be separated by comma characters and will be visited
1436sequentially.
1437Setting this option will cause
1438.Xr ssh 1
1439to connect to the target host by first making a
1440.Xr ssh 1
1441connection to the specified
1442.Cm ProxyJump
1443host and then establishing a
1444TCP forwarding to the ultimate target from there.
1445Setting the host to
1446.Cm none
1447disables this option entirely.
1448.Pp
1449Note that this option will compete with the
1450.Cm ProxyCommand
1451option - whichever is specified first will prevent later instances of the
1452other from taking effect.
1453.Pp
1454Note also that the configuration for the destination host (either supplied
1455via the command-line or the configuration file) is not generally applied
1456to jump hosts.
1457.Pa ~/.ssh/config
1458should be used if specific configuration is required for jump hosts.
1459.It Cm ProxyUseFdpass
1460Specifies that
1461.Cm ProxyCommand
1462will pass a connected file descriptor back to
1463.Xr ssh 1
1464instead of continuing to execute and pass data.
1465The default is
1466.Cm no .
1467.It Cm PubkeyAcceptedAlgorithms
1468Specifies the signature algorithms that will be used for public key
1469authentication as a comma-separated list of patterns.
1470If the specified list begins with a
1471.Sq +
1472character, then the algorithms after it will be appended to the default
1473instead of replacing it.
1474If the specified list begins with a
1475.Sq -
1476character, then the specified algorithms (including wildcards) will be removed
1477from the default set instead of replacing them.
1478If the specified list begins with a
1479.Sq ^
1480character, then the specified algorithms will be placed at the head of the
1481default set.
1482The default for this option is:
1483.Bd -literal -offset 3n
1484ssh-ed25519-cert-v01@openssh.com,
1485ecdsa-sha2-nistp256-cert-v01@openssh.com,
1486ecdsa-sha2-nistp384-cert-v01@openssh.com,
1487ecdsa-sha2-nistp521-cert-v01@openssh.com,
1488sk-ssh-ed25519-cert-v01@openssh.com,
1489sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
1490rsa-sha2-512-cert-v01@openssh.com,
1491rsa-sha2-256-cert-v01@openssh.com,
1492ssh-rsa-cert-v01@openssh.com,
1493ssh-ed25519,
1494ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1495sk-ssh-ed25519@openssh.com,
1496sk-ecdsa-sha2-nistp256@openssh.com,
1497rsa-sha2-512,rsa-sha2-256,ssh-rsa
1498.Ed
1499.Pp
1500The list of available signature algorithms may also be obtained using
1501.Qq ssh -Q PubkeyAcceptedAlgorithms .
1502.It Cm PubkeyAuthentication
1503Specifies whether to try public key authentication.
1504The argument to this keyword must be
1505.Cm yes
1506(the default)
1507or
1508.Cm no .
1509.It Cm RekeyLimit
1510Specifies the maximum amount of data that may be transmitted before the
1511session key is renegotiated, optionally followed by a maximum amount of
1512time that may pass before the session key is renegotiated.
1513The first argument is specified in bytes and may have a suffix of
1514.Sq K ,
1515.Sq M ,
1516or
1517.Sq G
1518to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1519The default is between
1520.Sq 1G
1521and
1522.Sq 4G ,
1523depending on the cipher.
1524The optional second value is specified in seconds and may use any of the
1525units documented in the TIME FORMATS section of
1526.Xr sshd_config 5 .
1527The default value for
1528.Cm RekeyLimit
1529is
1530.Cm default none ,
1531which means that rekeying is performed after the cipher's default amount
1532of data has been sent or received and no time based rekeying is done.
1533.It Cm RemoteCommand
1534Specifies a command to execute on the remote machine after successfully
1535connecting to the server.
1536The command string extends to the end of the line, and is executed with
1537the user's shell.
1538Arguments to
1539.Cm RemoteCommand
1540accept the tokens described in the
1541.Sx TOKENS
1542section.
1543.It Cm RemoteForward
1544Specifies that a TCP port on the remote machine be forwarded over
1545the secure channel.
1546The remote port may either be forwarded to a specified host and port
1547from the local machine, or may act as a SOCKS 4/5 proxy that allows a remote
1548client to connect to arbitrary destinations from the local machine.
1549The first argument is the listening specification and may be
1550.Sm off
1551.Oo Ar bind_address : Oc Ar port
1552.Sm on
1553or, if the remote host supports it, a Unix domain socket path.
1554If forwarding to a specific destination then the second argument must be
1555.Ar host : Ns Ar hostport
1556or a Unix domain socket path,
1557otherwise if no destination argument is specified then the remote forwarding
1558will be established as a SOCKS proxy.
1559When acting as a SOCKS proxy the destination of the connection can be
1560restricted by
1561.Cm PermitRemoteOpen .
1562.Pp
1563IPv6 addresses can be specified by enclosing addresses in square brackets.
1564Multiple forwardings may be specified, and additional
1565forwardings can be given on the command line.
1566Privileged ports can be forwarded only when
1567logging in as root on the remote machine.
1568Unix domain socket paths may use the tokens described in the
1569.Sx TOKENS
1570section and environment variables as described in the
1571.Sx ENVIRONMENT VARIABLES
1572section.
1573.Pp
1574If the
1575.Ar port
1576argument is 0,
1577the listen port will be dynamically allocated on the server and reported
1578to the client at run time.
1579.Pp
1580If the
1581.Ar bind_address
1582is not specified, the default is to only bind to loopback addresses.
1583If the
1584.Ar bind_address
1585is
1586.Ql *
1587or an empty string, then the forwarding is requested to listen on all
1588interfaces.
1589Specifying a remote
1590.Ar bind_address
1591will only succeed if the server's
1592.Cm GatewayPorts
1593option is enabled (see
1594.Xr sshd_config 5 ) .
1595.It Cm RequestTTY
1596Specifies whether to request a pseudo-tty for the session.
1597The argument may be one of:
1598.Cm no
1599(never request a TTY),
1600.Cm yes
1601(always request a TTY when standard input is a TTY),
1602.Cm force
1603(always request a TTY) or
1604.Cm auto
1605(request a TTY when opening a login session).
1606This option mirrors the
1607.Fl t
1608and
1609.Fl T
1610flags for
1611.Xr ssh 1 .
1612.It Cm RevokedHostKeys
1613Specifies revoked host public keys.
1614Keys listed in this file will be refused for host authentication.
1615Note that if this file does not exist or is not readable,
1616then host authentication will be refused for all hosts.
1617Keys may be specified as a text file, listing one public key per line, or as
1618an OpenSSH Key Revocation List (KRL) as generated by
1619.Xr ssh-keygen 1 .
1620For more information on KRLs, see the KEY REVOCATION LISTS section in
1621.Xr ssh-keygen 1 .
1622.It Cm SecurityKeyProvider
1623Specifies a path to a library that will be used when loading any
1624FIDO authenticator-hosted keys, overriding the default of using
1625the built-in USB HID support.
1626.Pp
1627If the specified value begins with a
1628.Sq $
1629character, then it will be treated as an environment variable containing
1630the path to the library.
1631.It Cm SendEnv
1632Specifies what variables from the local
1633.Xr environ 7
1634should be sent to the server.
1635The server must also support it, and the server must be configured to
1636accept these environment variables.
1637Note that the
1638.Ev TERM
1639environment variable is always sent whenever a
1640pseudo-terminal is requested as it is required by the protocol.
1641Refer to
1642.Cm AcceptEnv
1643in
1644.Xr sshd_config 5
1645for how to configure the server.
1646Variables are specified by name, which may contain wildcard characters.
1647Multiple environment variables may be separated by whitespace or spread
1648across multiple
1649.Cm SendEnv
1650directives.
1651.Pp
1652See
1653.Sx PATTERNS
1654for more information on patterns.
1655.Pp
1656It is possible to clear previously set
1657.Cm SendEnv
1658variable names by prefixing patterns with
1659.Pa - .
1660The default is not to send any environment variables.
1661.It Cm ServerAliveCountMax
1662Sets the number of server alive messages (see below) which may be
1663sent without
1664.Xr ssh 1
1665receiving any messages back from the server.
1666If this threshold is reached while server alive messages are being sent,
1667ssh will disconnect from the server, terminating the session.
1668It is important to note that the use of server alive messages is very
1669different from
1670.Cm TCPKeepAlive
1671(below).
1672The server alive messages are sent through the encrypted channel
1673and therefore will not be spoofable.
1674The TCP keepalive option enabled by
1675.Cm TCPKeepAlive
1676is spoofable.
1677The server alive mechanism is valuable when the client or
1678server depend on knowing when a connection has become unresponsive.
1679.Pp
1680The default value is 3.
1681If, for example,
1682.Cm ServerAliveInterval
1683(see below) is set to 15 and
1684.Cm ServerAliveCountMax
1685is left at the default, if the server becomes unresponsive,
1686ssh will disconnect after approximately 45 seconds.
1687.It Cm ServerAliveInterval
1688Sets a timeout interval in seconds after which if no data has been received
1689from the server,
1690.Xr ssh 1
1691will send a message through the encrypted
1692channel to request a response from the server.
1693The default
1694is 0, indicating that these messages will not be sent to the server.
1695.It Cm SessionType
1696May be used to either request invocation of a subsystem on the remote system,
1697or to prevent the execution of a remote command at all.
1698The latter is useful for just forwarding ports.
1699The argument to this keyword must be
1700.Cm none
1701(same as the
1702.Fl N
1703option),
1704.Cm subsystem
1705(same as the
1706.Fl s
1707option) or
1708.Cm default
1709(shell or command execution).
1710.It Cm SetEnv
1711Directly specify one or more environment variables and their contents to
1712be sent to the server.
1713Similarly to
1714.Cm SendEnv ,
1715with the exception of the
1716.Ev TERM
1717variable, the server must be prepared to accept the environment variable.
1718.It Cm StdinNull
1719Redirects stdin from
1720.Pa /dev/null
1721(actually, prevents reading from stdin).
1722Either this or the equivalent
1723.Fl n
1724option must be used when
1725.Nm ssh
1726is run in the background.
1727The argument to this keyword must be
1728.Cm yes
1729(same as the
1730.Fl n
1731option) or
1732.Cm no
1733(the default).
1734.It Cm StreamLocalBindMask
1735Sets the octal file creation mode mask
1736.Pq umask
1737used when creating a Unix-domain socket file for local or remote
1738port forwarding.
1739This option is only used for port forwarding to a Unix-domain socket file.
1740.Pp
1741The default value is 0177, which creates a Unix-domain socket file that is
1742readable and writable only by the owner.
1743Note that not all operating systems honor the file mode on Unix-domain
1744socket files.
1745.It Cm StreamLocalBindUnlink
1746Specifies whether to remove an existing Unix-domain socket file for local
1747or remote port forwarding before creating a new one.
1748If the socket file already exists and
1749.Cm StreamLocalBindUnlink
1750is not enabled,
1751.Nm ssh
1752will be unable to forward the port to the Unix-domain socket file.
1753This option is only used for port forwarding to a Unix-domain socket file.
1754.Pp
1755The argument must be
1756.Cm yes
1757or
1758.Cm no
1759(the default).
1760.It Cm StrictHostKeyChecking
1761If this flag is set to
1762.Cm yes ,
1763.Xr ssh 1
1764will never automatically add host keys to the
1765.Pa ~/.ssh/known_hosts
1766file, and refuses to connect to hosts whose host key has changed.
1767This provides maximum protection against man-in-the-middle (MITM) attacks,
1768though it can be annoying when the
1769.Pa /etc/ssh/ssh_known_hosts
1770file is poorly maintained or when connections to new hosts are
1771frequently made.
1772This option forces the user to manually
1773add all new hosts.
1774.Pp
1775If this flag is set to
1776.Dq accept-new
1777then ssh will automatically add new host keys to the user
1778known hosts files, but will not permit connections to hosts with
1779changed host keys.
1780If this flag is set to
1781.Dq no
1782or
1783.Dq off ,
1784ssh will automatically add new host keys to the user known hosts files
1785and allow connections to hosts with changed hostkeys to proceed,
1786subject to some restrictions.
1787If this flag is set to
1788.Cm ask
1789(the default),
1790new host keys
1791will be added to the user known host files only after the user
1792has confirmed that is what they really want to do, and
1793ssh will refuse to connect to hosts whose host key has changed.
1794The host keys of
1795known hosts will be verified automatically in all cases.
1796.It Cm SyslogFacility
1797Gives the facility code that is used when logging messages from
1798.Xr ssh 1 .
1799The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1800LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1801The default is USER.
1802.It Cm TCPKeepAlive
1803Specifies whether the system should send TCP keepalive messages to the
1804other side.
1805If they are sent, death of the connection or crash of one
1806of the machines will be properly noticed.
1807However, this means that
1808connections will die if the route is down temporarily, and some people
1809find it annoying.
1810.Pp
1811The default is
1812.Cm yes
1813(to send TCP keepalive messages), and the client will notice
1814if the network goes down or the remote host dies.
1815This is important in scripts, and many users want it too.
1816.Pp
1817To disable TCP keepalive messages, the value should be set to
1818.Cm no .
1819See also
1820.Cm ServerAliveInterval
1821for protocol-level keepalives.
1822.It Cm Tunnel
1823Request
1824.Xr tun 4
1825device forwarding between the client and the server.
1826The argument must be
1827.Cm yes ,
1828.Cm point-to-point
1829(layer 3),
1830.Cm ethernet
1831(layer 2),
1832or
1833.Cm no
1834(the default).
1835Specifying
1836.Cm yes
1837requests the default tunnel mode, which is
1838.Cm point-to-point .
1839.It Cm TunnelDevice
1840Specifies the
1841.Xr tun 4
1842devices to open on the client
1843.Pq Ar local_tun
1844and the server
1845.Pq Ar remote_tun .
1846.Pp
1847The argument must be
1848.Sm off
1849.Ar local_tun Op : Ar remote_tun .
1850.Sm on
1851The devices may be specified by numerical ID or the keyword
1852.Cm any ,
1853which uses the next available tunnel device.
1854If
1855.Ar remote_tun
1856is not specified, it defaults to
1857.Cm any .
1858The default is
1859.Cm any:any .
1860.It Cm UpdateHostKeys
1861Specifies whether
1862.Xr ssh 1
1863should accept notifications of additional hostkeys from the server sent
1864after authentication has completed and add them to
1865.Cm UserKnownHostsFile .
1866The argument must be
1867.Cm yes ,
1868.Cm no
1869or
1870.Cm ask .
1871This option allows learning alternate hostkeys for a server
1872and supports graceful key rotation by allowing a server to send replacement
1873public keys before old ones are removed.
1874.Pp
1875Additional hostkeys are only accepted if the key used to authenticate the
1876host was already trusted or explicitly accepted by the user, the host was
1877authenticated via
1878.Cm UserKnownHostsFile
1879(i.e. not
1880.Cm GlobalKnownHostsFile )
1881and the host was authenticated using a plain key and not a certificate.
1882.Pp
1883.Cm UpdateHostKeys
1884is enabled by default if the user has not overridden the default
1885.Cm UserKnownHostsFile
1886setting and has not enabled
1887.Cm VerifyHostKeyDNS ,
1888otherwise
1889.Cm UpdateHostKeys
1890will be set to
1891.Cm no .
1892.Pp
1893If
1894.Cm UpdateHostKeys
1895is set to
1896.Cm ask ,
1897then the user is asked to confirm the modifications to the known_hosts file.
1898Confirmation is currently incompatible with
1899.Cm ControlPersist ,
1900and will be disabled if it is enabled.
1901.Pp
1902Presently, only
1903.Xr sshd 8
1904from OpenSSH 6.8 and greater support the
1905.Qq hostkeys@openssh.com
1906protocol extension used to inform the client of all the server's hostkeys.
1907.It Cm User
1908Specifies the user to log in as.
1909This can be useful when a different user name is used on different machines.
1910This saves the trouble of
1911having to remember to give the user name on the command line.
1912.It Cm UserKnownHostsFile
1913Specifies one or more files to use for the user
1914host key database, separated by whitespace.
1915Each filename may use tilde notation to refer to the user's home directory,
1916the tokens described in the
1917.Sx TOKENS
1918section and environment variables as described in the
1919.Sx ENVIRONMENT VARIABLES
1920section.
1921The default is
1922.Pa ~/.ssh/known_hosts ,
1923.Pa ~/.ssh/known_hosts2 .
1924.It Cm VerifyHostKeyDNS
1925Specifies whether to verify the remote key using DNS and SSHFP resource
1926records.
1927If this option is set to
1928.Cm yes ,
1929the client will implicitly trust keys that match a secure fingerprint
1930from DNS.
1931Insecure fingerprints will be handled as if this option was set to
1932.Cm ask .
1933If this option is set to
1934.Cm ask ,
1935information on fingerprint match will be displayed, but the user will still
1936need to confirm new host keys according to the
1937.Cm StrictHostKeyChecking
1938option.
1939The default is
1940.Cm no .
1941.Pp
1942See also
1943.Sx VERIFYING HOST KEYS
1944in
1945.Xr ssh 1 .
1946.It Cm VisualHostKey
1947If this flag is set to
1948.Cm yes ,
1949an ASCII art representation of the remote host key fingerprint is
1950printed in addition to the fingerprint string at login and
1951for unknown host keys.
1952If this flag is set to
1953.Cm no
1954(the default),
1955no fingerprint strings are printed at login and
1956only the fingerprint string will be printed for unknown host keys.
1957.It Cm XAuthLocation
1958Specifies the full pathname of the
1959.Xr xauth 1
1960program.
1961The default is
1962.Pa /usr/X11R6/bin/xauth .
1963.El
1964.Sh PATTERNS
1965A
1966.Em pattern
1967consists of zero or more non-whitespace characters,
1968.Sq *
1969(a wildcard that matches zero or more characters),
1970or
1971.Sq ?\&
1972(a wildcard that matches exactly one character).
1973For example, to specify a set of declarations for any host in the
1974.Qq .co.uk
1975set of domains,
1976the following pattern could be used:
1977.Pp
1978.Dl Host *.co.uk
1979.Pp
1980The following pattern
1981would match any host in the 192.168.0.[0-9] network range:
1982.Pp
1983.Dl Host 192.168.0.?
1984.Pp
1985A
1986.Em pattern-list
1987is a comma-separated list of patterns.
1988Patterns within pattern-lists may be negated
1989by preceding them with an exclamation mark
1990.Pq Sq !\& .
1991For example,
1992to allow a key to be used from anywhere within an organization
1993except from the
1994.Qq dialup
1995pool,
1996the following entry (in authorized_keys) could be used:
1997.Pp
1998.Dl from=\&"!*.dialup.example.com,*.example.com\&"
1999.Pp
2000Note that a negated match will never produce a positive result by itself.
2001For example, attempting to match
2002.Qq host3
2003against the following pattern-list will fail:
2004.Pp
2005.Dl from=\&"!host1,!host2\&"
2006.Pp
2007The solution here is to include a term that will yield a positive match,
2008such as a wildcard:
2009.Pp
2010.Dl from=\&"!host1,!host2,*\&"
2011.Sh TOKENS
2012Arguments to some keywords can make use of tokens,
2013which are expanded at runtime:
2014.Pp
2015.Bl -tag -width XXXX -offset indent -compact
2016.It %%
2017A literal
2018.Sq % .
2019.It \&%C
2020Hash of %l%h%p%r.
2021.It %d
2022Local user's home directory.
2023.It %f
2024The fingerprint of the server's host key.
2025.It %H
2026The
2027.Pa known_hosts
2028hostname or address that is being searched for.
2029.It %h
2030The remote hostname.
2031.It \%%I
2032A string describing the reason for a
2033.Cm KnownHostsCommand
2034execution: either
2035.Cm ADDRESS
2036when looking up a host by address (only when
2037.Cm CheckHostIP
2038is enabled),
2039.Cm HOSTNAME
2040when searching by hostname, or
2041.Cm ORDER
2042when preparing the host key algorithm preference list to use for the
2043destination host.
2044.It %i
2045The local user ID.
2046.It %K
2047The base64 encoded host key.
2048.It %k
2049The host key alias if specified, otherwise the original remote hostname given
2050on the command line.
2051.It %L
2052The local hostname.
2053.It %l
2054The local hostname, including the domain name.
2055.It %n
2056The original remote hostname, as given on the command line.
2057.It %p
2058The remote port.
2059.It %r
2060The remote username.
2061.It \&%T
2062The local
2063.Xr tun 4
2064or
2065.Xr tap 4
2066network interface assigned if
2067tunnel forwarding was requested, or
2068.Qq NONE
2069otherwise.
2070.It %t
2071The type of the server host key, e.g.
2072.Cm ssh-ed25519
2073.It %u
2074The local username.
2075.El
2076.Pp
2077.Cm CertificateFile ,
2078.Cm ControlPath ,
2079.Cm IdentityAgent ,
2080.Cm IdentityFile ,
2081.Cm KnownHostsCommand ,
2082.Cm LocalForward ,
2083.Cm Match exec ,
2084.Cm RemoteCommand ,
2085.Cm RemoteForward ,
2086and
2087.Cm UserKnownHostsFile
2088accept the tokens %%, %C, %d, %h, %i, %k, %L, %l, %n, %p, %r, and %u.
2089.Pp
2090.Cm KnownHostsCommand
2091additionally accepts the tokens %f, %H, %I, %K and %t.
2092.Pp
2093.Cm Hostname
2094accepts the tokens %% and %h.
2095.Pp
2096.Cm LocalCommand
2097accepts all tokens.
2098.Pp
2099.Cm ProxyCommand
2100accepts the tokens %%, %h, %n, %p, and %r.
2101.Sh ENVIRONMENT VARIABLES
2102Arguments to some keywords can be expanded at runtime from environment
2103variables on the client by enclosing them in
2104.Ic ${} ,
2105for example
2106.Ic ${HOME}/.ssh
2107would refer to the user's .ssh directory.
2108If a specified environment variable does not exist then an error will be
2109returned and the setting for that keyword will be ignored.
2110.Pp
2111The keywords
2112.Cm CertificateFile ,
2113.Cm ControlPath ,
2114.Cm IdentityAgent ,
2115.Cm IdentityFile ,
2116.Cm KnownHostsCommand ,
2117and
2118.Cm UserKnownHostsFile
2119support environment variables.
2120The keywords
2121.Cm LocalForward
2122and
2123.Cm RemoteForward
2124support environment variables only for Unix domain socket paths.
2125.Sh FILES
2126.Bl -tag -width Ds
2127.It Pa ~/.ssh/config
2128This is the per-user configuration file.
2129The format of this file is described above.
2130This file is used by the SSH client.
2131Because of the potential for abuse, this file must have strict permissions:
2132read/write for the user, and not writable by others.
2133.It Pa /etc/ssh/ssh_config
2134Systemwide configuration file.
2135This file provides defaults for those
2136values that are not specified in the user's configuration file, and
2137for those users who do not have a configuration file.
2138This file must be world-readable.
2139.El
2140.Sh SEE ALSO
2141.Xr ssh 1
2142.Sh AUTHORS
2143.An -nosplit
2144OpenSSH is a derivative of the original and free
2145ssh 1.2.12 release by
2146.An Tatu Ylonen .
2147.An Aaron Campbell , Bob Beck , Markus Friedl ,
2148.An Niels Provos , Theo de Raadt
2149and
2150.An Dug Song
2151removed many bugs, re-added newer features and
2152created OpenSSH.
2153.An Markus Friedl
2154contributed the support for SSH protocol versions 1.5 and 2.0.
2155