xref: /freebsd/crypto/openssh/ssh_config.5 (revision 10b9d77bf1ccf2f3affafa6261692cb92cf7e992)
1.\"  -*- nroff -*-
2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5.\"                    All rights reserved
6.\"
7.\" As far as I am concerned, the code I have written for this software
8.\" can be used freely for any purpose.  Any derived versions of this
9.\" software must be clearly marked as such, and if the derived work is
10.\" incompatible with the protocol description in the RFC file, it must be
11.\" called by a name other than "ssh" or "Secure Shell".
12.\"
13.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
14.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
15.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
16.\"
17.\" Redistribution and use in source and binary forms, with or without
18.\" modification, are permitted provided that the following conditions
19.\" are met:
20.\" 1. Redistributions of source code must retain the above copyright
21.\"    notice, this list of conditions and the following disclaimer.
22.\" 2. Redistributions in binary form must reproduce the above copyright
23.\"    notice, this list of conditions and the following disclaimer in the
24.\"    documentation and/or other materials provided with the distribution.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\"
37.\" $OpenBSD: ssh_config.5,v 1.138 2010/08/04 05:37:01 djm Exp $
38.\" $FreeBSD$
39.Dd August 4, 2010
40.Dt SSH_CONFIG 5
41.Os
42.Sh NAME
43.Nm ssh_config
44.Nd OpenSSH SSH client configuration files
45.Sh SYNOPSIS
46.Nm ~/.ssh/config
47.Nm /etc/ssh/ssh_config
48.Sh DESCRIPTION
49.Xr ssh 1
50obtains configuration data from the following sources in
51the following order:
52.Pp
53.Bl -enum -offset indent -compact
54.It
55command-line options
56.It
57user's configuration file
58.Pq Pa ~/.ssh/config
59.It
60system-wide configuration file
61.Pq Pa /etc/ssh/ssh_config
62.El
63.Pp
64For each parameter, the first obtained value
65will be used.
66The configuration files contain sections separated by
67.Dq Host
68specifications, and that section is only applied for hosts that
69match one of the patterns given in the specification.
70The matched host name is the one given on the command line.
71.Pp
72Since the first obtained value for each parameter is used, more
73host-specific declarations should be given near the beginning of the
74file, and general defaults at the end.
75.Pp
76The configuration file has the following format:
77.Pp
78Empty lines and lines starting with
79.Ql #
80are comments.
81Otherwise a line is of the format
82.Dq keyword arguments .
83Configuration options may be separated by whitespace or
84optional whitespace and exactly one
85.Ql = ;
86the latter format is useful to avoid the need to quote whitespace
87when specifying configuration options using the
88.Nm ssh ,
89.Nm scp ,
90and
91.Nm sftp
92.Fl o
93option.
94Arguments may optionally be enclosed in double quotes
95.Pq \&"
96in order to represent arguments containing spaces.
97.Pp
98The possible
99keywords and their meanings are as follows (note that
100keywords are case-insensitive and arguments are case-sensitive):
101.Bl -tag -width Ds
102.It Cm Host
103Restricts the following declarations (up to the next
104.Cm Host
105keyword) to be only for those hosts that match one of the patterns
106given after the keyword.
107If more than one pattern is provided, they should be separated by whitespace.
108A single
109.Ql *
110as a pattern can be used to provide global
111defaults for all hosts.
112The host is the
113.Ar hostname
114argument given on the command line (i.e. the name is not converted to
115a canonicalized host name before matching).
116.Pp
117See
118.Sx PATTERNS
119for more information on patterns.
120.It Cm AddressFamily
121Specifies which address family to use when connecting.
122Valid arguments are
123.Dq any ,
124.Dq inet
125(use IPv4 only), or
126.Dq inet6
127(use IPv6 only).
128.It Cm BatchMode
129If set to
130.Dq yes ,
131passphrase/password querying will be disabled.
132This option is useful in scripts and other batch jobs where no user
133is present to supply the password.
134The argument must be
135.Dq yes
136or
137.Dq no .
138The default is
139.Dq no .
140.It Cm BindAddress
141Use the specified address on the local machine as the source address of
142the connection.
143Only useful on systems with more than one address.
144Note that this option does not work if
145.Cm UsePrivilegedPort
146is set to
147.Dq yes .
148.It Cm ChallengeResponseAuthentication
149Specifies whether to use challenge-response authentication.
150The argument to this keyword must be
151.Dq yes
152or
153.Dq no .
154The default is
155.Dq yes .
156.It Cm CheckHostIP
157If this flag is set to
158.Dq yes ,
159.Xr ssh 1
160will additionally check the host IP address in the
161.Pa known_hosts
162file.
163This allows ssh to detect if a host key changed due to DNS spoofing.
164If the option is set to
165.Dq no ,
166the check will not be executed.
167The default is
168.Dq no .
169.It Cm Cipher
170Specifies the cipher to use for encrypting the session
171in protocol version 1.
172Currently,
173.Dq blowfish ,
174.Dq 3des ,
175and
176.Dq des
177are supported.
178.Ar des
179is only supported in the
180.Xr ssh 1
181client for interoperability with legacy protocol 1 implementations
182that do not support the
183.Ar 3des
184cipher.
185Its use is strongly discouraged due to cryptographic weaknesses.
186The default is
187.Dq 3des .
188.It Cm Ciphers
189Specifies the ciphers allowed for protocol version 2
190in order of preference.
191Multiple ciphers must be comma-separated.
192The supported ciphers are
193.Dq 3des-cbc ,
194.Dq aes128-cbc ,
195.Dq aes192-cbc ,
196.Dq aes256-cbc ,
197.Dq aes128-ctr ,
198.Dq aes192-ctr ,
199.Dq aes256-ctr ,
200.Dq arcfour128 ,
201.Dq arcfour256 ,
202.Dq arcfour ,
203.Dq blowfish-cbc ,
204and
205.Dq cast128-cbc .
206The default is:
207.Bd -literal -offset 3n
208aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
209aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
210aes256-cbc,arcfour
211.Ed
212.It Cm ClearAllForwardings
213Specifies that all local, remote, and dynamic port forwardings
214specified in the configuration files or on the command line be
215cleared.
216This option is primarily useful when used from the
217.Xr ssh 1
218command line to clear port forwardings set in
219configuration files, and is automatically set by
220.Xr scp 1
221and
222.Xr sftp 1 .
223The argument must be
224.Dq yes
225or
226.Dq no .
227The default is
228.Dq no .
229.It Cm Compression
230Specifies whether to use compression.
231The argument must be
232.Dq yes
233or
234.Dq no .
235The default is
236.Dq no .
237.It Cm CompressionLevel
238Specifies the compression level to use if compression is enabled.
239The argument must be an integer from 1 (fast) to 9 (slow, best).
240The default level is 6, which is good for most applications.
241The meaning of the values is the same as in
242.Xr gzip 1 .
243Note that this option applies to protocol version 1 only.
244.It Cm ConnectionAttempts
245Specifies the number of tries (one per second) to make before exiting.
246The argument must be an integer.
247This may be useful in scripts if the connection sometimes fails.
248The default is 1.
249.It Cm ConnectTimeout
250Specifies the timeout (in seconds) used when connecting to the
251SSH server, instead of using the default system TCP timeout.
252This value is used only when the target is down or really unreachable,
253not when it refuses the connection.
254.It Cm ControlMaster
255Enables the sharing of multiple sessions over a single network connection.
256When set to
257.Dq yes ,
258.Xr ssh 1
259will listen for connections on a control socket specified using the
260.Cm ControlPath
261argument.
262Additional sessions can connect to this socket using the same
263.Cm ControlPath
264with
265.Cm ControlMaster
266set to
267.Dq no
268(the default).
269These sessions will try to reuse the master instance's network connection
270rather than initiating new ones, but will fall back to connecting normally
271if the control socket does not exist, or is not listening.
272.Pp
273Setting this to
274.Dq ask
275will cause ssh
276to listen for control connections, but require confirmation using the
277.Ev SSH_ASKPASS
278program before they are accepted (see
279.Xr ssh-add 1
280for details).
281If the
282.Cm ControlPath
283cannot be opened,
284ssh will continue without connecting to a master instance.
285.Pp
286X11 and
287.Xr ssh-agent 1
288forwarding is supported over these multiplexed connections, however the
289display and agent forwarded will be the one belonging to the master
290connection i.e. it is not possible to forward multiple displays or agents.
291.Pp
292Two additional options allow for opportunistic multiplexing: try to use a
293master connection but fall back to creating a new one if one does not already
294exist.
295These options are:
296.Dq auto
297and
298.Dq autoask .
299The latter requires confirmation like the
300.Dq ask
301option.
302.It Cm ControlPath
303Specify the path to the control socket used for connection sharing as described
304in the
305.Cm ControlMaster
306section above or the string
307.Dq none
308to disable connection sharing.
309In the path,
310.Ql %l
311will be substituted by the local host name,
312.Ql %h
313will be substituted by the target host name,
314.Ql %p
315the port, and
316.Ql %r
317by the remote login username.
318It is recommended that any
319.Cm ControlPath
320used for opportunistic connection sharing include
321at least %h, %p, and %r.
322This ensures that shared connections are uniquely identified.
323.It Cm ControlPersist
324When used in conjunction with
325.Cm ControlMaster ,
326specifies that the master connection should remain open
327in the background (waiting for future client connections)
328after the initial client connection has been closed.
329If set to
330.Dq no ,
331then the master connection will not be placed into the background,
332and will close as soon as the initial client connection is closed.
333If set to
334.Dq yes ,
335then the master connection will remain in the background indefinitely
336(until killed or closed via a mechanism such as the
337.Xr ssh 1
338.Dq Fl O No exit
339option).
340If set to a time in seconds, or a time in any of the formats documented in
341.Xr sshd_config 5 ,
342then the backgrounded master connection will automatically terminate
343after it has remained idle (with no client connections) for the
344specified time.
345.It Cm DynamicForward
346Specifies that a TCP port on the local machine be forwarded
347over the secure channel, and the application
348protocol is then used to determine where to connect to from the
349remote machine.
350.Pp
351The argument must be
352.Sm off
353.Oo Ar bind_address : Oc Ar port .
354.Sm on
355IPv6 addresses can be specified by enclosing addresses in square brackets.
356By default, the local port is bound in accordance with the
357.Cm GatewayPorts
358setting.
359However, an explicit
360.Ar bind_address
361may be used to bind the connection to a specific address.
362The
363.Ar bind_address
364of
365.Dq localhost
366indicates that the listening port be bound for local use only, while an
367empty address or
368.Sq *
369indicates that the port should be available from all interfaces.
370.Pp
371Currently the SOCKS4 and SOCKS5 protocols are supported, and
372.Xr ssh 1
373will act as a SOCKS server.
374Multiple forwardings may be specified, and
375additional forwardings can be given on the command line.
376Only the superuser can forward privileged ports.
377.It Cm EnableSSHKeysign
378Setting this option to
379.Dq yes
380in the global client configuration file
381.Pa /etc/ssh/ssh_config
382enables the use of the helper program
383.Xr ssh-keysign 8
384during
385.Cm HostbasedAuthentication .
386The argument must be
387.Dq yes
388or
389.Dq no .
390The default is
391.Dq no .
392This option should be placed in the non-hostspecific section.
393See
394.Xr ssh-keysign 8
395for more information.
396.It Cm EscapeChar
397Sets the escape character (default:
398.Ql ~ ) .
399The escape character can also
400be set on the command line.
401The argument should be a single character,
402.Ql ^
403followed by a letter, or
404.Dq none
405to disable the escape
406character entirely (making the connection transparent for binary
407data).
408.It Cm ExitOnForwardFailure
409Specifies whether
410.Xr ssh 1
411should terminate the connection if it cannot set up all requested
412dynamic, tunnel, local, and remote port forwardings.
413The argument must be
414.Dq yes
415or
416.Dq no .
417The default is
418.Dq no .
419.It Cm ForwardAgent
420Specifies whether the connection to the authentication agent (if any)
421will be forwarded to the remote machine.
422The argument must be
423.Dq yes
424or
425.Dq no .
426The default is
427.Dq no .
428.Pp
429Agent forwarding should be enabled with caution.
430Users with the ability to bypass file permissions on the remote host
431(for the agent's Unix-domain socket)
432can access the local agent through the forwarded connection.
433An attacker cannot obtain key material from the agent,
434however they can perform operations on the keys that enable them to
435authenticate using the identities loaded into the agent.
436.It Cm ForwardX11
437Specifies whether X11 connections will be automatically redirected
438over the secure channel and
439.Ev DISPLAY
440set.
441The argument must be
442.Dq yes
443or
444.Dq no .
445The default is
446.Dq no .
447.Pp
448X11 forwarding should be enabled with caution.
449Users with the ability to bypass file permissions on the remote host
450(for the user's X11 authorization database)
451can access the local X11 display through the forwarded connection.
452An attacker may then be able to perform activities such as keystroke monitoring
453if the
454.Cm ForwardX11Trusted
455option is also enabled.
456.It Cm ForwardX11Timeout
457Specify a timeout for untrusted X11 forwarding
458using the format described in the
459.Sx TIME FORMATS
460section of
461.Xr sshd_config 5 .
462X11 connections received by
463.Xr ssh 1
464after this time will be refused.
465The default is to disable untrusted X11 forwarding after twenty minutes has
466elapsed.
467.It Cm ForwardX11Trusted
468If this option is set to
469.Dq yes ,
470remote X11 clients will have full access to the original X11 display.
471.Pp
472If this option is set to
473.Dq no ,
474remote X11 clients will be considered untrusted and prevented
475from stealing or tampering with data belonging to trusted X11
476clients.
477Furthermore, the
478.Xr xauth 1
479token used for the session will be set to expire after 20 minutes.
480Remote clients will be refused access after this time.
481.Pp
482The default is
483.Dq no .
484.Pp
485See the X11 SECURITY extension specification for full details on
486the restrictions imposed on untrusted clients.
487.It Cm GatewayPorts
488Specifies whether remote hosts are allowed to connect to local
489forwarded ports.
490By default,
491.Xr ssh 1
492binds local port forwardings to the loopback address.
493This prevents other remote hosts from connecting to forwarded ports.
494.Cm GatewayPorts
495can be used to specify that ssh
496should bind local port forwardings to the wildcard address,
497thus allowing remote hosts to connect to forwarded ports.
498The argument must be
499.Dq yes
500or
501.Dq no .
502The default is
503.Dq no .
504.It Cm GlobalKnownHostsFile
505Specifies a file to use for the global
506host key database instead of
507.Pa /etc/ssh/ssh_known_hosts .
508.It Cm GSSAPIAuthentication
509Specifies whether user authentication based on GSSAPI is allowed.
510The default is
511.Dq no .
512Note that this option applies to protocol version 2 only.
513.It Cm GSSAPIDelegateCredentials
514Forward (delegate) credentials to the server.
515The default is
516.Dq no .
517Note that this option applies to protocol version 2 only.
518.It Cm HashKnownHosts
519Indicates that
520.Xr ssh 1
521should hash host names and addresses when they are added to
522.Pa ~/.ssh/known_hosts .
523These hashed names may be used normally by
524.Xr ssh 1
525and
526.Xr sshd 8 ,
527but they do not reveal identifying information should the file's contents
528be disclosed.
529The default is
530.Dq no .
531Note that existing names and addresses in known hosts files
532will not be converted automatically,
533but may be manually hashed using
534.Xr ssh-keygen 1 .
535.It Cm HostbasedAuthentication
536Specifies whether to try rhosts based authentication with public key
537authentication.
538The argument must be
539.Dq yes
540or
541.Dq no .
542The default is
543.Dq no .
544This option applies to protocol version 2 only and
545is similar to
546.Cm RhostsRSAAuthentication .
547.It Cm HostKeyAlgorithms
548Specifies the protocol version 2 host key algorithms
549that the client wants to use in order of preference.
550The default for this option is:
551.Dq ssh-rsa,ssh-dss .
552.It Cm HostKeyAlias
553Specifies an alias that should be used instead of the
554real host name when looking up or saving the host key
555in the host key database files.
556This option is useful for tunneling SSH connections
557or for multiple servers running on a single host.
558.It Cm HostName
559Specifies the real host name to log into.
560This can be used to specify nicknames or abbreviations for hosts.
561If the hostname contains the character sequence
562.Ql %h ,
563then this will be replaced with the host name specified on the commandline
564(this is useful for manipulating unqualified names).
565The default is the name given on the command line.
566Numeric IP addresses are also permitted (both on the command line and in
567.Cm HostName
568specifications).
569.It Cm IdentitiesOnly
570Specifies that
571.Xr ssh 1
572should only use the authentication identity files configured in the
573.Nm
574files,
575even if
576.Xr ssh-agent 1
577offers more identities.
578The argument to this keyword must be
579.Dq yes
580or
581.Dq no .
582This option is intended for situations where ssh-agent
583offers many different identities.
584The default is
585.Dq no .
586.It Cm IdentityFile
587Specifies a file from which the user's RSA or DSA authentication identity
588is read.
589The default is
590.Pa ~/.ssh/identity
591for protocol version 1, and
592.Pa ~/.ssh/id_rsa
593and
594.Pa ~/.ssh/id_dsa
595for protocol version 2.
596Additionally, any identities represented by the authentication agent
597will be used for authentication.
598.Xr ssh 1
599will try to load certificate information from the filename obtained by
600appending
601.Pa -cert.pub
602to the path of a specified
603.Cm IdentityFile .
604.Pp
605The file name may use the tilde
606syntax to refer to a user's home directory or one of the following
607escape characters:
608.Ql %d
609(local user's home directory),
610.Ql %u
611(local user name),
612.Ql %l
613(local host name),
614.Ql %h
615(remote host name) or
616.Ql %r
617(remote user name).
618.Pp
619It is possible to have
620multiple identity files specified in configuration files; all these
621identities will be tried in sequence.
622.It Cm KbdInteractiveAuthentication
623Specifies whether to use keyboard-interactive authentication.
624The argument to this keyword must be
625.Dq yes
626or
627.Dq no .
628The default is
629.Dq yes .
630.It Cm KbdInteractiveDevices
631Specifies the list of methods to use in keyboard-interactive authentication.
632Multiple method names must be comma-separated.
633The default is to use the server specified list.
634The methods available vary depending on what the server supports.
635For an OpenSSH server,
636it may be zero or more of:
637.Dq bsdauth ,
638.Dq pam ,
639and
640.Dq skey .
641.It Cm LocalCommand
642Specifies a command to execute on the local machine after successfully
643connecting to the server.
644The command string extends to the end of the line, and is executed with
645the user's shell.
646The following escape character substitutions will be performed:
647.Ql %d
648(local user's home directory),
649.Ql %h
650(remote host name),
651.Ql %l
652(local host name),
653.Ql %n
654(host name as provided on the command line),
655.Ql %p
656(remote port),
657.Ql %r
658(remote user name) or
659.Ql %u
660(local user name).
661.Pp
662The command is run synchronously and does not have access to the
663session of the
664.Xr ssh 1
665that spawned it.
666It should not be used for interactive commands.
667.Pp
668This directive is ignored unless
669.Cm PermitLocalCommand
670has been enabled.
671.It Cm LocalForward
672Specifies that a TCP port on the local machine be forwarded over
673the secure channel to the specified host and port from the remote machine.
674The first argument must be
675.Sm off
676.Oo Ar bind_address : Oc Ar port
677.Sm on
678and the second argument must be
679.Ar host : Ns Ar hostport .
680IPv6 addresses can be specified by enclosing addresses in square brackets.
681Multiple forwardings may be specified, and additional forwardings can be
682given on the command line.
683Only the superuser can forward privileged ports.
684By default, the local port is bound in accordance with the
685.Cm GatewayPorts
686setting.
687However, an explicit
688.Ar bind_address
689may be used to bind the connection to a specific address.
690The
691.Ar bind_address
692of
693.Dq localhost
694indicates that the listening port be bound for local use only, while an
695empty address or
696.Sq *
697indicates that the port should be available from all interfaces.
698.It Cm LogLevel
699Gives the verbosity level that is used when logging messages from
700.Xr ssh 1 .
701The possible values are:
702QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
703The default is INFO.
704DEBUG and DEBUG1 are equivalent.
705DEBUG2 and DEBUG3 each specify higher levels of verbose output.
706.It Cm MACs
707Specifies the MAC (message authentication code) algorithms
708in order of preference.
709The MAC algorithm is used in protocol version 2
710for data integrity protection.
711Multiple algorithms must be comma-separated.
712The default is:
713.Bd -literal -offset indent
714hmac-md5,hmac-sha1,umac-64@openssh.com,
715hmac-ripemd160,hmac-sha1-96,hmac-md5-96
716.Ed
717.It Cm NoHostAuthenticationForLocalhost
718This option can be used if the home directory is shared across machines.
719In this case localhost will refer to a different machine on each of
720the machines and the user will get many warnings about changed host keys.
721However, this option disables host authentication for localhost.
722The argument to this keyword must be
723.Dq yes
724or
725.Dq no .
726The default is to check the host key for localhost.
727.It Cm NumberOfPasswordPrompts
728Specifies the number of password prompts before giving up.
729The argument to this keyword must be an integer.
730The default is 3.
731.It Cm PasswordAuthentication
732Specifies whether to use password authentication.
733The argument to this keyword must be
734.Dq yes
735or
736.Dq no .
737The default is
738.Dq yes .
739.It Cm PermitLocalCommand
740Allow local command execution via the
741.Ic LocalCommand
742option or using the
743.Ic !\& Ns Ar command
744escape sequence in
745.Xr ssh 1 .
746The argument must be
747.Dq yes
748or
749.Dq no .
750The default is
751.Dq no .
752.It Cm PKCS11Provider
753Specifies which PKCS#11 provider to use.
754The argument to this keyword is the PKCS#11 shared libary
755.Xr ssh 1
756should use to communicate with a PKCS#11 token providing the user's
757private RSA key.
758.It Cm Port
759Specifies the port number to connect on the remote host.
760The default is 22.
761.It Cm PreferredAuthentications
762Specifies the order in which the client should try protocol 2
763authentication methods.
764This allows a client to prefer one method (e.g.\&
765.Cm keyboard-interactive )
766over another method (e.g.\&
767.Cm password ) .
768The default is:
769.Bd -literal -offset indent
770gssapi-with-mic,hostbased,publickey,
771keyboard-interactive,password
772.Ed
773.It Cm Protocol
774Specifies the protocol versions
775.Xr ssh 1
776should support in order of preference.
777The possible values are
778.Sq 1
779and
780.Sq 2 .
781Multiple versions must be comma-separated.
782When this option is set to
783.Dq 2,1
784.Nm ssh
785will try version 2 and fall back to version 1
786if version 2 is not available.
787The default is
788.Sq 2 .
789.It Cm ProxyCommand
790Specifies the command to use to connect to the server.
791The command
792string extends to the end of the line, and is executed with
793the user's shell.
794In the command string, any occurrence of
795.Ql %h
796will be substituted by the host name to
797connect,
798.Ql %p
799by the port, and
800.Ql %r
801by the remote user name.
802The command can be basically anything,
803and should read from its standard input and write to its standard output.
804It should eventually connect an
805.Xr sshd 8
806server running on some machine, or execute
807.Ic sshd -i
808somewhere.
809Host key management will be done using the
810HostName of the host being connected (defaulting to the name typed by
811the user).
812Setting the command to
813.Dq none
814disables this option entirely.
815Note that
816.Cm CheckHostIP
817is not available for connects with a proxy command.
818.Pp
819This directive is useful in conjunction with
820.Xr nc 1
821and its proxy support.
822For example, the following directive would connect via an HTTP proxy at
823192.0.2.0:
824.Bd -literal -offset 3n
825ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p
826.Ed
827.It Cm PubkeyAuthentication
828Specifies whether to try public key authentication.
829The argument to this keyword must be
830.Dq yes
831or
832.Dq no .
833The default is
834.Dq yes .
835This option applies to protocol version 2 only.
836.It Cm RekeyLimit
837Specifies the maximum amount of data that may be transmitted before the
838session key is renegotiated.
839The argument is the number of bytes, with an optional suffix of
840.Sq K ,
841.Sq M ,
842or
843.Sq G
844to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
845The default is between
846.Sq 1G
847and
848.Sq 4G ,
849depending on the cipher.
850This option applies to protocol version 2 only.
851.It Cm RemoteForward
852Specifies that a TCP port on the remote machine be forwarded over
853the secure channel to the specified host and port from the local machine.
854The first argument must be
855.Sm off
856.Oo Ar bind_address : Oc Ar port
857.Sm on
858and the second argument must be
859.Ar host : Ns Ar hostport .
860IPv6 addresses can be specified by enclosing addresses in square brackets.
861Multiple forwardings may be specified, and additional
862forwardings can be given on the command line.
863Privileged ports can be forwarded only when
864logging in as root on the remote machine.
865.Pp
866If the
867.Ar port
868argument is
869.Ql 0 ,
870the listen port will be dynamically allocated on the server and reported
871to the client at run time.
872.Pp
873If the
874.Ar bind_address
875is not specified, the default is to only bind to loopback addresses.
876If the
877.Ar bind_address
878is
879.Ql *
880or an empty string, then the forwarding is requested to listen on all
881interfaces.
882Specifying a remote
883.Ar bind_address
884will only succeed if the server's
885.Cm GatewayPorts
886option is enabled (see
887.Xr sshd_config 5 ) .
888.It Cm RhostsRSAAuthentication
889Specifies whether to try rhosts based authentication with RSA host
890authentication.
891The argument must be
892.Dq yes
893or
894.Dq no .
895The default is
896.Dq no .
897This option applies to protocol version 1 only and requires
898.Xr ssh 1
899to be setuid root.
900.It Cm RSAAuthentication
901Specifies whether to try RSA authentication.
902The argument to this keyword must be
903.Dq yes
904or
905.Dq no .
906RSA authentication will only be
907attempted if the identity file exists, or an authentication agent is
908running.
909The default is
910.Dq yes .
911Note that this option applies to protocol version 1 only.
912.It Cm SendEnv
913Specifies what variables from the local
914.Xr environ 7
915should be sent to the server.
916Note that environment passing is only supported for protocol 2.
917The server must also support it, and the server must be configured to
918accept these environment variables.
919Refer to
920.Cm AcceptEnv
921in
922.Xr sshd_config 5
923for how to configure the server.
924Variables are specified by name, which may contain wildcard characters.
925Multiple environment variables may be separated by whitespace or spread
926across multiple
927.Cm SendEnv
928directives.
929The default is not to send any environment variables.
930.Pp
931See
932.Sx PATTERNS
933for more information on patterns.
934.It Cm ServerAliveCountMax
935Sets the number of server alive messages (see below) which may be
936sent without
937.Xr ssh 1
938receiving any messages back from the server.
939If this threshold is reached while server alive messages are being sent,
940ssh will disconnect from the server, terminating the session.
941It is important to note that the use of server alive messages is very
942different from
943.Cm TCPKeepAlive
944(below).
945The server alive messages are sent through the encrypted channel
946and therefore will not be spoofable.
947The TCP keepalive option enabled by
948.Cm TCPKeepAlive
949is spoofable.
950The server alive mechanism is valuable when the client or
951server depend on knowing when a connection has become inactive.
952.Pp
953The default value is 3.
954If, for example,
955.Cm ServerAliveInterval
956(see below) is set to 15 and
957.Cm ServerAliveCountMax
958is left at the default, if the server becomes unresponsive,
959ssh will disconnect after approximately 45 seconds.
960This option applies to protocol version 2 only.
961.It Cm ServerAliveInterval
962Sets a timeout interval in seconds after which if no data has been received
963from the server,
964.Xr ssh 1
965will send a message through the encrypted
966channel to request a response from the server.
967The default
968is 0, indicating that these messages will not be sent to the server.
969This option applies to protocol version 2 only.
970.It Cm StrictHostKeyChecking
971If this flag is set to
972.Dq yes ,
973.Xr ssh 1
974will never automatically add host keys to the
975.Pa ~/.ssh/known_hosts
976file, and refuses to connect to hosts whose host key has changed.
977This provides maximum protection against trojan horse attacks,
978though it can be annoying when the
979.Pa /etc/ssh/ssh_known_hosts
980file is poorly maintained or when connections to new hosts are
981frequently made.
982This option forces the user to manually
983add all new hosts.
984If this flag is set to
985.Dq no ,
986ssh will automatically add new host keys to the
987user known hosts files.
988If this flag is set to
989.Dq ask ,
990new host keys
991will be added to the user known host files only after the user
992has confirmed that is what they really want to do, and
993ssh will refuse to connect to hosts whose host key has changed.
994The host keys of
995known hosts will be verified automatically in all cases.
996The argument must be
997.Dq yes ,
998.Dq no ,
999or
1000.Dq ask .
1001The default is
1002.Dq ask .
1003.It Cm TCPKeepAlive
1004Specifies whether the system should send TCP keepalive messages to the
1005other side.
1006If they are sent, death of the connection or crash of one
1007of the machines will be properly noticed.
1008However, this means that
1009connections will die if the route is down temporarily, and some people
1010find it annoying.
1011.Pp
1012The default is
1013.Dq yes
1014(to send TCP keepalive messages), and the client will notice
1015if the network goes down or the remote host dies.
1016This is important in scripts, and many users want it too.
1017.Pp
1018To disable TCP keepalive messages, the value should be set to
1019.Dq no .
1020.It Cm Tunnel
1021Request
1022.Xr tun 4
1023device forwarding between the client and the server.
1024The argument must be
1025.Dq yes ,
1026.Dq point-to-point
1027(layer 3),
1028.Dq ethernet
1029(layer 2),
1030or
1031.Dq no .
1032Specifying
1033.Dq yes
1034requests the default tunnel mode, which is
1035.Dq point-to-point .
1036The default is
1037.Dq no .
1038.It Cm TunnelDevice
1039Specifies the
1040.Xr tun 4
1041devices to open on the client
1042.Pq Ar local_tun
1043and the server
1044.Pq Ar remote_tun .
1045.Pp
1046The argument must be
1047.Sm off
1048.Ar local_tun Op : Ar remote_tun .
1049.Sm on
1050The devices may be specified by numerical ID or the keyword
1051.Dq any ,
1052which uses the next available tunnel device.
1053If
1054.Ar remote_tun
1055is not specified, it defaults to
1056.Dq any .
1057The default is
1058.Dq any:any .
1059.It Cm UsePrivilegedPort
1060Specifies whether to use a privileged port for outgoing connections.
1061The argument must be
1062.Dq yes
1063or
1064.Dq no .
1065The default is
1066.Dq no .
1067If set to
1068.Dq yes ,
1069.Xr ssh 1
1070must be setuid root.
1071Note that this option must be set to
1072.Dq yes
1073for
1074.Cm RhostsRSAAuthentication
1075with older servers.
1076.It Cm User
1077Specifies the user to log in as.
1078This can be useful when a different user name is used on different machines.
1079This saves the trouble of
1080having to remember to give the user name on the command line.
1081.It Cm UserKnownHostsFile
1082Specifies a file to use for the user
1083host key database instead of
1084.Pa ~/.ssh/known_hosts .
1085.It Cm VerifyHostKeyDNS
1086Specifies whether to verify the remote key using DNS and SSHFP resource
1087records.
1088If this option is set to
1089.Dq yes ,
1090the client will implicitly trust keys that match a secure fingerprint
1091from DNS.
1092Insecure fingerprints will be handled as if this option was set to
1093.Dq ask .
1094If this option is set to
1095.Dq ask ,
1096information on fingerprint match will be displayed, but the user will still
1097need to confirm new host keys according to the
1098.Cm StrictHostKeyChecking
1099option.
1100The argument must be
1101.Dq yes ,
1102.Dq no ,
1103or
1104.Dq ask .
1105The default is
1106.Dq no .
1107Note that this option applies to protocol version 2 only.
1108.Pp
1109See also
1110.Sx VERIFYING HOST KEYS
1111in
1112.Xr ssh 1 .
1113.It Cm VersionAddendum
1114Specifies a string to append to the regular version string to identify
1115OS- or site-specific modifications.
1116The default is
1117.Dq FreeBSD-20101111 .
1118.It Cm VisualHostKey
1119If this flag is set to
1120.Dq yes ,
1121an ASCII art representation of the remote host key fingerprint is
1122printed in addition to the hex fingerprint string at login and
1123for unknown host keys.
1124If this flag is set to
1125.Dq no ,
1126no fingerprint strings are printed at login and
1127only the hex fingerprint string will be printed for unknown host keys.
1128The default is
1129.Dq no .
1130.It Cm XAuthLocation
1131Specifies the full pathname of the
1132.Xr xauth 1
1133program.
1134The default is
1135.Pa /usr/local/bin/xauth .
1136.El
1137.Sh PATTERNS
1138A
1139.Em pattern
1140consists of zero or more non-whitespace characters,
1141.Sq *
1142(a wildcard that matches zero or more characters),
1143or
1144.Sq ?\&
1145(a wildcard that matches exactly one character).
1146For example, to specify a set of declarations for any host in the
1147.Dq .co.uk
1148set of domains,
1149the following pattern could be used:
1150.Pp
1151.Dl Host *.co.uk
1152.Pp
1153The following pattern
1154would match any host in the 192.168.0.[0-9] network range:
1155.Pp
1156.Dl Host 192.168.0.?
1157.Pp
1158A
1159.Em pattern-list
1160is a comma-separated list of patterns.
1161Patterns within pattern-lists may be negated
1162by preceding them with an exclamation mark
1163.Pq Sq !\& .
1164For example,
1165to allow a key to be used from anywhere within an organisation
1166except from the
1167.Dq dialup
1168pool,
1169the following entry (in authorized_keys) could be used:
1170.Pp
1171.Dl from=\&"!*.dialup.example.com,*.example.com\&"
1172.Sh FILES
1173.Bl -tag -width Ds
1174.It Pa ~/.ssh/config
1175This is the per-user configuration file.
1176The format of this file is described above.
1177This file is used by the SSH client.
1178Because of the potential for abuse, this file must have strict permissions:
1179read/write for the user, and not accessible by others.
1180.It Pa /etc/ssh/ssh_config
1181Systemwide configuration file.
1182This file provides defaults for those
1183values that are not specified in the user's configuration file, and
1184for those users who do not have a configuration file.
1185This file must be world-readable.
1186.El
1187.Sh SEE ALSO
1188.Xr ssh 1
1189.Sh AUTHORS
1190OpenSSH is a derivative of the original and free
1191ssh 1.2.12 release by Tatu Ylonen.
1192Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1193Theo de Raadt and Dug Song
1194removed many bugs, re-added newer features and
1195created OpenSSH.
1196Markus Friedl contributed the support for SSH
1197protocol versions 1.5 and 2.0.
1198