3 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 .\" All rights reserved
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".
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.
17 .\" Redistribution and use in source and binary forms, with or without
18 .\" modification, are permitted provided that the following conditions
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.
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.
37 .\" $OpenBSD: ssh_config.5,v 1.97 2006/07/27 08:00:50 jmc Exp $
38 .Dd September 25, 1999
43 .Nd OpenSSH SSH client configuration files
45 .Bl -tag -width Ds -compact
47 .It Pa /etc/ssh/ssh_config
51 obtains configuration data from the following sources in
54 .Bl -enum -offset indent -compact
58 user's configuration file
61 GSSAPI configuration file
62 .Pq Pa $HOME/.ssh/config.gssapi
64 Kerberos configuration file
65 .Pq Pa $HOME/.ssh/config.krb
67 system-wide configuration file
68 .Pq Pa /etc/ssh/ssh_config
71 For each parameter, the first obtained value
73 The configuration files contain sections separated by
75 specifications, and that section is only applied for hosts that
76 match one of the patterns given in the specification.
77 The matched host name is the one given on the command line.
79 Since the first obtained value for each parameter is used, more
80 host-specific declarations should be given near the beginning of the
81 file, and general defaults at the end.
83 The configuration file has the following format:
85 Empty lines and lines starting with
88 Otherwise a line is of the format
89 .Dq keyword arguments .
90 Configuration options may be separated by whitespace or
91 optional whitespace and exactly one
93 the latter format is useful to avoid the need to quote whitespace
94 when specifying configuration options using the
101 Arguments may optionally be enclosed in double quotes
103 in order to represent arguments containing spaces.
106 keywords and their meanings are as follows (note that
107 keywords are case-insensitive and arguments are case-sensitive):
110 Restricts the following declarations (up to the next
112 keyword) to be only for those hosts that match one of the patterns
113 given after the keyword.
116 as a pattern can be used to provide global
117 defaults for all hosts.
120 argument given on the command line (i.e. the name is not converted to
121 a canonicalized host name before matching).
125 for more information on patterns.
127 Specifies which address family to use when connecting.
137 passphrase/password querying will be disabled.
138 This option is useful in scripts and other batch jobs where no user
139 is present to supply the password.
147 Use the specified address on the local machine as the source address of
149 Only useful on systems with more than one address.
150 Note that this option does not work if
151 .Cm UsePrivilegedPort
154 .It Cm ChallengeResponseAuthentication
155 Specifies whether to use challenge-response authentication.
156 The argument to this keyword must be
163 If this flag is set to
166 will additionally check the host IP address in the
169 This allows ssh to detect if a host key changed due to DNS spoofing.
170 If the option is set to
172 the check will not be executed.
176 Specifies the cipher to use for encrypting the session
177 in protocol version 1.
185 is only supported in the
187 client for interoperability with legacy protocol 1 implementations
188 that do not support the
191 Its use is strongly discouraged due to cryptographic weaknesses.
195 Specifies the ciphers allowed for protocol version 2
196 in order of preference.
197 Multiple ciphers must be comma-separated.
198 The supported ciphers are
213 .Bd -literal -offset 3n
214 aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,
215 arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr,
216 aes192-ctr,aes256-ctr
218 .It Cm ClearAllForwardings
219 Specifies that all local, remote, and dynamic port forwardings
220 specified in the configuration files or on the command line be
222 This option is primarily useful when used from the
224 command line to clear port forwardings set in
225 configuration files, and is automatically set by
236 Specifies whether to use compression.
243 .It Cm CompressionLevel
244 Specifies the compression level to use if compression is enabled.
245 The argument must be an integer from 1 (fast) to 9 (slow, best).
246 The default level is 6, which is good for most applications.
247 The meaning of the values is the same as in
249 Note that this option applies to protocol version 1 only.
250 .It Cm ConnectionAttempts
251 Specifies the number of tries (one per second) to make before exiting.
252 The argument must be an integer.
253 This may be useful in scripts if the connection sometimes fails.
255 .It Cm ConnectTimeout
256 Specifies the timeout (in seconds) used when connecting to the
257 SSH server, instead of using the default system TCP timeout.
258 This value is used only when the target is down or really unreachable,
259 not when it refuses the connection.
261 Enables the sharing of multiple sessions over a single network connection.
265 will listen for connections on a control socket specified using the
268 Additional sessions can connect to this socket using the same
275 These sessions will try to reuse the master instance's network connection
276 rather than initiating new ones, but will fall back to connecting normally
277 if the control socket does not exist, or is not listening.
282 to listen for control connections, but require confirmation using the
284 program before they are accepted (see
290 ssh will continue without connecting to a master instance.
294 forwarding is supported over these multiplexed connections, however the
295 display and agent forwarded will be the one belonging to the master
296 connection i.e. it is not possible to forward multiple displays or agents.
298 Two additional options allow for opportunistic multiplexing: try to use a
299 master connection but fall back to creating a new one if one does not already
305 The latter requires confirmation like the
309 Specify the path to the control socket used for connection sharing as described
312 section above or the string
314 to disable connection sharing.
317 will be substituted by the local host name,
319 will be substituted by the target host name,
323 by the remote login username.
324 It is recommended that any
326 used for opportunistic connection sharing include
327 at least %h, %p, and %r.
328 This ensures that shared connections are uniquely identified.
329 .It Cm DynamicForward
330 Specifies that a TCP port on the local machine be forwarded
331 over the secure channel, and the application
332 protocol is then used to determine where to connect to from the
337 .Oo Ar bind_address : Oc Ar port .
339 IPv6 addresses can be specified by enclosing addresses in square brackets or
340 by using an alternative syntax:
341 .Oo Ar bind_address Ns / Oc Ns Ar port .
342 By default, the local port is bound in accordance with the
347 may be used to bind the connection to a specific address.
352 indicates that the listening port be bound for local use only, while an
355 indicates that the port should be available from all interfaces.
357 Currently the SOCKS4 and SOCKS5 protocols are supported, and
359 will act as a SOCKS server.
360 Multiple forwardings may be specified, and
361 additional forwardings can be given on the command line.
362 Only the superuser can forward privileged ports.
363 .It Cm EnableSSHKeysign
364 Setting this option to
366 in the global client configuration file
367 .Pa /etc/ssh/ssh_config
368 enables the use of the helper program
371 .Cm HostbasedAuthentication .
378 This option should be placed in the non-hostspecific section.
381 for more information.
383 Sets the escape character (default:
385 The escape character can also
386 be set on the command line.
387 The argument should be a single character,
389 followed by a letter, or
391 to disable the escape
392 character entirely (making the connection transparent for binary
394 .It Cm ExitOnForwardFailure
397 should terminate the connection if it cannot set up all requested
398 dynamic, local, and remote port forwardings.
406 Specifies whether the connection to the authentication agent (if any)
407 will be forwarded to the remote machine.
415 Agent forwarding should be enabled with caution.
416 Users with the ability to bypass file permissions on the remote host
417 (for the agent's Unix-domain socket)
418 can access the local agent through the forwarded connection.
419 An attacker cannot obtain key material from the agent,
420 however they can perform operations on the keys that enable them to
421 authenticate using the identities loaded into the agent.
423 Specifies whether X11 connections will be automatically redirected
424 over the secure channel and
434 X11 forwarding should be enabled with caution.
435 Users with the ability to bypass file permissions on the remote host
436 (for the user's X11 authorization database)
437 can access the local X11 display through the forwarded connection.
438 An attacker may then be able to perform activities such as keystroke monitoring
440 .Cm ForwardX11Trusted
441 option is also enabled.
442 .It Cm ForwardX11Trusted
443 If this option is set to
445 remote X11 clients will have full access to the original X11 display.
447 If this option is set to
449 remote X11 clients will be considered untrusted and prevented
450 from stealing or tampering with data belonging to trusted X11
454 token used for the session will be set to expire after 20 minutes.
455 Remote clients will be refused access after this time.
460 See the X11 SECURITY extension specification for full details on
461 the restrictions imposed on untrusted clients.
463 Specifies whether remote hosts are allowed to connect to local
467 binds local port forwardings to the loopback address.
468 This prevents other remote hosts from connecting to forwarded ports.
470 can be used to specify that ssh
471 should bind local port forwardings to the wildcard address,
472 thus allowing remote hosts to connect to forwarded ports.
479 .It Cm GlobalKnownHostsFile
480 Specifies a file to use for the global
481 host key database instead of
482 .Pa /etc/ssh/ssh_known_hosts .
483 .It Cm GSSAPIAuthentication
484 Specifies whether user authentication based on GSSAPI is allowed.
487 Note that this option applies to protocol version 2 only.
488 .It Cm GSSAPIKeyExchange
489 Specifies whether key exchange based on GSSAPI may be used. When using
490 GSSAPI key exchange the server need not have a host key.
493 Note that this option applies to protocol version 2 only.
494 .It Cm GSSAPIDelegateCredentials
495 Forward (delegate) credentials to the server.
498 Note that this option applies to protocol version 2 only.
499 .It Cm GSSAPITrustDns
502 to indicate that the DNS is trusted to securely canonicalize
503 the name of the host being connected to. If
505 the hostname entered on the
506 command line will be passed untouched to the GSSAPI library.
509 This option only applies to protocol version 2 connections using GSSAPI.
510 .It Cm HashKnownHosts
513 should hash host names and addresses when they are added to
514 .Pa ~/.ssh/known_hosts .
515 These hashed names may be used normally by
519 but they do not reveal identifying information should the file's contents
523 Note that existing names and addresses in known hosts files
524 will not be converted automatically,
525 but may be manually hashed using
527 .It Cm HostbasedAuthentication
528 Specifies whether to try rhosts based authentication with public key
536 This option applies to protocol version 2 only and
538 .Cm RhostsRSAAuthentication .
539 .It Cm HostKeyAlgorithms
540 Specifies the protocol version 2 host key algorithms
541 that the client wants to use in order of preference.
542 The default for this option is:
543 .Dq ssh-rsa,ssh-dss .
545 Specifies an alias that should be used instead of the
546 real host name when looking up or saving the host key
547 in the host key database files.
548 This option is useful for tunneling SSH connections
549 or for multiple servers running on a single host.
551 Specifies the real host name to log into.
552 This can be used to specify nicknames or abbreviations for hosts.
553 The default is the name given on the command line.
554 Numeric IP addresses are also permitted (both on the command line and in
557 .It Cm IdentitiesOnly
560 should only use the authentication identity files configured in the
565 offers more identities.
566 The argument to this keyword must be
570 This option is intended for situations where ssh-agent
571 offers many different identities.
575 Specifies a file from which the user's RSA or DSA authentication identity
579 for protocol version 1, and
583 for protocol version 2.
584 Additionally, any identities represented by the authentication agent
585 will be used for authentication.
587 The file name may use the tilde
588 syntax to refer to a user's home directory or one of the following
591 (local user's home directory),
597 (remote host name) or
601 It is possible to have
602 multiple identity files specified in configuration files; all these
603 identities will be tried in sequence.
604 .It Cm KbdInteractiveDevices
605 Specifies the list of methods to use in keyboard-interactive authentication.
606 Multiple method names must be comma-separated.
607 The default is to use the server specified list.
608 The methods available vary depending on what the server supports.
609 For an OpenSSH server,
610 it may be zero or more of:
616 Specifies a command to execute on the local machine after successfully
617 connecting to the server.
618 The command string extends to the end of the line, and is executed with
620 This directive is ignored unless
621 .Cm PermitLocalCommand
624 Specifies that a TCP port on the local machine be forwarded over
625 the secure channel to the specified host and port from the remote machine.
626 The first argument must be
628 .Oo Ar bind_address : Oc Ar port
630 and the second argument must be
631 .Ar host : Ns Ar hostport .
632 IPv6 addresses can be specified by enclosing addresses in square brackets or
633 by using an alternative syntax:
634 .Oo Ar bind_address Ns / Oc Ns Ar port
636 .Ar host Ns / Ns Ar hostport .
637 Multiple forwardings may be specified, and additional forwardings can be
638 given on the command line.
639 Only the superuser can forward privileged ports.
640 By default, the local port is bound in accordance with the
645 may be used to bind the connection to a specific address.
650 indicates that the listening port be bound for local use only, while an
653 indicates that the port should be available from all interfaces.
655 Gives the verbosity level that is used when logging messages from
657 The possible values are:
658 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
660 DEBUG and DEBUG1 are equivalent.
661 DEBUG2 and DEBUG3 each specify higher levels of verbose output.
663 Specifies the MAC (message authentication code) algorithms
664 in order of preference.
665 The MAC algorithm is used in protocol version 2
666 for data integrity protection.
667 Multiple algorithms must be comma-separated.
669 .Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
670 .It Cm NoHostAuthenticationForLocalhost
671 This option can be used if the home directory is shared across machines.
672 In this case localhost will refer to a different machine on each of
673 the machines and the user will get many warnings about changed host keys.
674 However, this option disables host authentication for localhost.
675 The argument to this keyword must be
679 The default is to check the host key for localhost.
680 .It Cm NumberOfPasswordPrompts
681 Specifies the number of password prompts before giving up.
682 The argument to this keyword must be an integer.
684 .It Cm PasswordAuthentication
685 Specifies whether to use password authentication.
686 The argument to this keyword must be
692 .It Cm PermitLocalCommand
693 Allow local command execution via the
696 .Ic !\& Ns Ar command
706 Specifies the port number to connect on the remote host.
708 .It Cm PreferredAuthentications
709 Specifies the order in which the client should try protocol 2
710 authentication methods.
711 This allows a client to prefer one method (e.g.\&
712 .Cm keyboard-interactive )
713 over another method (e.g.\&
715 The default for this option is:
721 keyboard-interactive,
725 Specifies the protocol versions
727 should support in order of preference.
728 The possible values are
732 Multiple versions must be comma-separated.
736 tries version 2 and falls back to version 1
737 if version 2 is not available.
739 Specifies the command to use to connect to the server.
741 string extends to the end of the line, and is executed with
743 In the command string,
745 will be substituted by the host name to
749 The command can be basically anything,
750 and should read from its standard input and write to its standard output.
751 It should eventually connect an
753 server running on some machine, or execute
756 Host key management will be done using the
757 HostName of the host being connected (defaulting to the name typed by
759 Setting the command to
761 disables this option entirely.
764 is not available for connects with a proxy command.
766 This directive is useful in conjunction with
768 and its proxy support.
769 For example, the following directive would connect via an HTTP proxy at
771 .Bd -literal -offset 3n
772 ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p
774 .It Cm PubkeyAuthentication
775 Specifies whether to try public key authentication.
776 The argument to this keyword must be
782 This option applies to protocol version 2 only.
784 Specifies the maximum amount of data that may be transmitted before the
785 session key is renegotiated.
786 The argument is the number of bytes, with an optional suffix of
791 to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
792 The default is between
796 depending on the cipher.
797 This option applies to protocol version 2 only.
799 Specifies that a TCP port on the remote machine be forwarded over
800 the secure channel to the specified host and port from the local machine.
801 The first argument must be
803 .Oo Ar bind_address : Oc Ar port
805 and the second argument must be
806 .Ar host : Ns Ar hostport .
807 IPv6 addresses can be specified by enclosing addresses in square brackets
808 or by using an alternative syntax:
809 .Oo Ar bind_address Ns / Oc Ns Ar port
811 .Ar host Ns / Ns Ar hostport .
812 Multiple forwardings may be specified, and additional
813 forwardings can be given on the command line.
814 Only the superuser can forward privileged ports.
818 is not specified, the default is to only bind to loopback addresses.
823 or an empty string, then the forwarding is requested to listen on all
827 will only succeed if the server's
829 option is enabled (see
830 .Xr sshd_config 5 ) .
831 .It Cm RhostsRSAAuthentication
832 Specifies whether to try rhosts based authentication with RSA host
840 This option applies to protocol version 1 only and requires
843 .It Cm RSAAuthentication
844 Specifies whether to try RSA authentication.
845 The argument to this keyword must be
849 RSA authentication will only be
850 attempted if the identity file exists, or an authentication agent is
854 Note that this option applies to protocol version 1 only.
856 Specifies what variables from the local
858 should be sent to the server.
859 Note that environment passing is only supported for protocol 2.
860 The server must also support it, and the server must be configured to
861 accept these environment variables.
866 for how to configure the server.
867 Variables are specified by name, which may contain wildcard characters.
868 Multiple environment variables may be separated by whitespace or spread
872 The default is not to send any environment variables.
876 for more information on patterns.
877 .It Cm ServerAliveCountMax
878 Sets the number of server alive messages (see below) which may be
881 receiving any messages back from the server.
882 If this threshold is reached while server alive messages are being sent,
883 ssh will disconnect from the server, terminating the session.
884 It is important to note that the use of server alive messages is very
888 The server alive messages are sent through the encrypted channel
889 and therefore will not be spoofable.
890 The TCP keepalive option enabled by
893 The server alive mechanism is valuable when the client or
894 server depend on knowing when a connection has become inactive.
896 The default value is 3.
898 .Cm ServerAliveInterval
899 (see below) is set to 15 and
900 .Cm ServerAliveCountMax
901 is left at the default, if the server becomes unresponsive,
902 ssh will disconnect after approximately 45 seconds.
903 This option applies to protocol version 2 only.
904 .It Cm ServerAliveInterval
905 Sets a timeout interval in seconds after which if no data has been received
908 will send a message through the encrypted
909 channel to request a response from the server.
911 is 0, indicating that these messages will not be sent to the server.
912 This option applies to protocol version 2 only.
913 .It Cm SmartcardDevice
914 Specifies which smartcard device to use.
915 The argument to this keyword is the device
917 should use to communicate with a smartcard used for storing the user's
919 By default, no device is specified and smartcard support is not activated.
920 .It Cm StrictHostKeyChecking
921 If this flag is set to
924 will never automatically add host keys to the
925 .Pa ~/.ssh/known_hosts
926 file, and refuses to connect to hosts whose host key has changed.
927 This provides maximum protection against trojan horse attacks,
928 though it can be annoying when the
929 .Pa /etc/ssh/ssh_known_hosts
930 file is poorly maintained or when connections to new hosts are
932 This option forces the user to manually
934 If this flag is set to
936 ssh will automatically add new host keys to the
937 user known hosts files.
938 If this flag is set to
941 will be added to the user known host files only after the user
942 has confirmed that is what they really want to do, and
943 ssh will refuse to connect to hosts whose host key has changed.
945 known hosts will be verified automatically in all cases.
954 Specifies whether the system should send TCP keepalive messages to the
956 If they are sent, death of the connection or crash of one
957 of the machines will be properly noticed.
958 However, this means that
959 connections will die if the route is down temporarily, and some people
964 (to send TCP keepalive messages), and the client will notice
965 if the network goes down or the remote host dies.
966 This is important in scripts, and many users want it too.
968 To disable TCP keepalive messages, the value should be set to
973 device forwarding between the client and the server.
984 requests the default tunnel mode, which is
991 devices to open on the client
998 .Ar local_tun Op : Ar remote_tun .
1000 The devices may be specified by numerical ID or the keyword
1002 which uses the next available tunnel device.
1005 is not specified, it defaults to
1009 .It Cm UsePrivilegedPort
1010 Specifies whether to use a privileged port for outgoing connections.
1011 The argument must be
1020 must be setuid root.
1021 Note that this option must be set to
1024 .Cm RhostsRSAAuthentication
1027 Specifies the user to log in as.
1028 This can be useful when a different user name is used on different machines.
1029 This saves the trouble of
1030 having to remember to give the user name on the command line.
1031 .It Cm UserKnownHostsFile
1032 Specifies a file to use for the user
1033 host key database instead of
1034 .Pa ~/.ssh/known_hosts .
1035 .It Cm VerifyHostKeyDNS
1036 Specifies whether to verify the remote key using DNS and SSHFP resource
1038 If this option is set to
1040 the client will implicitly trust keys that match a secure fingerprint
1042 Insecure fingerprints will be handled as if this option was set to
1044 If this option is set to
1046 information on fingerprint match will be displayed, but the user will still
1047 need to confirm new host keys according to the
1048 .Cm StrictHostKeyChecking
1050 The argument must be
1057 Note that this option applies to protocol version 2 only.
1060 .Sx VERIFYING HOST KEYS
1063 .It Cm XAuthLocation
1064 Specifies the full pathname of the
1068 .Pa /usr/X11R6/bin/xauth .
1073 consists of zero or more non-whitespace characters,
1075 (a wildcard that matches zero or more characters),
1078 (a wildcard that matches exactly one character).
1079 For example, to specify a set of declarations for any host in the
1082 the following pattern could be used:
1086 The following pattern
1087 would match any host in the 192.168.0.[0-9] network range:
1089 .Dl Host 192.168.0.?
1093 is a comma-separated list of patterns.
1094 Patterns within pattern-lists may be negated
1095 by preceding them with an exclamation mark
1098 to allow a key to be used from anywhere within an organisation
1102 the following entry (in authorized_keys) could be used:
1104 .Dl from=\&"!*.dialup.example.com,*.example.com\&"
1107 .It Pa ~/.ssh/config
1108 This is the per-user configuration file.
1109 The format of this file is described above.
1110 This file is used by the SSH client.
1111 Because of the potential for abuse, this file must have strict permissions:
1112 read/write for the user, and not accessible by others.
1113 .It Pa /etc/ssh/ssh_config
1114 Systemwide configuration file.
1115 This file provides defaults for those
1116 values that are not specified in the user's configuration file, and
1117 for those users who do not have a configuration file.
1118 This file must be world-readable.
1123 OpenSSH is a derivative of the original and free
1124 ssh 1.2.12 release by Tatu Ylonen.
1125 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1126 Theo de Raadt and Dug Song
1127 removed many bugs, re-added newer features and
1129 Markus Friedl contributed the support for SSH
1130 protocol versions 1.5 and 2.0.