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