xref: /openbsd/usr.bin/ssh/ssh_config.5 (revision db3296cf)
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.16 2003/07/22 13:35:22 markus Exp $
38.Dd September 25, 1999
39.Dt SSH_CONFIG 5
40.Os
41.Sh NAME
42.Nm ssh_config
43.Nd OpenSSH SSH client configuration files
44.Sh SYNOPSIS
45.Bl -tag -width Ds -compact
46.It Pa $HOME/.ssh/config
47.It Pa /etc/ssh/ssh_config
48.El
49.Sh DESCRIPTION
50.Nm ssh
51obtains configuration data from the following sources in
52the following order:
53.Bl -enum -offset indent -compact
54.It
55command-line options
56.It
57user's configuration file
58.Pq Pa $HOME/.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 bracketed 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.
81.Pp
82Otherwise a line is of the format
83.Dq keyword arguments .
84Configuration options may be separated by whitespace or
85optional whitespace and exactly one
86.Ql = ;
87the latter format is useful to avoid the need to quote whitespace
88when specifying configuration options using the
89.Nm ssh ,
90.Nm scp
91and
92.Nm sftp
93.Fl o
94option.
95.Pp
96The possible
97keywords and their meanings are as follows (note that
98keywords are case-insensitive and arguments are case-sensitive):
99.Bl -tag -width Ds
100.It Cm Host
101Restricts the following declarations (up to the next
102.Cm Host
103keyword) to be only for those hosts that match one of the patterns
104given after the keyword.
105.Ql \&*
106and
107.Ql ?
108can be used as wildcards in the
109patterns.
110A single
111.Ql \&*
112as a pattern can be used to provide global
113defaults for all hosts.
114The host is the
115.Ar hostname
116argument given on the command line (i.e., the name is not converted to
117a canonicalized host name before matching).
118.It Cm AddressFamily
119Specifies which address family to use when connecting.
120Valid arguments are
121.Dq any ,
122.Dq inet
123(Use IPv4 only) or
124.Dq inet6
125(Use IPv6 only.)
126.It Cm BatchMode
127If set to
128.Dq yes ,
129passphrase/password querying will be disabled.
130This option is useful in scripts and other batch jobs where no user
131is present to supply the password.
132The argument must be
133.Dq yes
134or
135.Dq no .
136The default is
137.Dq no .
138.It Cm BindAddress
139Specify the interface to transmit from on machines with multiple
140interfaces or aliased addresses.
141Note that this option does not work if
142.Cm UsePrivilegedPort
143is set to
144.Dq yes .
145.It Cm ChallengeResponseAuthentication
146Specifies whether to use challenge response authentication.
147The argument to this keyword must be
148.Dq yes
149or
150.Dq no .
151The default is
152.Dq yes .
153.It Cm CheckHostIP
154If this flag is set to
155.Dq yes ,
156ssh will additionally check the host IP address in the
157.Pa known_hosts
158file.
159This allows ssh to detect if a host key changed due to DNS spoofing.
160If the option is set to
161.Dq no ,
162the check will not be executed.
163The default is
164.Dq yes .
165.It Cm Cipher
166Specifies the cipher to use for encrypting the session
167in protocol version 1.
168Currently,
169.Dq blowfish ,
170.Dq 3des ,
171and
172.Dq des
173are supported.
174.Ar des
175is only supported in the
176.Nm ssh
177client for interoperability with legacy protocol 1 implementations
178that do not support the
179.Ar 3des
180cipher.
181Its use is strongly discouraged due to cryptographic weaknesses.
182The default is
183.Dq 3des .
184.It Cm Ciphers
185Specifies the ciphers allowed for protocol version 2
186in order of preference.
187Multiple ciphers must be comma-separated.
188The default is
189.Pp
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 .
263See
264.Xr ssh-keysign 8
265for more information.
266.It Cm EscapeChar
267Sets the escape character (default:
268.Ql ~ ) .
269The escape character can also
270be set on the command line.
271The argument should be a single character,
272.Ql ^
273followed by a letter, or
274.Dq none
275to disable the escape
276character entirely (making the connection transparent for binary
277data).
278.It Cm ForwardAgent
279Specifies whether the connection to the authentication agent (if any)
280will be forwarded to the remote machine.
281The argument must be
282.Dq yes
283or
284.Dq no .
285The default is
286.Dq no .
287.Pp
288Agent forwarding should be enabled with caution.
289Users with the ability to bypass file permissions on the remote host
290(for the agent's Unix-domain socket)
291can access the local agent through the forwarded connection.
292An attacker cannot obtain key material from the agent,
293however they can perform operations on the keys that enable them to
294authenticate using the identities loaded into the agent.
295.It Cm ForwardX11
296Specifies whether X11 connections will be automatically redirected
297over the secure channel and
298.Ev DISPLAY
299set.
300The argument must be
301.Dq yes
302or
303.Dq no .
304The default is
305.Dq no .
306.Pp
307X11 forwarding should be enabled with caution.
308Users with the ability to bypass file permissions on the remote host
309(for the user's X authorization database)
310can access the local X11 display through the forwarded connection.
311An attacker may then be able to perform activities such as keystroke monitoring.
312.It Cm GatewayPorts
313Specifies whether remote hosts are allowed to connect to local
314forwarded ports.
315By default,
316.Nm ssh
317binds local port forwardings to the loopback address.
318This prevents other remote hosts from connecting to forwarded ports.
319.Cm GatewayPorts
320can be used to specify that
321.Nm ssh
322should bind local port forwardings to the wildcard address,
323thus allowing remote hosts to connect to forwarded ports.
324The argument must be
325.Dq yes
326or
327.Dq no .
328The default is
329.Dq no .
330.It Cm GlobalKnownHostsFile
331Specifies a file to use for the global
332host key database instead of
333.Pa /etc/ssh/ssh_known_hosts .
334.It Cm HostbasedAuthentication
335Specifies whether to try rhosts based authentication with public key
336authentication.
337The argument must be
338.Dq yes
339or
340.Dq no .
341The default is
342.Dq no .
343This option applies to protocol version 2 only and
344is similar to
345.Cm RhostsRSAAuthentication .
346.It Cm HostKeyAlgorithms
347Specifies the protocol version 2 host key algorithms
348that the client wants to use in order of preference.
349The default for this option is:
350.Dq ssh-rsa,ssh-dss .
351.It Cm HostKeyAlias
352Specifies an alias that should be used instead of the
353real host name when looking up or saving the host key
354in the host key database files.
355This option is useful for tunneling ssh connections
356or for multiple servers running on a single host.
357.It Cm HostName
358Specifies the real host name to log into.
359This can be used to specify nicknames or abbreviations for hosts.
360Default is the name given on the command line.
361Numeric IP addresses are also permitted (both on the command line and in
362.Cm HostName
363specifications).
364.It Cm IdentityFile
365Specifies a file from which the user's RSA or DSA authentication identity
366is read.
367The default is
368.Pa $HOME/.ssh/identity
369for protocol version 1, and
370.Pa $HOME/.ssh/id_rsa
371and
372.Pa $HOME/.ssh/id_dsa
373for protocol version 2.
374Additionally, any identities represented by the authentication agent
375will be used for authentication.
376The file name may use the tilde
377syntax to refer to a user's home directory.
378It is possible to have
379multiple identity files specified in configuration files; all these
380identities will be tried in sequence.
381.It Cm KeepAlive
382Specifies whether the system should send TCP keepalive messages to the
383other side.
384If they are sent, death of the connection or crash of one
385of the machines will be properly noticed.
386However, this means that
387connections will die if the route is down temporarily, and some people
388find it annoying.
389.Pp
390The default is
391.Dq yes
392(to send keepalives), and the client will notice
393if the network goes down or the remote host dies.
394This is important in scripts, and many users want it too.
395.Pp
396To disable keepalives, the value should be set to
397.Dq no .
398.It Cm KerberosAuthentication
399Specifies whether Kerberos authentication will be used.
400The argument to this keyword must be
401.Dq yes
402or
403.Dq no .
404.It Cm KerberosTgtPassing
405Specifies whether a Kerberos TGT will be forwarded to the server.
406The argument to this keyword must be
407.Dq yes
408or
409.Dq no .
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 RhostsAuthentication
533Specifies whether to try rhosts based authentication.
534Note that this
535declaration only affects the client side and has no effect whatsoever
536on security.
537Most servers do not permit RhostsAuthentication because it
538is not secure (see
539.Cm RhostsRSAAuthentication ) .
540The argument to this keyword must be
541.Dq yes
542or
543.Dq no .
544The default is
545.Dq no .
546This option applies to protocol version 1 only and requires
547.Nm ssh
548to be setuid root and
549.Cm UsePrivilegedPort
550to be set to
551.Dq yes .
552.It Cm RhostsRSAAuthentication
553Specifies whether to try rhosts based authentication with RSA host
554authentication.
555The argument must be
556.Dq yes
557or
558.Dq no .
559The default is
560.Dq no .
561This option applies to protocol version 1 only and requires
562.Nm ssh
563to be setuid root.
564.It Cm RSAAuthentication
565Specifies whether to try RSA authentication.
566The argument to this keyword must be
567.Dq yes
568or
569.Dq no .
570RSA authentication will only be
571attempted if the identity file exists, or an authentication agent is
572running.
573The default is
574.Dq yes .
575Note that this option applies to protocol version 1 only.
576.It Cm SmartcardDevice
577Specifies which smartcard device to use.
578The argument to this keyword is the device
579.Nm ssh
580should use to communicate with a smartcard used for storing the user's
581private RSA key.
582By default, no device is specified and smartcard support is not activated.
583.It Cm StrictHostKeyChecking
584If this flag is set to
585.Dq yes ,
586.Nm ssh
587will never automatically add host keys to the
588.Pa $HOME/.ssh/known_hosts
589file, and refuses to connect to hosts whose host key has changed.
590This provides maximum protection against trojan horse attacks,
591however, can be annoying when the
592.Pa /etc/ssh/ssh_known_hosts
593file is poorly maintained, or connections to new hosts are
594frequently made.
595This option forces the user to manually
596add all new hosts.
597If this flag is set to
598.Dq no ,
599.Nm ssh
600will automatically add new host keys to the
601user known hosts files.
602If this flag is set to
603.Dq ask ,
604new host keys
605will be added to the user known host files only after the user
606has confirmed that is what they really want to do, and
607.Nm ssh
608will refuse to connect to hosts whose host key has changed.
609The host keys of
610known hosts will be verified automatically in all cases.
611The argument must be
612.Dq yes ,
613.Dq no
614or
615.Dq ask .
616The default is
617.Dq ask .
618.It Cm UsePrivilegedPort
619Specifies whether to use a privileged port for outgoing connections.
620The argument must be
621.Dq yes
622or
623.Dq no .
624The default is
625.Dq no .
626If set to
627.Dq yes
628.Nm ssh
629must be setuid root.
630Note that this option must be set to
631.Dq yes
632if
633.Cm RhostsAuthentication
634and
635.Cm RhostsRSAAuthentication
636authentications are needed with older servers.
637.It Cm User
638Specifies the user to log in as.
639This can be useful when a different user name is used on different machines.
640This saves the trouble of
641having to remember to give the user name on the command line.
642.It Cm UserKnownHostsFile
643Specifies a file to use for the user
644host key database instead of
645.Pa $HOME/.ssh/known_hosts .
646.It Cm VerifyHostKeyDNS
647Specifies whether to verify the remote key using DNS and SSHFP resource
648records.
649The default is
650.Dq no .
651Note that this option applies to protocol version 2 only.
652.It Cm XAuthLocation
653Specifies the full pathname of the
654.Xr xauth 1
655program.
656The default is
657.Pa /usr/X11R6/bin/xauth .
658.El
659.Sh FILES
660.Bl -tag -width Ds
661.It Pa $HOME/.ssh/config
662This is the per-user configuration file.
663The format of this file is described above.
664This file is used by the
665.Nm ssh
666client.
667This file does not usually contain any sensitive information,
668but the recommended permissions are read/write for the user, and not
669accessible by others.
670.It Pa /etc/ssh/ssh_config
671Systemwide configuration file.
672This file provides defaults for those
673values that are not specified in the user's configuration file, and
674for those users who do not have a configuration file.
675This file must be world-readable.
676.El
677.Sh SEE ALSO
678.Xr ssh 1
679.Sh AUTHORS
680OpenSSH is a derivative of the original and free
681ssh 1.2.12 release by Tatu Ylonen.
682Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
683Theo de Raadt and Dug Song
684removed many bugs, re-added newer features and
685created OpenSSH.
686Markus Friedl contributed the support for SSH
687protocol versions 1.5 and 2.0.
688