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