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