xref: /freebsd/crypto/openssh/ssh_config.5 (revision 0f8f86b71f022b803e99151c19db81b280f245dc)
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.28 2003/12/16 15:49:51 markus Exp $
38.\" $FreeBSD$
39.Dd September 25, 1999
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.Bl -tag -width Ds -compact
47.It Pa $HOME/.ssh/config
48.It Pa /etc/ssh/ssh_config
49.El
50.Sh DESCRIPTION
51.Nm ssh
52obtains configuration data from the following sources in
53the following order:
54.Bl -enum -offset indent -compact
55.It
56command-line options
57.It
58user's configuration file
59.Pq Pa $HOME/.ssh/config
60.It
61system-wide configuration file
62.Pq Pa /etc/ssh/ssh_config
63.El
64.Pp
65For each parameter, the first obtained value
66will be used.
67The configuration files contain sections bracketed by
68.Dq Host
69specifications, and that section is only applied for hosts that
70match one of the patterns given in the specification.
71The matched host name is the one given on the command line.
72.Pp
73Since the first obtained value for each parameter is used, more
74host-specific declarations should be given near the beginning of the
75file, and general defaults at the end.
76.Pp
77The configuration file has the following format:
78.Pp
79Empty lines and lines starting with
80.Ql #
81are comments.
82.Pp
83Otherwise a line is of the format
84.Dq keyword arguments .
85Configuration options may be separated by whitespace or
86optional whitespace and exactly one
87.Ql = ;
88the latter format is useful to avoid the need to quote whitespace
89when specifying configuration options using the
90.Nm ssh ,
91.Nm scp
92and
93.Nm sftp
94.Fl o
95option.
96.Pp
97The possible
98keywords and their meanings are as follows (note that
99keywords are case-insensitive and arguments are case-sensitive):
100.Bl -tag -width Ds
101.It Cm Host
102Restricts the following declarations (up to the next
103.Cm Host
104keyword) to be only for those hosts that match one of the patterns
105given after the keyword.
106.Ql \&*
107and
108.Ql \&?
109can be used as wildcards in the
110patterns.
111A single
112.Ql \&*
113as a pattern can be used to provide global
114defaults for all hosts.
115The host is the
116.Ar hostname
117argument given on the command line (i.e., the name is not converted to
118a canonicalized host name before matching).
119.It Cm AddressFamily
120Specifies which address family to use when connecting.
121Valid arguments are
122.Dq any ,
123.Dq inet
124(Use IPv4 only) or
125.Dq inet6
126(Use IPv6 only.)
127.It Cm BatchMode
128If set to
129.Dq yes ,
130passphrase/password querying will be disabled.
131This option is useful in scripts and other batch jobs where no user
132is present to supply the password.
133The argument must be
134.Dq yes
135or
136.Dq no .
137The default is
138.Dq no .
139.It Cm BindAddress
140Specify the interface to transmit from on machines with multiple
141interfaces or aliased addresses.
142Note that this option does not work if
143.Cm UsePrivilegedPort
144is set to
145.Dq yes .
146.It Cm ChallengeResponseAuthentication
147Specifies whether to use challenge response authentication.
148The argument to this keyword must be
149.Dq yes
150or
151.Dq no .
152The default is
153.Dq yes .
154.It Cm CheckHostIP
155If this flag is set to
156.Dq yes ,
157ssh will additionally check the host IP address in the
158.Pa known_hosts
159file.
160This allows ssh to detect if a host key changed due to DNS spoofing.
161If the option is set to
162.Dq no ,
163the check will not be executed.
164The default is
165.Dq no .
166.It Cm Cipher
167Specifies the cipher to use for encrypting the session
168in protocol version 1.
169Currently,
170.Dq blowfish ,
171.Dq 3des ,
172and
173.Dq des
174are supported.
175.Ar des
176is only supported in the
177.Nm ssh
178client for interoperability with legacy protocol 1 implementations
179that do not support the
180.Ar 3des
181cipher.
182Its use is strongly discouraged due to cryptographic weaknesses.
183The default is
184.Dq 3des .
185.It Cm Ciphers
186Specifies the ciphers allowed for protocol version 2
187in order of preference.
188Multiple ciphers must be comma-separated.
189The default is
190.Bd -literal
191  ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
192    aes192-cbc,aes256-cbc''
193.Ed
194.It Cm ClearAllForwardings
195Specifies that all local, remote and dynamic port forwardings
196specified in the configuration files or on the command line be
197cleared.
198This option is primarily useful when used from the
199.Nm ssh
200command line to clear port forwardings set in
201configuration files, and is automatically set by
202.Xr scp 1
203and
204.Xr sftp 1 .
205The argument must be
206.Dq yes
207or
208.Dq no .
209The default is
210.Dq no .
211.It Cm Compression
212Specifies whether to use compression.
213The argument must be
214.Dq yes
215or
216.Dq no .
217The default is
218.Dq no .
219.It Cm CompressionLevel
220Specifies the compression level to use if compression is enabled.
221The argument must be an integer from 1 (fast) to 9 (slow, best).
222The default level is 6, which is good for most applications.
223The meaning of the values is the same as in
224.Xr gzip 1 .
225Note that this option applies to protocol version 1 only.
226.It Cm ConnectionAttempts
227Specifies the number of tries (one per second) to make before exiting.
228The argument must be an integer.
229This may be useful in scripts if the connection sometimes fails.
230The default is 1.
231.It Cm ConnectTimeout
232Specifies the timeout (in seconds) used when connecting to the ssh
233server, instead of using the default system TCP timeout.
234This value is used only when the target is down or really unreachable,
235not when it refuses the connection.
236.It Cm DynamicForward
237Specifies that a TCP/IP port on the local machine be forwarded
238over the secure channel, and the application
239protocol is then used to determine where to connect to from the
240remote machine.
241The argument must be a port number.
242Currently the SOCKS4 and SOCKS5 protocols are supported, and
243.Nm ssh
244will act as a SOCKS server.
245Multiple forwardings may be specified, and
246additional forwardings can be given on the command line.
247Only the superuser can forward privileged ports.
248.It Cm EnableSSHKeysign
249Setting this option to
250.Dq yes
251in the global client configuration file
252.Pa /etc/ssh/ssh_config
253enables the use of the helper program
254.Xr ssh-keysign 8
255during
256.Cm HostbasedAuthentication .
257The argument must be
258.Dq yes
259or
260.Dq no .
261The default is
262.Dq no .
263This option should be placed in the non-hostspecific section.
264See
265.Xr ssh-keysign 8
266for more information.
267.It Cm EscapeChar
268Sets the escape character (default:
269.Ql ~ ) .
270The escape character can also
271be set on the command line.
272The argument should be a single character,
273.Ql ^
274followed by a letter, or
275.Dq none
276to disable the escape
277character entirely (making the connection transparent for binary
278data).
279.It Cm ForwardAgent
280Specifies whether the connection to the authentication agent (if any)
281will be forwarded to the remote machine.
282The argument must be
283.Dq yes
284or
285.Dq no .
286The default is
287.Dq no .
288.Pp
289Agent forwarding should be enabled with caution.
290Users with the ability to bypass file permissions on the remote host
291(for the agent's Unix-domain socket)
292can access the local agent through the forwarded connection.
293An attacker cannot obtain key material from the agent,
294however they can perform operations on the keys that enable them to
295authenticate using the identities loaded into the agent.
296.It Cm ForwardX11
297Specifies whether X11 connections will be automatically redirected
298over the secure channel and
299.Ev DISPLAY
300set.
301The argument must be
302.Dq yes
303or
304.Dq no .
305The default is
306.Dq no .
307.Pp
308X11 forwarding should be enabled with caution.
309Users with the ability to bypass file permissions on the remote host
310(for the user's X11 authorization database)
311can access the local X11 display through the forwarded connection.
312An attacker may then be able to perform activities such as keystroke monitoring
313if the
314.Cm ForwardX11Trusted
315option is also enabled.
316.It Cm ForwardX11Trusted
317If the this option is set to
318.Dq yes
319then remote X11 clients will have full access to the original X11 display.
320If this option is set to
321.Dq no
322then remote X11 clients will be considered untrusted and prevented
323from stealing or tampering with data belonging to trusted X11
324clients.
325.Pp
326The default is
327.Dq no .
328.Pp
329See the X11 SECURITY extension specification for full details on
330the restrictions imposed on untrusted clients.
331.It Cm GatewayPorts
332Specifies whether remote hosts are allowed to connect to local
333forwarded ports.
334By default,
335.Nm ssh
336binds local port forwardings to the loopback address.
337This prevents other remote hosts from connecting to forwarded ports.
338.Cm GatewayPorts
339can be used to specify that
340.Nm ssh
341should bind local port forwardings to the wildcard address,
342thus allowing remote hosts to connect to forwarded ports.
343The argument must be
344.Dq yes
345or
346.Dq no .
347The default is
348.Dq no .
349.It Cm GlobalKnownHostsFile
350Specifies a file to use for the global
351host key database instead of
352.Pa /etc/ssh/ssh_known_hosts .
353.It Cm GSSAPIAuthentication
354Specifies whether user authentication based on GSSAPI is allowed.
355The default is
356.Dq no .
357Note that this option applies to protocol version 2 only.
358.It Cm GSSAPIDelegateCredentials
359Forward (delegate) credentials to the server.
360The default is
361.Dq no .
362Note that this option applies to protocol version 2 only.
363.It Cm HostbasedAuthentication
364Specifies whether to try rhosts based authentication with public key
365authentication.
366The argument must be
367.Dq yes
368or
369.Dq no .
370The default is
371.Dq no .
372This option applies to protocol version 2 only and
373is similar to
374.Cm RhostsRSAAuthentication .
375.It Cm HostKeyAlgorithms
376Specifies the protocol version 2 host key algorithms
377that the client wants to use in order of preference.
378The default for this option is:
379.Dq ssh-rsa,ssh-dss .
380.It Cm HostKeyAlias
381Specifies an alias that should be used instead of the
382real host name when looking up or saving the host key
383in the host key database files.
384This option is useful for tunneling ssh connections
385or for multiple servers running on a single host.
386.It Cm HostName
387Specifies the real host name to log into.
388This can be used to specify nicknames or abbreviations for hosts.
389Default is the name given on the command line.
390Numeric IP addresses are also permitted (both on the command line and in
391.Cm HostName
392specifications).
393.It Cm IdentityFile
394Specifies a file from which the user's RSA or DSA authentication identity
395is read.
396The default is
397.Pa $HOME/.ssh/identity
398for protocol version 1, and
399.Pa $HOME/.ssh/id_rsa
400and
401.Pa $HOME/.ssh/id_dsa
402for protocol version 2.
403Additionally, any identities represented by the authentication agent
404will be used for authentication.
405The file name may use the tilde
406syntax to refer to a user's home directory.
407It is possible to have
408multiple identity files specified in configuration files; all these
409identities will be tried in sequence.
410.It Cm LocalForward
411Specifies that a TCP/IP port on the local machine be forwarded over
412the secure channel to the specified host and port from the remote machine.
413The first argument must be a port number, and the second must be
414.Ar host:port .
415IPv6 addresses can be specified with an alternative syntax:
416.Ar host/port .
417Multiple forwardings may be specified, and additional
418forwardings can be given on the command line.
419Only the superuser can forward privileged ports.
420.It Cm LogLevel
421Gives the verbosity level that is used when logging messages from
422.Nm ssh .
423The possible values are:
424QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3.
425The default is INFO.
426DEBUG and DEBUG1 are equivalent.
427DEBUG2 and DEBUG3 each specify higher levels of verbose output.
428.It Cm MACs
429Specifies the MAC (message authentication code) algorithms
430in order of preference.
431The MAC algorithm is used in protocol version 2
432for data integrity protection.
433Multiple algorithms must be comma-separated.
434The default is
435.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
436.It Cm NoHostAuthenticationForLocalhost
437This option can be used if the home directory is shared across machines.
438In this case localhost will refer to a different machine on each of
439the machines and the user will get many warnings about changed host keys.
440However, this option disables host authentication for localhost.
441The argument to this keyword must be
442.Dq yes
443or
444.Dq no .
445The default is to check the host key for localhost.
446.It Cm NumberOfPasswordPrompts
447Specifies the number of password prompts before giving up.
448The argument to this keyword must be an integer.
449Default is 3.
450.It Cm PasswordAuthentication
451Specifies whether to use password authentication.
452The argument to this keyword must be
453.Dq yes
454or
455.Dq no .
456The default is
457.Dq yes .
458.It Cm Port
459Specifies the port number to connect on the remote host.
460Default is 22.
461.It Cm PreferredAuthentications
462Specifies the order in which the client should try protocol 2
463authentication methods.
464This allows a client to prefer one method (e.g.
465.Cm keyboard-interactive )
466over another method (e.g.
467.Cm password )
468The default for this option is:
469.Dq hostbased,publickey,keyboard-interactive,password .
470.It Cm Protocol
471Specifies the protocol versions
472.Nm ssh
473should support in order of preference.
474The possible values are
475.Dq 1
476and
477.Dq 2 .
478Multiple versions must be comma-separated.
479The default is
480.Dq 2,1 .
481This means that
482.Nm ssh
483tries version 2 and falls back to version 1
484if version 2 is not available.
485.It Cm ProxyCommand
486Specifies the command to use to connect to the server.
487The command
488string extends to the end of the line, and is executed with
489.Pa /bin/sh .
490In the command string,
491.Ql %h
492will be substituted by the host name to
493connect and
494.Ql %p
495by the port.
496The command can be basically anything,
497and should read from its standard input and write to its standard output.
498It should eventually connect an
499.Xr sshd 8
500server running on some machine, or execute
501.Ic sshd -i
502somewhere.
503Host key management will be done using the
504HostName of the host being connected (defaulting to the name typed by
505the user).
506Setting the command to
507.Dq none
508disables this option entirely.
509Note that
510.Cm CheckHostIP
511is not available for connects with a proxy command.
512.Pp
513.It Cm PubkeyAuthentication
514Specifies whether to try public key authentication.
515The argument to this keyword must be
516.Dq yes
517or
518.Dq no .
519The default is
520.Dq yes .
521This option applies to protocol version 2 only.
522.It Cm RemoteForward
523Specifies that a TCP/IP port on the remote machine be forwarded over
524the secure channel to the specified host and port from the local machine.
525The first argument must be a port number, and the second must be
526.Ar host:port .
527IPv6 addresses can be specified with an alternative syntax:
528.Ar host/port .
529Multiple forwardings may be specified, and additional
530forwardings can be given on the command line.
531Only the superuser can forward privileged ports.
532.It Cm RhostsRSAAuthentication
533Specifies whether to try rhosts based authentication with RSA host
534authentication.
535The argument must be
536.Dq yes
537or
538.Dq no .
539The default is
540.Dq no .
541This option applies to protocol version 1 only and requires
542.Nm ssh
543to be setuid root.
544.It Cm RSAAuthentication
545Specifies whether to try RSA authentication.
546The argument to this keyword must be
547.Dq yes
548or
549.Dq no .
550RSA authentication will only be
551attempted if the identity file exists, or an authentication agent is
552running.
553The default is
554.Dq yes .
555Note that this option applies to protocol version 1 only.
556.It Cm ServerAliveInterval
557Sets a timeout interval in seconds after which if no data has been received
558from the server,
559.Nm ssh
560will send a message through the encrypted
561channel to request a response from the server.
562The default
563is 0, indicating that these messages will not be sent to the server.
564This option applies to protocol version 2 only.
565.It Cm ServerAliveCountMax
566Sets the number of server alive messages (see above) which may be
567sent without
568.Nm ssh
569receiving any messages back from the server.
570If this threshold is reached while server alive messages are being sent,
571.Nm ssh
572will disconnect from the server, terminating the session.
573It is important to note that the use of server alive messages is very
574different from
575.Cm TCPKeepAlive
576(below).
577The server alive messages are sent through the encrypted channel
578and therefore will not be spoofable.
579The TCP keepalive option enabled by
580.Cm TCPKeepAlive
581is spoofable.
582The server alive mechanism is valuable when the client or
583server depend on knowing when a connection has become inactive.
584.Pp
585The default value is 3.
586If, for example,
587.Cm ServerAliveInterval
588(above) is set to 15, and
589.Cm ServerAliveCountMax
590is left at the default, if the server becomes unresponsive ssh
591will disconnect after approximately 45 seconds.
592.It Cm SmartcardDevice
593Specifies which smartcard device to use.
594The argument to this keyword is the device
595.Nm ssh
596should use to communicate with a smartcard used for storing the user's
597private RSA key.
598By default, no device is specified and smartcard support is not activated.
599.It Cm StrictHostKeyChecking
600If this flag is set to
601.Dq yes ,
602.Nm ssh
603will never automatically add host keys to the
604.Pa $HOME/.ssh/known_hosts
605file, and refuses to connect to hosts whose host key has changed.
606This provides maximum protection against trojan horse attacks,
607however, can be annoying when the
608.Pa /etc/ssh/ssh_known_hosts
609file is poorly maintained, or connections to new hosts are
610frequently made.
611This option forces the user to manually
612add all new hosts.
613If this flag is set to
614.Dq no ,
615.Nm ssh
616will automatically add new host keys to the
617user known hosts files.
618If this flag is set to
619.Dq ask ,
620new host keys
621will be added to the user known host files only after the user
622has confirmed that is what they really want to do, and
623.Nm ssh
624will refuse to connect to hosts whose host key has changed.
625The host keys of
626known hosts will be verified automatically in all cases.
627The argument must be
628.Dq yes ,
629.Dq no
630or
631.Dq ask .
632The default is
633.Dq ask .
634.It Cm TCPKeepAlive
635Specifies whether the system should send TCP keepalive messages to the
636other side.
637If they are sent, death of the connection or crash of one
638of the machines will be properly noticed.
639However, this means that
640connections will die if the route is down temporarily, and some people
641find it annoying.
642.Pp
643The default is
644.Dq yes
645(to send TCP keepalive messages), and the client will notice
646if the network goes down or the remote host dies.
647This is important in scripts, and many users want it too.
648.Pp
649To disable TCP keepalive messages, the value should be set to
650.Dq no .
651.It Cm UsePrivilegedPort
652Specifies whether to use a privileged port for outgoing connections.
653The argument must be
654.Dq yes
655or
656.Dq no .
657The default is
658.Dq no .
659If set to
660.Dq yes
661.Nm ssh
662must be setuid root.
663Note that this option must be set to
664.Dq yes
665for
666.Cm RhostsRSAAuthentication
667with older servers.
668.It Cm User
669Specifies the user to log in as.
670This can be useful when a different user name is used on different machines.
671This saves the trouble of
672having to remember to give the user name on the command line.
673.It Cm UserKnownHostsFile
674Specifies a file to use for the user
675host key database instead of
676.Pa $HOME/.ssh/known_hosts .
677.It Cm VerifyHostKeyDNS
678Specifies whether to verify the remote key using DNS and SSHFP resource
679records.
680If this option is set to
681.Dq yes ,
682the client will implicitly trust keys that match a secure fingerprint
683from DNS.
684Insecure fingerprints will be handled as if this option was set to
685.Dq ask .
686If this option is set to
687.Dq ask ,
688information on fingerprint match will be displayed, but the user will still
689need to confirm new host keys according to the
690.Cm StrictHostKeyChecking
691option.
692The argument must be
693.Dq yes ,
694.Dq no
695or
696.Dq ask .
697The default is
698.Dq no .
699Note that this option applies to protocol version 2 only.
700.It Cm VersionAddendum
701Specifies a string to append to the regular version string to identify
702OS- or site-specific modifications.
703The default is
704.Dq FreeBSD-20040226 .
705.It Cm XAuthLocation
706Specifies the full pathname of the
707.Xr xauth 1
708program.
709The default is
710.Pa /usr/X11R6/bin/xauth .
711.El
712.Sh FILES
713.Bl -tag -width Ds
714.It Pa $HOME/.ssh/config
715This is the per-user configuration file.
716The format of this file is described above.
717This file is used by the
718.Nm ssh
719client.
720This file does not usually contain any sensitive information,
721but the recommended permissions are read/write for the user, and not
722accessible by others.
723.It Pa /etc/ssh/ssh_config
724Systemwide configuration file.
725This file provides defaults for those
726values that are not specified in the user's configuration file, and
727for those users who do not have a configuration file.
728This file must be world-readable.
729.El
730.Sh SEE ALSO
731.Xr ssh 1
732.Sh AUTHORS
733OpenSSH is a derivative of the original and free
734ssh 1.2.12 release by Tatu Ylonen.
735Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
736Theo de Raadt and Dug Song
737removed many bugs, re-added newer features and
738created OpenSSH.
739Markus Friedl contributed the support for SSH
740protocol versions 1.5 and 2.0.
741