xref: /freebsd-13.1/crypto/openssh/ssh_config.5 (revision 8464ad72)
1.\"
2.\" Author: Tatu Ylonen <[email protected]>
3.\" Copyright (c) 1995 Tatu Ylonen <[email protected]>, 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,
388[email protected],
389[email protected],
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
480[email protected]
481[email protected]
482[email protected]
483.Ed
484.Pp
485The default is:
486.Bd -literal -offset indent
487[email protected],
488aes128-ctr,aes192-ctr,aes256-ctr,
489[email protected],[email protected]
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
877[email protected],
878[email protected],
879[email protected],
880[email protected],
881[email protected],
882[email protected],
883[email protected],
884[email protected],
885[email protected],
886ssh-ed25519,
887ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
888[email protected],
889[email protected],
890rsa-sha2-512,rsa-sha2-256,ssh-rsa
891.Ed
892.Pp
893The
894.Fl Q
895option of
896.Xr ssh 1
897may be used to list supported signature algorithms.
898This was formerly named HostbasedKeyTypes.
899.It Cm HostbasedAuthentication
900Specifies whether to try rhosts based authentication with public key
901authentication.
902The argument must be
903.Cm yes
904or
905.Cm no
906(the default).
907.It Cm HostKeyAlgorithms
908Specifies the host key signature algorithms
909that the client wants to use in order of preference.
910Alternately if the specified list begins with a
911.Sq +
912character, then the specified signature algorithms will be appended to
913the default set instead of replacing them.
914If the specified list begins with a
915.Sq -
916character, then the specified signature algorithms (including wildcards)
917will be removed from the default set instead of replacing them.
918If the specified list begins with a
919.Sq ^
920character, then the specified signature algorithms will be placed
921at the head of the default set.
922The default for this option is:
923.Bd -literal -offset 3n
924[email protected],
925[email protected],
926[email protected],
927[email protected],
928[email protected],
929[email protected],
930[email protected],
931[email protected],
932[email protected],
933ssh-ed25519,
934ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
935[email protected],
936[email protected],
937rsa-sha2-512,rsa-sha2-256,ssh-rsa
938.Ed
939.Pp
940If hostkeys are known for the destination host then this default is modified
941to prefer their algorithms.
942.Pp
943The list of available signature algorithms may also be obtained using
944.Qq ssh -Q HostKeyAlgorithms .
945.It Cm HostKeyAlias
946Specifies an alias that should be used instead of the
947real host name when looking up or saving the host key
948in the host key database files and when validating host certificates.
949This option is useful for tunneling SSH connections
950or for multiple servers running on a single host.
951.It Cm Hostname
952Specifies the real host name to log into.
953This can be used to specify nicknames or abbreviations for hosts.
954Arguments to
955.Cm Hostname
956accept the tokens described in the
957.Sx TOKENS
958section.
959Numeric IP addresses are also permitted (both on the command line and in
960.Cm Hostname
961specifications).
962The default is the name given on the command line.
963.It Cm IdentitiesOnly
964Specifies that
965.Xr ssh 1
966should only use the configured authentication identity and certificate files
967(either the default files, or those explicitly configured in the
968.Nm
969files
970or passed on the
971.Xr ssh 1
972command-line),
973even if
974.Xr ssh-agent 1
975or a
976.Cm PKCS11Provider
977or
978.Cm SecurityKeyProvider
979offers more identities.
980The argument to this keyword must be
981.Cm yes
982or
983.Cm no
984(the default).
985This option is intended for situations where ssh-agent
986offers many different identities.
987.It Cm IdentityAgent
988Specifies the
989.Ux Ns -domain
990socket used to communicate with the authentication agent.
991.Pp
992This option overrides the
993.Ev SSH_AUTH_SOCK
994environment variable and can be used to select a specific agent.
995Setting the socket name to
996.Cm none
997disables the use of an authentication agent.
998If the string
999.Qq SSH_AUTH_SOCK
1000is specified, the location of the socket will be read from the
1001.Ev SSH_AUTH_SOCK
1002environment variable.
1003Otherwise if the specified value begins with a
1004.Sq $
1005character, then it will be treated as an environment variable containing
1006the location of the socket.
1007.Pp
1008Arguments to
1009.Cm IdentityAgent
1010may use the tilde syntax to refer to a user's home directory,
1011the tokens described in the
1012.Sx TOKENS
1013section and environment variables as described in the
1014.Sx ENVIRONMENT VARIABLES
1015section.
1016.It Cm IdentityFile
1017Specifies a file from which the user's DSA, ECDSA, authenticator-hosted ECDSA,
1018Ed25519, authenticator-hosted Ed25519 or RSA authentication identity is read.
1019The default is
1020.Pa ~/.ssh/id_dsa ,
1021.Pa ~/.ssh/id_ecdsa ,
1022.Pa ~/.ssh/id_ecdsa_sk ,
1023.Pa ~/.ssh/id_ed25519 ,
1024.Pa ~/.ssh/id_ed25519_sk
1025and
1026.Pa ~/.ssh/id_rsa .
1027Additionally, any identities represented by the authentication agent
1028will be used for authentication unless
1029.Cm IdentitiesOnly
1030is set.
1031If no certificates have been explicitly specified by
1032.Cm CertificateFile ,
1033.Xr ssh 1
1034will try to load certificate information from the filename obtained by
1035appending
1036.Pa -cert.pub
1037to the path of a specified
1038.Cm IdentityFile .
1039.Pp
1040Arguments to
1041.Cm IdentityFile
1042may use the tilde syntax to refer to a user's home directory
1043or the tokens described in the
1044.Sx TOKENS
1045section.
1046.Pp
1047It is possible to have
1048multiple identity files specified in configuration files; all these
1049identities will be tried in sequence.
1050Multiple
1051.Cm IdentityFile
1052directives will add to the list of identities tried (this behaviour
1053differs from that of other configuration directives).
1054.Pp
1055.Cm IdentityFile
1056may be used in conjunction with
1057.Cm IdentitiesOnly
1058to select which identities in an agent are offered during authentication.
1059.Cm IdentityFile
1060may also be used in conjunction with
1061.Cm CertificateFile
1062in order to provide any certificate also needed for authentication with
1063the identity.
1064.It Cm IgnoreUnknown
1065Specifies a pattern-list of unknown options to be ignored if they are
1066encountered in configuration parsing.
1067This may be used to suppress errors if
1068.Nm
1069contains options that are unrecognised by
1070.Xr ssh 1 .
1071It is recommended that
1072.Cm IgnoreUnknown
1073be listed early in the configuration file as it will not be applied
1074to unknown options that appear before it.
1075.It Cm Include
1076Include the specified configuration file(s).
1077Multiple pathnames may be specified and each pathname may contain
1078.Xr glob 7
1079wildcards and, for user configurations, shell-like
1080.Sq ~
1081references to user home directories.
1082Wildcards will be expanded and processed in lexical order.
1083Files without absolute paths are assumed to be in
1084.Pa ~/.ssh
1085if included in a user configuration file or
1086.Pa /etc/ssh
1087if included from the system configuration file.
1088.Cm Include
1089directive may appear inside a
1090.Cm Match
1091or
1092.Cm Host
1093block
1094to perform conditional inclusion.
1095.It Cm IPQoS
1096Specifies the IPv4 type-of-service or DSCP class for connections.
1097Accepted values are
1098.Cm af11 ,
1099.Cm af12 ,
1100.Cm af13 ,
1101.Cm af21 ,
1102.Cm af22 ,
1103.Cm af23 ,
1104.Cm af31 ,
1105.Cm af32 ,
1106.Cm af33 ,
1107.Cm af41 ,
1108.Cm af42 ,
1109.Cm af43 ,
1110.Cm cs0 ,
1111.Cm cs1 ,
1112.Cm cs2 ,
1113.Cm cs3 ,
1114.Cm cs4 ,
1115.Cm cs5 ,
1116.Cm cs6 ,
1117.Cm cs7 ,
1118.Cm ef ,
1119.Cm le ,
1120.Cm lowdelay ,
1121.Cm throughput ,
1122.Cm reliability ,
1123a numeric value, or
1124.Cm none
1125to use the operating system default.
1126This option may take one or two arguments, separated by whitespace.
1127If one argument is specified, it is used as the packet class unconditionally.
1128If two values are specified, the first is automatically selected for
1129interactive sessions and the second for non-interactive sessions.
1130The default is
1131.Cm af21
1132(Low-Latency Data)
1133for interactive sessions and
1134.Cm cs1
1135(Lower Effort)
1136for non-interactive sessions.
1137.It Cm KbdInteractiveAuthentication
1138Specifies whether to use keyboard-interactive authentication.
1139The argument to this keyword must be
1140.Cm yes
1141(the default)
1142or
1143.Cm no .
1144.Cm ChallengeResponseAuthentication
1145is a deprecated alias for this.
1146.It Cm KbdInteractiveDevices
1147Specifies the list of methods to use in keyboard-interactive authentication.
1148Multiple method names must be comma-separated.
1149The default is to use the server specified list.
1150The methods available vary depending on what the server supports.
1151For an OpenSSH server,
1152it may be zero or more of:
1153.Cm bsdauth
1154and
1155.Cm pam .
1156.It Cm KexAlgorithms
1157Specifies the available KEX (Key Exchange) algorithms.
1158Multiple algorithms must be comma-separated.
1159If the specified list begins with a
1160.Sq +
1161character, then the specified algorithms will be appended to the default set
1162instead of replacing them.
1163If the specified list begins with a
1164.Sq -
1165character, then the specified algorithms (including wildcards) will be removed
1166from the default set instead of replacing them.
1167If the specified list begins with a
1168.Sq ^
1169character, then the specified algorithms will be placed at the head of the
1170default set.
1171The default is:
1172.Bd -literal -offset indent
1173curve25519-sha256,[email protected],
1174ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
1175diffie-hellman-group-exchange-sha256,
1176diffie-hellman-group16-sha512,
1177diffie-hellman-group18-sha512,
1178diffie-hellman-group14-sha256
1179.Ed
1180.Pp
1181The list of available key exchange algorithms may also be obtained using
1182.Qq ssh -Q kex .
1183.It Cm KnownHostsCommand
1184Specifies a command to use to obtain a list of host keys, in addition to
1185those listed in
1186.Cm UserKnownHostsFile
1187and
1188.Cm GlobalKnownHostsFile .
1189This command is executed after the files have been read.
1190It may write host key lines to standard output in identical format to the
1191usual files (described in the
1192.Sx VERIFYING HOST KEYS
1193section in
1194.Xr ssh 1 ) .
1195Arguments to
1196.Cm KnownHostsCommand
1197accept the tokens described in the
1198.Sx TOKENS
1199section.
1200The command may be invoked multiple times per connection: once when preparing
1201the preference list of host key algorithms to use, again to obtain the
1202host key for the requested host name and, if
1203.Cm CheckHostIP
1204is enabled, one more time to obtain the host key matching the server's
1205address.
1206If the command exits abnormally or returns a non-zero exit status then the
1207connection is terminated.
1208.It Cm LocalCommand
1209Specifies a command to execute on the local machine after successfully
1210connecting to the server.
1211The command string extends to the end of the line, and is executed with
1212the user's shell.
1213Arguments to
1214.Cm LocalCommand
1215accept the tokens described in the
1216.Sx TOKENS
1217section.
1218.Pp
1219The command is run synchronously and does not have access to the
1220session of the
1221.Xr ssh 1
1222that spawned it.
1223It should not be used for interactive commands.
1224.Pp
1225This directive is ignored unless
1226.Cm PermitLocalCommand
1227has been enabled.
1228.It Cm LocalForward
1229Specifies that a TCP port on the local machine be forwarded over
1230the secure channel to the specified host and port from the remote machine.
1231The first argument specifies the listener and may be
1232.Sm off
1233.Oo Ar bind_address : Oc Ar port
1234.Sm on
1235or a Unix domain socket path.
1236The second argument is the destination and may be
1237.Ar host : Ns Ar hostport
1238or a Unix domain socket path if the remote host supports it.
1239.Pp
1240IPv6 addresses can be specified by enclosing addresses in square brackets.
1241Multiple forwardings may be specified, and additional forwardings can be
1242given on the command line.
1243Only the superuser can forward privileged ports.
1244By default, the local port is bound in accordance with the
1245.Cm GatewayPorts
1246setting.
1247However, an explicit
1248.Ar bind_address
1249may be used to bind the connection to a specific address.
1250The
1251.Ar bind_address
1252of
1253.Cm localhost
1254indicates that the listening port be bound for local use only, while an
1255empty address or
1256.Sq *
1257indicates that the port should be available from all interfaces.
1258Unix domain socket paths may use the tokens described in the
1259.Sx TOKENS
1260section and environment variables as described in the
1261.Sx ENVIRONMENT VARIABLES
1262section.
1263.It Cm LogLevel
1264Gives the verbosity level that is used when logging messages from
1265.Xr ssh 1 .
1266The possible values are:
1267QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
1268The default is INFO.
1269DEBUG and DEBUG1 are equivalent.
1270DEBUG2 and DEBUG3 each specify higher levels of verbose output.
1271.It Cm LogVerbose
1272Specify one or more overrides to LogLevel.
1273An override consists of a pattern lists that matches the source file, function
1274and line number to force detailed logging for.
1275For example, an override pattern of:
1276.Bd -literal -offset indent
1277kex.c:*:1000,*:kex_exchange_identification():*,packet.c:*
1278.Ed
1279.Pp
1280would enable detailed logging for line 1000 of
1281.Pa kex.c ,
1282everything in the
1283.Fn kex_exchange_identification
1284function, and all code in the
1285.Pa packet.c
1286file.
1287This option is intended for debugging and no overrides are enabled by default.
1288.It Cm MACs
1289Specifies the MAC (message authentication code) algorithms
1290in order of preference.
1291The MAC algorithm is used for data integrity protection.
1292Multiple algorithms must be comma-separated.
1293If the specified list begins with a
1294.Sq +
1295character, then the specified algorithms will be appended to the default set
1296instead of replacing them.
1297If the specified list begins with a
1298.Sq -
1299character, then the specified algorithms (including wildcards) will be removed
1300from the default set instead of replacing them.
1301If the specified list begins with a
1302.Sq ^
1303character, then the specified algorithms will be placed at the head of the
1304default set.
1305.Pp
1306The algorithms that contain
1307.Qq -etm
1308calculate the MAC after encryption (encrypt-then-mac).
1309These are considered safer and their use recommended.
1310.Pp
1311The default is:
1312.Bd -literal -offset indent
1313[email protected],[email protected],
1314[email protected],[email protected],
1315[email protected],
1316[email protected],[email protected],
1317hmac-sha2-256,hmac-sha2-512,hmac-sha1
1318.Ed
1319.Pp
1320The list of available MAC algorithms may also be obtained using
1321.Qq ssh -Q mac .
1322.It Cm NoHostAuthenticationForLocalhost
1323Disable host authentication for localhost (loopback addresses).
1324The argument to this keyword must be
1325.Cm yes
1326or
1327.Cm no
1328(the default).
1329.It Cm NumberOfPasswordPrompts
1330Specifies the number of password prompts before giving up.
1331The argument to this keyword must be an integer.
1332The default is 3.
1333.It Cm PasswordAuthentication
1334Specifies whether to use password authentication.
1335The argument to this keyword must be
1336.Cm yes
1337(the default)
1338or
1339.Cm no .
1340.It Cm PermitLocalCommand
1341Allow local command execution via the
1342.Ic LocalCommand
1343option or using the
1344.Ic !\& Ns Ar command
1345escape sequence in
1346.Xr ssh 1 .
1347The argument must be
1348.Cm yes
1349or
1350.Cm no
1351(the default).
1352.It Cm PermitRemoteOpen
1353Specifies the destinations to which remote TCP port forwarding is permitted when
1354.Cm RemoteForward
1355is used as a SOCKS proxy.
1356The forwarding specification must be one of the following forms:
1357.Pp
1358.Bl -item -offset indent -compact
1359.It
1360.Cm PermitRemoteOpen
1361.Sm off
1362.Ar host : port
1363.Sm on
1364.It
1365.Cm PermitRemoteOpen
1366.Sm off
1367.Ar IPv4_addr : port
1368.Sm on
1369.It
1370.Cm PermitRemoteOpen
1371.Sm off
1372.Ar \&[ IPv6_addr \&] : port
1373.Sm on
1374.El
1375.Pp
1376Multiple forwards may be specified by separating them with whitespace.
1377An argument of
1378.Cm any
1379can be used to remove all restrictions and permit any forwarding requests.
1380An argument of
1381.Cm none
1382can be used to prohibit all forwarding requests.
1383The wildcard
1384.Sq *
1385can be used for host or port to allow all hosts or ports respectively.
1386Otherwise, no pattern matching or address lookups are performed on supplied
1387names.
1388.It Cm PKCS11Provider
1389Specifies which PKCS#11 provider to use or
1390.Cm none
1391to indicate that no provider should be used (the default).
1392The argument to this keyword is a path to the PKCS#11 shared library
1393.Xr ssh 1
1394should use to communicate with a PKCS#11 token providing keys for user
1395authentication.
1396.It Cm Port
1397Specifies the port number to connect on the remote host.
1398The default is 22.
1399.It Cm PreferredAuthentications
1400Specifies the order in which the client should try authentication methods.
1401This allows a client to prefer one method (e.g.\&
1402.Cm keyboard-interactive )
1403over another method (e.g.\&
1404.Cm password ) .
1405The default is:
1406.Bd -literal -offset indent
1407gssapi-with-mic,hostbased,publickey,
1408keyboard-interactive,password
1409.Ed
1410.It Cm ProxyCommand
1411Specifies the command to use to connect to the server.
1412The command
1413string extends to the end of the line, and is executed
1414using the user's shell
1415.Ql exec
1416directive to avoid a lingering shell process.
1417.Pp
1418Arguments to
1419.Cm ProxyCommand
1420accept the tokens described in the
1421.Sx TOKENS
1422section.
1423The command can be basically anything,
1424and should read from its standard input and write to its standard output.
1425It should eventually connect an
1426.Xr sshd 8
1427server running on some machine, or execute
1428.Ic sshd -i
1429somewhere.
1430Host key management will be done using the
1431.Cm Hostname
1432of the host being connected (defaulting to the name typed by the user).
1433Setting the command to
1434.Cm none
1435disables this option entirely.
1436Note that
1437.Cm CheckHostIP
1438is not available for connects with a proxy command.
1439.Pp
1440This directive is useful in conjunction with
1441.Xr nc 1
1442and its proxy support.
1443For example, the following directive would connect via an HTTP proxy at
1444192.0.2.0:
1445.Bd -literal -offset 3n
1446ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p
1447.Ed
1448.It Cm ProxyJump
1449Specifies one or more jump proxies as either
1450.Xo
1451.Sm off
1452.Op Ar user No @
1453.Ar host
1454.Op : Ns Ar port
1455.Sm on
1456or an ssh URI
1457.Xc .
1458Multiple proxies may be separated by comma characters and will be visited
1459sequentially.
1460Setting this option will cause
1461.Xr ssh 1
1462to connect to the target host by first making a
1463.Xr ssh 1
1464connection to the specified
1465.Cm ProxyJump
1466host and then establishing a
1467TCP forwarding to the ultimate target from there.
1468Setting the host to
1469.Cm none
1470disables this option entirely.
1471.Pp
1472Note that this option will compete with the
1473.Cm ProxyCommand
1474option - whichever is specified first will prevent later instances of the
1475other from taking effect.
1476.Pp
1477Note also that the configuration for the destination host (either supplied
1478via the command-line or the configuration file) is not generally applied
1479to jump hosts.
1480.Pa ~/.ssh/config
1481should be used if specific configuration is required for jump hosts.
1482.It Cm ProxyUseFdpass
1483Specifies that
1484.Cm ProxyCommand
1485will pass a connected file descriptor back to
1486.Xr ssh 1
1487instead of continuing to execute and pass data.
1488The default is
1489.Cm no .
1490.It Cm PubkeyAcceptedAlgorithms
1491Specifies the signature algorithms that will be used for public key
1492authentication as a comma-separated list of patterns.
1493If the specified list begins with a
1494.Sq +
1495character, then the algorithms after it will be appended to the default
1496instead of replacing it.
1497If the specified list begins with a
1498.Sq -
1499character, then the specified algorithms (including wildcards) will be removed
1500from the default set instead of replacing them.
1501If the specified list begins with a
1502.Sq ^
1503character, then the specified algorithms will be placed at the head of the
1504default set.
1505The default for this option is:
1506.Bd -literal -offset 3n
1507[email protected],
1508[email protected],
1509[email protected],
1510[email protected],
1511[email protected],
1512[email protected],
1513[email protected],
1514[email protected],
1515[email protected],
1516ssh-ed25519,
1517ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1518[email protected],
1519[email protected],
1520rsa-sha2-512,rsa-sha2-256,ssh-rsa
1521.Ed
1522.Pp
1523The list of available signature algorithms may also be obtained using
1524.Qq ssh -Q PubkeyAcceptedAlgorithms .
1525.It Cm PubkeyAuthentication
1526Specifies whether to try public key authentication.
1527The argument to this keyword must be
1528.Cm yes
1529(the default)
1530or
1531.Cm no .
1532.It Cm RekeyLimit
1533Specifies the maximum amount of data that may be transmitted before the
1534session key is renegotiated, optionally followed by a maximum amount of
1535time that may pass before the session key is renegotiated.
1536The first argument is specified in bytes and may have a suffix of
1537.Sq K ,
1538.Sq M ,
1539or
1540.Sq G
1541to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1542The default is between
1543.Sq 1G
1544and
1545.Sq 4G ,
1546depending on the cipher.
1547The optional second value is specified in seconds and may use any of the
1548units documented in the TIME FORMATS section of
1549.Xr sshd_config 5 .
1550The default value for
1551.Cm RekeyLimit
1552is
1553.Cm default none ,
1554which means that rekeying is performed after the cipher's default amount
1555of data has been sent or received and no time based rekeying is done.
1556.It Cm RemoteCommand
1557Specifies a command to execute on the remote machine after successfully
1558connecting to the server.
1559The command string extends to the end of the line, and is executed with
1560the user's shell.
1561Arguments to
1562.Cm RemoteCommand
1563accept the tokens described in the
1564.Sx TOKENS
1565section.
1566.It Cm RemoteForward
1567Specifies that a TCP port on the remote machine be forwarded over
1568the secure channel.
1569The remote port may either be forwarded to a specified host and port
1570from the local machine, or may act as a SOCKS 4/5 proxy that allows a remote
1571client to connect to arbitrary destinations from the local machine.
1572The first argument is the listening specification and may be
1573.Sm off
1574.Oo Ar bind_address : Oc Ar port
1575.Sm on
1576or, if the remote host supports it, a Unix domain socket path.
1577If forwarding to a specific destination then the second argument must be
1578.Ar host : Ns Ar hostport
1579or a Unix domain socket path,
1580otherwise if no destination argument is specified then the remote forwarding
1581will be established as a SOCKS proxy.
1582When acting as a SOCKS proxy the destination of the connection can be
1583restricted by
1584.Cm PermitRemoteOpen .
1585.Pp
1586IPv6 addresses can be specified by enclosing addresses in square brackets.
1587Multiple forwardings may be specified, and additional
1588forwardings can be given on the command line.
1589Privileged ports can be forwarded only when
1590logging in as root on the remote machine.
1591Unix domain socket paths may use the tokens described in the
1592.Sx TOKENS
1593section and environment variables as described in the
1594.Sx ENVIRONMENT VARIABLES
1595section.
1596.Pp
1597If the
1598.Ar port
1599argument is 0,
1600the listen port will be dynamically allocated on the server and reported
1601to the client at run time.
1602.Pp
1603If the
1604.Ar bind_address
1605is not specified, the default is to only bind to loopback addresses.
1606If the
1607.Ar bind_address
1608is
1609.Ql *
1610or an empty string, then the forwarding is requested to listen on all
1611interfaces.
1612Specifying a remote
1613.Ar bind_address
1614will only succeed if the server's
1615.Cm GatewayPorts
1616option is enabled (see
1617.Xr sshd_config 5 ) .
1618.It Cm RequestTTY
1619Specifies whether to request a pseudo-tty for the session.
1620The argument may be one of:
1621.Cm no
1622(never request a TTY),
1623.Cm yes
1624(always request a TTY when standard input is a TTY),
1625.Cm force
1626(always request a TTY) or
1627.Cm auto
1628(request a TTY when opening a login session).
1629This option mirrors the
1630.Fl t
1631and
1632.Fl T
1633flags for
1634.Xr ssh 1 .
1635.It Cm RevokedHostKeys
1636Specifies revoked host public keys.
1637Keys listed in this file will be refused for host authentication.
1638Note that if this file does not exist or is not readable,
1639then host authentication will be refused for all hosts.
1640Keys may be specified as a text file, listing one public key per line, or as
1641an OpenSSH Key Revocation List (KRL) as generated by
1642.Xr ssh-keygen 1 .
1643For more information on KRLs, see the KEY REVOCATION LISTS section in
1644.Xr ssh-keygen 1 .
1645.It Cm SecurityKeyProvider
1646Specifies a path to a library that will be used when loading any
1647FIDO authenticator-hosted keys, overriding the default of using
1648the built-in USB HID support.
1649.Pp
1650If the specified value begins with a
1651.Sq $
1652character, then it will be treated as an environment variable containing
1653the path to the library.
1654.It Cm SendEnv
1655Specifies what variables from the local
1656.Xr environ 7
1657should be sent to the server.
1658The server must also support it, and the server must be configured to
1659accept these environment variables.
1660Note that the
1661.Ev TERM
1662environment variable is always sent whenever a
1663pseudo-terminal is requested as it is required by the protocol.
1664Refer to
1665.Cm AcceptEnv
1666in
1667.Xr sshd_config 5
1668for how to configure the server.
1669Variables are specified by name, which may contain wildcard characters.
1670Multiple environment variables may be separated by whitespace or spread
1671across multiple
1672.Cm SendEnv
1673directives.
1674.Pp
1675See
1676.Sx PATTERNS
1677for more information on patterns.
1678.Pp
1679It is possible to clear previously set
1680.Cm SendEnv
1681variable names by prefixing patterns with
1682.Pa - .
1683The default is not to send any environment variables.
1684.It Cm ServerAliveCountMax
1685Sets the number of server alive messages (see below) which may be
1686sent without
1687.Xr ssh 1
1688receiving any messages back from the server.
1689If this threshold is reached while server alive messages are being sent,
1690ssh will disconnect from the server, terminating the session.
1691It is important to note that the use of server alive messages is very
1692different from
1693.Cm TCPKeepAlive
1694(below).
1695The server alive messages are sent through the encrypted channel
1696and therefore will not be spoofable.
1697The TCP keepalive option enabled by
1698.Cm TCPKeepAlive
1699is spoofable.
1700The server alive mechanism is valuable when the client or
1701server depend on knowing when a connection has become unresponsive.
1702.Pp
1703The default value is 3.
1704If, for example,
1705.Cm ServerAliveInterval
1706(see below) is set to 15 and
1707.Cm ServerAliveCountMax
1708is left at the default, if the server becomes unresponsive,
1709ssh will disconnect after approximately 45 seconds.
1710.It Cm ServerAliveInterval
1711Sets a timeout interval in seconds after which if no data has been received
1712from the server,
1713.Xr ssh 1
1714will send a message through the encrypted
1715channel to request a response from the server.
1716The default
1717is 0, indicating that these messages will not be sent to the server.
1718.It Cm SessionType
1719May be used to either request invocation of a subsystem on the remote system,
1720or to prevent the execution of a remote command at all.
1721The latter is useful for just forwarding ports.
1722The argument to this keyword must be
1723.Cm none
1724(same as the
1725.Fl N
1726option),
1727.Cm subsystem
1728(same as the
1729.Fl s
1730option) or
1731.Cm default
1732(shell or command execution).
1733.It Cm SetEnv
1734Directly specify one or more environment variables and their contents to
1735be sent to the server.
1736Similarly to
1737.Cm SendEnv ,
1738with the exception of the
1739.Ev TERM
1740variable, the server must be prepared to accept the environment variable.
1741.It Cm StdinNull
1742Redirects stdin from
1743.Pa /dev/null
1744(actually, prevents reading from stdin).
1745Either this or the equivalent
1746.Fl n
1747option must be used when
1748.Nm ssh
1749is run in the background.
1750The argument to this keyword must be
1751.Cm yes
1752(same as the
1753.Fl n
1754option) or
1755.Cm no
1756(the default).
1757.It Cm StreamLocalBindMask
1758Sets the octal file creation mode mask
1759.Pq umask
1760used when creating a Unix-domain socket file for local or remote
1761port forwarding.
1762This option is only used for port forwarding to a Unix-domain socket file.
1763.Pp
1764The default value is 0177, which creates a Unix-domain socket file that is
1765readable and writable only by the owner.
1766Note that not all operating systems honor the file mode on Unix-domain
1767socket files.
1768.It Cm StreamLocalBindUnlink
1769Specifies whether to remove an existing Unix-domain socket file for local
1770or remote port forwarding before creating a new one.
1771If the socket file already exists and
1772.Cm StreamLocalBindUnlink
1773is not enabled,
1774.Nm ssh
1775will be unable to forward the port to the Unix-domain socket file.
1776This option is only used for port forwarding to a Unix-domain socket file.
1777.Pp
1778The argument must be
1779.Cm yes
1780or
1781.Cm no
1782(the default).
1783.It Cm StrictHostKeyChecking
1784If this flag is set to
1785.Cm yes ,
1786.Xr ssh 1
1787will never automatically add host keys to the
1788.Pa ~/.ssh/known_hosts
1789file, and refuses to connect to hosts whose host key has changed.
1790This provides maximum protection against man-in-the-middle (MITM) attacks,
1791though it can be annoying when the
1792.Pa /etc/ssh/ssh_known_hosts
1793file is poorly maintained or when connections to new hosts are
1794frequently made.
1795This option forces the user to manually
1796add all new hosts.
1797.Pp
1798If this flag is set to
1799.Cm accept-new
1800then ssh will automatically add new host keys to the user's
1801.Pa known_hosts
1802file, but will not permit connections to hosts with
1803changed host keys.
1804If this flag is set to
1805.Cm no
1806or
1807.Cm off ,
1808ssh will automatically add new host keys to the user known hosts files
1809and allow connections to hosts with changed hostkeys to proceed,
1810subject to some restrictions.
1811If this flag is set to
1812.Cm ask
1813(the default),
1814new host keys
1815will be added to the user known host files only after the user
1816has confirmed that is what they really want to do, and
1817ssh will refuse to connect to hosts whose host key has changed.
1818The host keys of
1819known hosts will be verified automatically in all cases.
1820.It Cm SyslogFacility
1821Gives the facility code that is used when logging messages from
1822.Xr ssh 1 .
1823The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1824LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1825The default is USER.
1826.It Cm TCPKeepAlive
1827Specifies whether the system should send TCP keepalive messages to the
1828other side.
1829If they are sent, death of the connection or crash of one
1830of the machines will be properly noticed.
1831However, this means that
1832connections will die if the route is down temporarily, and some people
1833find it annoying.
1834.Pp
1835The default is
1836.Cm yes
1837(to send TCP keepalive messages), and the client will notice
1838if the network goes down or the remote host dies.
1839This is important in scripts, and many users want it too.
1840.Pp
1841To disable TCP keepalive messages, the value should be set to
1842.Cm no .
1843See also
1844.Cm ServerAliveInterval
1845for protocol-level keepalives.
1846.It Cm Tunnel
1847Request
1848.Xr tun 4
1849device forwarding between the client and the server.
1850The argument must be
1851.Cm yes ,
1852.Cm point-to-point
1853(layer 3),
1854.Cm ethernet
1855(layer 2),
1856or
1857.Cm no
1858(the default).
1859Specifying
1860.Cm yes
1861requests the default tunnel mode, which is
1862.Cm point-to-point .
1863.It Cm TunnelDevice
1864Specifies the
1865.Xr tun 4
1866devices to open on the client
1867.Pq Ar local_tun
1868and the server
1869.Pq Ar remote_tun .
1870.Pp
1871The argument must be
1872.Sm off
1873.Ar local_tun Op : Ar remote_tun .
1874.Sm on
1875The devices may be specified by numerical ID or the keyword
1876.Cm any ,
1877which uses the next available tunnel device.
1878If
1879.Ar remote_tun
1880is not specified, it defaults to
1881.Cm any .
1882The default is
1883.Cm any:any .
1884.It Cm UpdateHostKeys
1885Specifies whether
1886.Xr ssh 1
1887should accept notifications of additional hostkeys from the server sent
1888after authentication has completed and add them to
1889.Cm UserKnownHostsFile .
1890The argument must be
1891.Cm yes ,
1892.Cm no
1893or
1894.Cm ask .
1895This option allows learning alternate hostkeys for a server
1896and supports graceful key rotation by allowing a server to send replacement
1897public keys before old ones are removed.
1898.Pp
1899Additional hostkeys are only accepted if the key used to authenticate the
1900host was already trusted or explicitly accepted by the user, the host was
1901authenticated via
1902.Cm UserKnownHostsFile
1903(i.e. not
1904.Cm GlobalKnownHostsFile )
1905and the host was authenticated using a plain key and not a certificate.
1906.Pp
1907.Cm UpdateHostKeys
1908is enabled by default if the user has not overridden the default
1909.Cm UserKnownHostsFile
1910setting and has not enabled
1911.Cm VerifyHostKeyDNS ,
1912otherwise
1913.Cm UpdateHostKeys
1914will be set to
1915.Cm no .
1916.Pp
1917If
1918.Cm UpdateHostKeys
1919is set to
1920.Cm ask ,
1921then the user is asked to confirm the modifications to the known_hosts file.
1922Confirmation is currently incompatible with
1923.Cm ControlPersist ,
1924and will be disabled if it is enabled.
1925.Pp
1926Presently, only
1927.Xr sshd 8
1928from OpenSSH 6.8 and greater support the
1929.Qq [email protected]
1930protocol extension used to inform the client of all the server's hostkeys.
1931.It Cm User
1932Specifies the user to log in as.
1933This can be useful when a different user name is used on different machines.
1934This saves the trouble of
1935having to remember to give the user name on the command line.
1936.It Cm UserKnownHostsFile
1937Specifies one or more files to use for the user
1938host key database, separated by whitespace.
1939Each filename may use tilde notation to refer to the user's home directory,
1940the tokens described in the
1941.Sx TOKENS
1942section and environment variables as described in the
1943.Sx ENVIRONMENT VARIABLES
1944section.
1945The default is
1946.Pa ~/.ssh/known_hosts ,
1947.Pa ~/.ssh/known_hosts2 .
1948.It Cm VerifyHostKeyDNS
1949Specifies whether to verify the remote key using DNS and SSHFP resource
1950records.
1951If this option is set to
1952.Cm yes ,
1953the client will implicitly trust keys that match a secure fingerprint
1954from DNS.
1955Insecure fingerprints will be handled as if this option was set to
1956.Cm ask .
1957If this option is set to
1958.Cm ask ,
1959information on fingerprint match will be displayed, but the user will still
1960need to confirm new host keys according to the
1961.Cm StrictHostKeyChecking
1962option.
1963The default is
1964.Cm yes
1965if compiled with LDNS and
1966.Cm no
1967otherwise.
1968.Pp
1969See also
1970.Sx VERIFYING HOST KEYS
1971in
1972.Xr ssh 1 .
1973.It Cm VersionAddendum
1974Specifies a string to append to the regular version string to identify
1975OS- or site-specific modifications.
1976The default is
1977.Dq FreeBSD-20211221 .
1978The value
1979.Cm none
1980may be used to disable this.
1981.It Cm VisualHostKey
1982If this flag is set to
1983.Cm yes ,
1984an ASCII art representation of the remote host key fingerprint is
1985printed in addition to the fingerprint string at login and
1986for unknown host keys.
1987If this flag is set to
1988.Cm no
1989(the default),
1990no fingerprint strings are printed at login and
1991only the fingerprint string will be printed for unknown host keys.
1992.It Cm XAuthLocation
1993Specifies the full pathname of the
1994.Xr xauth 1
1995program.
1996The default is
1997.Pa /usr/local/bin/xauth .
1998.El
1999.Sh PATTERNS
2000A
2001.Em pattern
2002consists of zero or more non-whitespace characters,
2003.Sq *
2004(a wildcard that matches zero or more characters),
2005or
2006.Sq ?\&
2007(a wildcard that matches exactly one character).
2008For example, to specify a set of declarations for any host in the
2009.Qq .co.uk
2010set of domains,
2011the following pattern could be used:
2012.Pp
2013.Dl Host *.co.uk
2014.Pp
2015The following pattern
2016would match any host in the 192.168.0.[0-9] network range:
2017.Pp
2018.Dl Host 192.168.0.?
2019.Pp
2020A
2021.Em pattern-list
2022is a comma-separated list of patterns.
2023Patterns within pattern-lists may be negated
2024by preceding them with an exclamation mark
2025.Pq Sq !\& .
2026For example,
2027to allow a key to be used from anywhere within an organization
2028except from the
2029.Qq dialup
2030pool,
2031the following entry (in authorized_keys) could be used:
2032.Pp
2033.Dl from=\&"!*.dialup.example.com,*.example.com\&"
2034.Pp
2035Note that a negated match will never produce a positive result by itself.
2036For example, attempting to match
2037.Qq host3
2038against the following pattern-list will fail:
2039.Pp
2040.Dl from=\&"!host1,!host2\&"
2041.Pp
2042The solution here is to include a term that will yield a positive match,
2043such as a wildcard:
2044.Pp
2045.Dl from=\&"!host1,!host2,*\&"
2046.Sh TOKENS
2047Arguments to some keywords can make use of tokens,
2048which are expanded at runtime:
2049.Pp
2050.Bl -tag -width XXXX -offset indent -compact
2051.It %%
2052A literal
2053.Sq % .
2054.It \&%C
2055Hash of %l%h%p%r.
2056.It %d
2057Local user's home directory.
2058.It %f
2059The fingerprint of the server's host key.
2060.It %H
2061The
2062.Pa known_hosts
2063hostname or address that is being searched for.
2064.It %h
2065The remote hostname.
2066.It \%%I
2067A string describing the reason for a
2068.Cm KnownHostsCommand
2069execution: either
2070.Cm ADDRESS
2071when looking up a host by address (only when
2072.Cm CheckHostIP
2073is enabled),
2074.Cm HOSTNAME
2075when searching by hostname, or
2076.Cm ORDER
2077when preparing the host key algorithm preference list to use for the
2078destination host.
2079.It %i
2080The local user ID.
2081.It %K
2082The base64 encoded host key.
2083.It %k
2084The host key alias if specified, otherwise the original remote hostname given
2085on the command line.
2086.It %L
2087The local hostname.
2088.It %l
2089The local hostname, including the domain name.
2090.It %n
2091The original remote hostname, as given on the command line.
2092.It %p
2093The remote port.
2094.It %r
2095The remote username.
2096.It \&%T
2097The local
2098.Xr tun 4
2099or
2100.Xr tap 4
2101network interface assigned if
2102tunnel forwarding was requested, or
2103.Qq NONE
2104otherwise.
2105.It %t
2106The type of the server host key, e.g.
2107.Cm ssh-ed25519 .
2108.It %u
2109The local username.
2110.El
2111.Pp
2112.Cm CertificateFile ,
2113.Cm ControlPath ,
2114.Cm IdentityAgent ,
2115.Cm IdentityFile ,
2116.Cm KnownHostsCommand ,
2117.Cm LocalForward ,
2118.Cm Match exec ,
2119.Cm RemoteCommand ,
2120.Cm RemoteForward ,
2121and
2122.Cm UserKnownHostsFile
2123accept the tokens %%, %C, %d, %h, %i, %k, %L, %l, %n, %p, %r, and %u.
2124.Pp
2125.Cm KnownHostsCommand
2126additionally accepts the tokens %f, %H, %I, %K and %t.
2127.Pp
2128.Cm Hostname
2129accepts the tokens %% and %h.
2130.Pp
2131.Cm LocalCommand
2132accepts all tokens.
2133.Pp
2134.Cm ProxyCommand
2135accepts the tokens %%, %h, %n, %p, and %r.
2136.Sh ENVIRONMENT VARIABLES
2137Arguments to some keywords can be expanded at runtime from environment
2138variables on the client by enclosing them in
2139.Ic ${} ,
2140for example
2141.Ic ${HOME}/.ssh
2142would refer to the user's .ssh directory.
2143If a specified environment variable does not exist then an error will be
2144returned and the setting for that keyword will be ignored.
2145.Pp
2146The keywords
2147.Cm CertificateFile ,
2148.Cm ControlPath ,
2149.Cm IdentityAgent ,
2150.Cm IdentityFile ,
2151.Cm KnownHostsCommand ,
2152and
2153.Cm UserKnownHostsFile
2154support environment variables.
2155The keywords
2156.Cm LocalForward
2157and
2158.Cm RemoteForward
2159support environment variables only for Unix domain socket paths.
2160.Sh FILES
2161.Bl -tag -width Ds
2162.It Pa ~/.ssh/config
2163This is the per-user configuration file.
2164The format of this file is described above.
2165This file is used by the SSH client.
2166Because of the potential for abuse, this file must have strict permissions:
2167read/write for the user, and not writable by others.
2168.It Pa /etc/ssh/ssh_config
2169Systemwide configuration file.
2170This file provides defaults for those
2171values that are not specified in the user's configuration file, and
2172for those users who do not have a configuration file.
2173This file must be world-readable.
2174.El
2175.Sh SEE ALSO
2176.Xr ssh 1
2177.Sh AUTHORS
2178.An -nosplit
2179OpenSSH is a derivative of the original and free
2180ssh 1.2.12 release by
2181.An Tatu Ylonen .
2182.An Aaron Campbell , Bob Beck , Markus Friedl ,
2183.An Niels Provos , Theo de Raadt
2184and
2185.An Dug Song
2186removed many bugs, re-added newer features and
2187created OpenSSH.
2188.An Markus Friedl
2189contributed the support for SSH protocol versions 1.5 and 2.0.
2190