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.1 2002/06/20 19:56:07 stevesk 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: 54command line options, user's configuration file 55.Pq Pa $HOME/.ssh/config , 56and system-wide configuration file 57.Pq Pa /etc/ssh/ssh_config . 58.Pp 59For each parameter, the first obtained value 60will be used. 61The configuration files contain sections bracketed by 62.Dq Host 63specifications, and that section is only applied for hosts that 64match one of the patterns given in the specification. 65The matched host name is the one given on the command line. 66.Pp 67Since the first obtained value for each parameter is used, more 68host-specific declarations should be given near the beginning of the 69file, and general defaults at the end. 70.Pp 71The configuration file has the following format: 72.Pp 73Empty lines and lines starting with 74.Ql # 75are comments. 76.Pp 77Otherwise a line is of the format 78.Dq keyword arguments . 79Configuration options may be separated by whitespace or 80optional whitespace and exactly one 81.Ql = ; 82the latter format is useful to avoid the need to quote whitespace 83when specifying configuration options using the 84.Nm ssh , 85.Nm scp 86and 87.Nm sftp 88.Fl o 89option. 90.Pp 91The possible 92keywords and their meanings are as follows (note that 93keywords are case-insensitive and arguments are case-sensitive): 94.Bl -tag -width Ds 95.It Cm Host 96Restricts the following declarations (up to the next 97.Cm Host 98keyword) to be only for those hosts that match one of the patterns 99given after the keyword. 100.Ql \&* 101and 102.Ql ? 103can be used as wildcards in the 104patterns. 105A single 106.Ql \&* 107as a pattern can be used to provide global 108defaults for all hosts. 109The host is the 110.Ar hostname 111argument given on the command line (i.e., the name is not converted to 112a canonicalized host name before matching). 113.It Cm AFSTokenPassing 114Specifies whether to pass AFS tokens to remote host. 115The argument to this keyword must be 116.Dq yes 117or 118.Dq no . 119This option applies to protocol version 1 only. 120.It Cm BatchMode 121If set to 122.Dq yes , 123passphrase/password querying will be disabled. 124This option is useful in scripts and other batch jobs where no user 125is present to supply the password. 126The argument must be 127.Dq yes 128or 129.Dq no . 130The default is 131.Dq no . 132.It Cm BindAddress 133Specify the interface to transmit from on machines with multiple 134interfaces or aliased addresses. 135Note that this option does not work if 136.Cm UsePrivilegedPort 137is set to 138.Dq yes . 139.It Cm ChallengeResponseAuthentication 140Specifies whether to use challenge response authentication. 141The argument to this keyword must be 142.Dq yes 143or 144.Dq no . 145The default is 146.Dq yes . 147.It Cm CheckHostIP 148If this flag is set to 149.Dq yes , 150ssh will additionally check the host IP address in the 151.Pa known_hosts 152file. 153This allows ssh to detect if a host key changed due to DNS spoofing. 154If the option is set to 155.Dq no , 156the check will not be executed. 157The default is 158.Dq no . 159.It Cm Cipher 160Specifies the cipher to use for encrypting the session 161in protocol version 1. 162Currently, 163.Dq blowfish , 164.Dq 3des , 165and 166.Dq des 167are supported. 168.Ar des 169is only supported in the 170.Nm ssh 171client for interoperability with legacy protocol 1 implementations 172that do not support the 173.Ar 3des 174cipher. Its use is strongly discouraged due to cryptographic 175weaknesses. 176The default is 177.Dq 3des . 178.It Cm Ciphers 179Specifies the ciphers allowed for protocol version 2 180in order of preference. 181Multiple ciphers must be comma-separated. 182The default is 183.Pp 184.Bd -literal 185 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour, 186 aes192-cbc,aes256-cbc'' 187.Ed 188.It Cm ClearAllForwardings 189Specifies that all local, remote and dynamic port forwardings 190specified in the configuration files or on the command line be 191cleared. This option is primarily useful when used from the 192.Nm ssh 193command line to clear port forwardings set in 194configuration files, and is automatically set by 195.Xr scp 1 196and 197.Xr sftp 1 . 198The argument must be 199.Dq yes 200or 201.Dq no . 202The default is 203.Dq no . 204.It Cm Compression 205Specifies whether to use compression. 206The argument must be 207.Dq yes 208or 209.Dq no . 210The default is 211.Dq no . 212.It Cm CompressionLevel 213Specifies the compression level to use if compression is enabled. 214The argument must be an integer from 1 (fast) to 9 (slow, best). 215The default level is 6, which is good for most applications. 216The meaning of the values is the same as in 217.Xr gzip 1 . 218Note that this option applies to protocol version 1 only. 219.It Cm ConnectionAttempts 220Specifies the number of tries (one per second) to make before exiting. 221The argument must be an integer. 222This may be useful in scripts if the connection sometimes fails. 223The default is 1. 224.It Cm DynamicForward 225Specifies that a TCP/IP port on the local machine be forwarded 226over the secure channel, and the application 227protocol is then used to determine where to connect to from the 228remote machine. The argument must be a port number. 229Currently the SOCKS4 protocol is supported, and 230.Nm ssh 231will act as a SOCKS4 server. 232Multiple forwardings may be specified, and 233additional forwardings can be given on the command line. Only 234the superuser can forward privileged ports. 235.It Cm EscapeChar 236Sets the escape character (default: 237.Ql ~ ) . 238The escape character can also 239be set on the command line. 240The argument should be a single character, 241.Ql ^ 242followed by a letter, or 243.Dq none 244to disable the escape 245character entirely (making the connection transparent for binary 246data). 247.It Cm ForwardAgent 248Specifies whether the connection to the authentication agent (if any) 249will be forwarded to the remote machine. 250The argument must be 251.Dq yes 252or 253.Dq no . 254The default is 255.Dq no . 256.It Cm ForwardX11 257Specifies whether X11 connections will be automatically redirected 258over the secure channel and 259.Ev DISPLAY 260set. 261The argument must be 262.Dq yes 263or 264.Dq no . 265The default is 266.Dq no . 267.It Cm GatewayPorts 268Specifies whether remote hosts are allowed to connect to local 269forwarded ports. 270By default, 271.Nm ssh 272binds local port forwardings to the loopback address. This 273prevents other remote hosts from connecting to forwarded ports. 274.Cm GatewayPorts 275can be used to specify that 276.Nm ssh 277should bind local port forwardings to the wildcard address, 278thus allowing remote hosts to connect to forwarded ports. 279The argument must be 280.Dq yes 281or 282.Dq no . 283The default is 284.Dq no . 285.It Cm GlobalKnownHostsFile 286Specifies a file to use for the global 287host key database instead of 288.Pa /etc/ssh/ssh_known_hosts . 289.It Cm HostbasedAuthentication 290Specifies whether to try rhosts based authentication with public key 291authentication. 292The argument must be 293.Dq yes 294or 295.Dq no . 296The default is 297.Dq no . 298This option applies to protocol version 2 only and 299is similar to 300.Cm RhostsRSAAuthentication . 301.It Cm HostKeyAlgorithms 302Specifies the protocol version 2 host key algorithms 303that the client wants to use in order of preference. 304The default for this option is: 305.Dq ssh-rsa,ssh-dss . 306.It Cm HostKeyAlias 307Specifies an alias that should be used instead of the 308real host name when looking up or saving the host key 309in the host key database files. 310This option is useful for tunneling ssh connections 311or for multiple servers running on a single host. 312.It Cm HostName 313Specifies the real host name to log into. 314This can be used to specify nicknames or abbreviations for hosts. 315Default is the name given on the command line. 316Numeric IP addresses are also permitted (both on the command line and in 317.Cm HostName 318specifications). 319.It Cm IdentityFile 320Specifies a file from which the user's RSA or DSA authentication identity 321is read. The default is 322.Pa $HOME/.ssh/identity 323for protocol version 1, and 324.Pa $HOME/.ssh/id_rsa 325and 326.Pa $HOME/.ssh/id_dsa 327for protocol version 2. 328Additionally, any identities represented by the authentication agent 329will be used for authentication. 330The file name may use the tilde 331syntax to refer to a user's home directory. 332It is possible to have 333multiple identity files specified in configuration files; all these 334identities will be tried in sequence. 335.It Cm KeepAlive 336Specifies whether the system should send TCP keepalive messages to the 337other side. 338If they are sent, death of the connection or crash of one 339of the machines will be properly noticed. 340However, this means that 341connections will die if the route is down temporarily, and some people 342find it annoying. 343.Pp 344The default is 345.Dq yes 346(to send keepalives), and the client will notice 347if the network goes down or the remote host dies. 348This is important in scripts, and many users want it too. 349.Pp 350To disable keepalives, the value should be set to 351.Dq no . 352.It Cm KerberosAuthentication 353Specifies whether Kerberos authentication will be used. 354The argument to this keyword must be 355.Dq yes 356or 357.Dq no . 358.It Cm KerberosTgtPassing 359Specifies whether a Kerberos TGT will be forwarded to the server. 360This will only work if the Kerberos server is actually an AFS kaserver. 361The argument to this keyword must be 362.Dq yes 363or 364.Dq no . 365.It Cm LocalForward 366Specifies that a TCP/IP port on the local machine be forwarded over 367the secure channel to the specified host and port from the remote machine. 368The first argument must be a port number, and the second must be 369.Ar host:port . 370IPv6 addresses can be specified with an alternative syntax: 371.Ar host/port . 372Multiple forwardings may be specified, and additional 373forwardings can be given on the command line. 374Only the superuser can forward privileged ports. 375.It Cm LogLevel 376Gives the verbosity level that is used when logging messages from 377.Nm ssh . 378The possible values are: 379QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3. 380The default is INFO. DEBUG and DEBUG1 are equivalent. DEBUG2 381and DEBUG3 each specify higher levels of verbose output. 382.It Cm MACs 383Specifies the MAC (message authentication code) algorithms 384in order of preference. 385The MAC algorithm is used in protocol version 2 386for data integrity protection. 387Multiple algorithms must be comma-separated. 388The default is 389.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 . 390.It Cm NoHostAuthenticationForLocalhost 391This option can be used if the home directory is shared across machines. 392In this case localhost will refer to a different machine on each of 393the machines and the user will get many warnings about changed host keys. 394However, this option disables host authentication for localhost. 395The argument to this keyword must be 396.Dq yes 397or 398.Dq no . 399The default is to check the host key for localhost. 400.It Cm NumberOfPasswordPrompts 401Specifies the number of password prompts before giving up. 402The argument to this keyword must be an integer. 403Default is 3. 404.It Cm PasswordAuthentication 405Specifies whether to use password authentication. 406The argument to this keyword must be 407.Dq yes 408or 409.Dq no . 410The default is 411.Dq yes . 412.It Cm Port 413Specifies the port number to connect on the remote host. 414Default is 22. 415.It Cm PreferredAuthentications 416Specifies the order in which the client should try protocol 2 417authentication methods. This allows a client to prefer one method (e.g. 418.Cm keyboard-interactive ) 419over another method (e.g. 420.Cm password ) 421The default for this option is: 422.Dq hostbased,publickey,keyboard-interactive,password . 423.It Cm Protocol 424Specifies the protocol versions 425.Nm ssh 426should support in order of preference. 427The possible values are 428.Dq 1 429and 430.Dq 2 . 431Multiple versions must be comma-separated. 432The default is 433.Dq 2,1 . 434This means that 435.Nm ssh 436tries version 2 and falls back to version 1 437if version 2 is not available. 438.It Cm ProxyCommand 439Specifies the command to use to connect to the server. 440The command 441string extends to the end of the line, and is executed with 442.Pa /bin/sh . 443In the command string, 444.Ql %h 445will be substituted by the host name to 446connect and 447.Ql %p 448by the port. 449The command can be basically anything, 450and should read from its standard input and write to its standard output. 451It should eventually connect an 452.Xr sshd 8 453server running on some machine, or execute 454.Ic sshd -i 455somewhere. 456Host key management will be done using the 457HostName of the host being connected (defaulting to the name typed by 458the user). 459Note that 460.Cm CheckHostIP 461is not available for connects with a proxy command. 462.Pp 463.It Cm PubkeyAuthentication 464Specifies whether to try public key authentication. 465The argument to this keyword must be 466.Dq yes 467or 468.Dq no . 469The default is 470.Dq yes . 471This option applies to protocol version 2 only. 472.It Cm RemoteForward 473Specifies that a TCP/IP port on the remote machine be forwarded over 474the secure channel to the specified host and port from the local machine. 475The first argument must be a port number, and the second must be 476.Ar host:port . 477IPv6 addresses can be specified with an alternative syntax: 478.Ar host/port . 479Multiple forwardings may be specified, and additional 480forwardings can be given on the command line. 481Only the superuser can forward privileged ports. 482.It Cm RhostsAuthentication 483Specifies whether to try rhosts based authentication. 484Note that this 485declaration only affects the client side and has no effect whatsoever 486on security. 487Most servers do not permit RhostsAuthentication because it 488is not secure (see 489.Cm RhostsRSAAuthentication ) . 490The argument to this keyword must be 491.Dq yes 492or 493.Dq no . 494The default is 495.Dq no . 496This option applies to protocol version 1 only. 497.It Cm RhostsRSAAuthentication 498Specifies whether to try rhosts based authentication with RSA host 499authentication. 500The argument must be 501.Dq yes 502or 503.Dq no . 504The default is 505.Dq no . 506This option applies to protocol version 1 only and requires 507.Nm ssh 508to be setuid root. 509.It Cm RSAAuthentication 510Specifies whether to try RSA authentication. 511The argument to this keyword must be 512.Dq yes 513or 514.Dq no . 515RSA authentication will only be 516attempted if the identity file exists, or an authentication agent is 517running. 518The default is 519.Dq yes . 520Note that this option applies to protocol version 1 only. 521.It Cm SmartcardDevice 522Specifies which smartcard device to use. The argument to this keyword is 523the device 524.Nm ssh 525should use to communicate with a smartcard used for storing the user's 526private RSA key. By default, no device is specified and smartcard support 527is not activated. 528.It Cm StrictHostKeyChecking 529If this flag is set to 530.Dq yes , 531.Nm ssh 532will never automatically add host keys to the 533.Pa $HOME/.ssh/known_hosts 534file, and refuses to connect to hosts whose host key has changed. 535This provides maximum protection against trojan horse attacks, 536however, can be annoying when the 537.Pa /etc/ssh/ssh_known_hosts 538file is poorly maintained, or connections to new hosts are 539frequently made. 540This option forces the user to manually 541add all new hosts. 542If this flag is set to 543.Dq no , 544.Nm ssh 545will automatically add new host keys to the 546user known hosts files. 547If this flag is set to 548.Dq ask , 549new host keys 550will be added to the user known host files only after the user 551has confirmed that is what they really want to do, and 552.Nm ssh 553will refuse to connect to hosts whose host key has changed. 554The host keys of 555known hosts will be verified automatically in all cases. 556The argument must be 557.Dq yes , 558.Dq no 559or 560.Dq ask . 561The default is 562.Dq ask . 563.It Cm UsePrivilegedPort 564Specifies whether to use a privileged port for outgoing connections. 565The argument must be 566.Dq yes 567or 568.Dq no . 569The default is 570.Dq no . 571Note that this option must be set to 572.Dq yes 573if 574.Cm RhostsAuthentication 575and 576.Cm RhostsRSAAuthentication 577authentications are needed with older servers. 578.It Cm User 579Specifies the user to log in as. 580This can be useful when a different user name is used on different machines. 581This saves the trouble of 582having to remember to give the user name on the command line. 583.It Cm UserKnownHostsFile 584Specifies a file to use for the user 585host key database instead of 586.Pa $HOME/.ssh/known_hosts . 587.It Cm VersionAddendum 588Specifies a string to append to the regular version string to identify 589OS- or site-specific modifications. 590.It Cm XAuthLocation 591Specifies the location of the 592.Xr xauth 1 593program. 594The default is 595.Pa /usr/X11R6/bin/xauth . 596.El 597.Sh FILES 598.Bl -tag -width Ds 599.It Pa $HOME/.ssh/config 600This is the per-user configuration file. 601The format of this file is described above. 602This file is used by the 603.Nm ssh 604client. 605This file does not usually contain any sensitive information, 606but the recommended permissions are read/write for the user, and not 607accessible by others. 608.It Pa /etc/ssh/ssh_config 609Systemwide configuration file. 610This file provides defaults for those 611values that are not specified in the user's configuration file, and 612for those users who do not have a configuration file. 613This file must be world-readable. 614.El 615.Sh AUTHORS 616OpenSSH is a derivative of the original and free 617ssh 1.2.12 release by Tatu Ylonen. 618Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 619Theo de Raadt and Dug Song 620removed many bugs, re-added newer features and 621created OpenSSH. 622Markus Friedl contributed the support for SSH 623protocol versions 1.5 and 2.0. 624.Sh SEE ALSO 625.Xr ssh 1 626