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.1,v 1.107 2001/04/22 23:58:36 markus Exp $ 38.\" $FreeBSD$ 39.\" 40.Dd September 25, 1999 41.Dt SSH 1 42.Os 43.Sh NAME 44.Nm ssh 45.Nd OpenSSH SSH client (remote login program) 46.Sh SYNOPSIS 47.Nm ssh 48.Op Fl l Ar login_name 49.Op Ar hostname | user@hostname 50.Op Ar command 51.Pp 52.Nm ssh 53.Op Fl afgknqstvxACNPTX1246 54.Op Fl c Ar cipher_spec 55.Op Fl e Ar escape_char 56.Op Fl i Ar identity_file 57.Op Fl l Ar login_name 58.Op Fl m Ar mac_spec 59.Op Fl o Ar option 60.Op Fl p Ar port 61.Oo Fl L Xo 62.Sm off 63.Ar port : 64.Ar host : 65.Ar hostport 66.Sm on 67.Xc 68.Oc 69.Oo Fl R Xo 70.Sm off 71.Ar port : 72.Ar host : 73.Ar hostport 74.Sm on 75.Xc 76.Oc 77.Op Ar hostname | user@hostname 78.Op Ar command 79.Sh DESCRIPTION 80.Nm 81(SSH client) is a program for logging into a remote machine and for 82executing commands on a remote machine. 83It is intended to replace 84rlogin and rsh, and provide secure encrypted communications between 85two untrusted hosts over an insecure network. 86X11 connections and 87arbitrary TCP/IP ports can also be forwarded over the secure channel. 88.Pp 89.Nm 90connects and logs into the specified 91.Ar hostname . 92The user must prove 93his/her identity to the remote machine using one of several methods 94depending on the protocol version used: 95.Pp 96.Ss SSH protocol version 1 97.Pp 98First, if the machine the user logs in from is listed in 99.Pa /etc/hosts.equiv 100or 101.Pa /etc/ssh/shosts.equiv 102on the remote machine, and the user names are 103the same on both sides, the user is immediately permitted to log in. 104Second, if 105.Pa \&.rhosts 106or 107.Pa \&.shosts 108exists in the user's home directory on the 109remote machine and contains a line containing the name of the client 110machine and the name of the user on that machine, the user is 111permitted to log in. 112This form of authentication alone is normally not 113allowed by the server because it is not secure. 114.Pp 115The second authentication method is the 116.Pa rhosts 117or 118.Pa hosts.equiv 119method combined with RSA-based host authentication. 120It means that if the login would be permitted by 121.Pa $HOME/.rhosts , 122.Pa $HOME/.shosts , 123.Pa /etc/hosts.equiv , 124or 125.Pa /etc/ssh/shosts.equiv , 126and if additionally the server can verify the client's 127host key (see 128.Pa /etc/ssh/ssh_known_hosts 129and 130.Pa $HOME/.ssh/known_hosts 131in the 132.Sx FILES 133section), only then login is permitted. 134This authentication method closes security holes due to IP 135spoofing, DNS spoofing and routing spoofing. 136[Note to the administrator: 137.Pa /etc/hosts.equiv , 138.Pa $HOME/.rhosts , 139and the rlogin/rsh protocol in general, are inherently insecure and should be 140disabled if security is desired.] 141.Pp 142As a third authentication method, 143.Nm 144supports RSA based authentication. 145The scheme is based on public-key cryptography: there are cryptosystems 146where encryption and decryption are done using separate keys, and it 147is not possible to derive the decryption key from the encryption key. 148RSA is one such system. 149The idea is that each user creates a public/private 150key pair for authentication purposes. 151The server knows the public key, and only the user knows the private key. 152The file 153.Pa $HOME/.ssh/authorized_keys 154lists the public keys that are permitted for logging 155in. 156When the user logs in, the 157.Nm 158program tells the server which key pair it would like to use for 159authentication. 160The server checks if this key is permitted, and if 161so, sends the user (actually the 162.Nm 163program running on behalf of the user) a challenge, a random number, 164encrypted by the user's public key. 165The challenge can only be 166decrypted using the proper private key. 167The user's client then decrypts the 168challenge using the private key, proving that he/she knows the private 169key but without disclosing it to the server. 170.Pp 171.Nm 172implements the RSA authentication protocol automatically. 173The user creates his/her RSA key pair by running 174.Xr ssh-keygen 1 . 175This stores the private key in 176.Pa $HOME/.ssh/identity 177and the public key in 178.Pa $HOME/.ssh/identity.pub 179in the user's home directory. 180The user should then copy the 181.Pa identity.pub 182to 183.Pa $HOME/.ssh/authorized_keys 184in his/her home directory on the remote machine (the 185.Pa authorized_keys 186file corresponds to the conventional 187.Pa $HOME/.rhosts 188file, and has one key 189per line, though the lines can be very long). 190After this, the user can log in without giving the password. 191RSA authentication is much 192more secure than rhosts authentication. 193.Pp 194The most convenient way to use RSA authentication may be with an 195authentication agent. 196See 197.Xr ssh-agent 1 198for more information. 199.Pp 200If other authentication methods fail, 201.Nm 202prompts the user for a password. 203The password is sent to the remote 204host for checking; however, since all communications are encrypted, 205the password cannot be seen by someone listening on the network. 206.Pp 207.Ss SSH protocol version 2 208.Pp 209When a user connects using the protocol version 2 210different authentication methods are available. 211Using the default values for 212.Cm PreferredAuthentications , 213the client will try to authenticate first using the public key method; 214if this method fails password authentication is attempted, 215and finally if this method fails keyboard-interactive authentication 216is attempted. 217If this method fails password authentication is 218tried. 219.Pp 220The public key method is similar to RSA authentication described 221in the previous section and allows the RSA or DSA algorithm to be used: 222The client uses his private key, 223.Pa $HOME/.ssh/id_dsa 224or 225.Pa $HOME/.ssh/id_rsa , 226to sign the session identifier and sends the result to the server. 227The server checks whether the matching public key is listed in 228.Pa $HOME/.ssh/authorized_keys2 229and grants access if both the key is found and the signature is correct. 230The session identifier is derived from a shared Diffie-Hellman value 231and is only known to the client and the server. 232.Pp 233If public key authentication fails or is not available a password 234can be sent encrypted to the remote host for proving the user's identity. 235.Pp 236Additionally, 237.Nm 238supports hostbased or challenge response authentication. 239.Pp 240Protocol 2 provides additional mechanisms for confidentiality 241(the traffic is encrypted using 3DES, Blowfish, CAST128 or Arcfour) 242and integrity (hmac-md5, hmac-sha1). 243Note that protocol 1 lacks a strong mechanism for ensuring the 244integrity of the connection. 245.Pp 246.Ss Login session and remote execution 247.Pp 248When the user's identity has been accepted by the server, the server 249either executes the given command, or logs into the machine and gives 250the user a normal shell on the remote machine. 251All communication with 252the remote command or shell will be automatically encrypted. 253.Pp 254If a pseudo-terminal has been allocated (normal login session), the 255user may use the escape characters noted below. 256.Pp 257If no pseudo tty has been allocated, the 258session is transparent and can be used to reliably transfer binary 259data. 260On most systems, setting the escape character to 261.Dq none 262will also make the session transparent even if a tty is used. 263.Pp 264The session terminates when the command or shell on the remote 265machine exits and all X11 and TCP/IP connections have been closed. 266The exit status of the remote program is returned as the exit status 267of 268.Nm ssh . 269.Pp 270.Ss Escape Characters 271.Pp 272When a pseudo terminal has been requested, ssh supports a number of functions 273through the use of an escape character. 274.Pp 275A single tilde character can be sent as 276.Ic ~~ 277(or by following the tilde by a character other than those described above). 278The escape character must always follow a newline to be interpreted as 279special. 280The escape character can be changed in configuration files using the 281.Cm EscapeChar 282configuration directive or on the command line by the 283.Fl e 284option. 285.Pp 286The supported escapes (assuming the default 287.Ql ~ ) 288are: 289.Bl -tag -width Ds 290.It Cm ~. 291Disconnect 292.It Cm ~^Z 293Background ssh 294.It Cm ~# 295List forwarded connections 296.It Cm ~& 297Background ssh at logout when waiting for forwarded connection / X11 sessions 298to terminate (protocol version 1 only) 299.It Cm ~? 300Display a list of escape characters 301.It Cm ~R 302Request rekeying of the connection (only useful for SSH protocol version 2 303and if the peer supports it) 304.El 305.Pp 306.Ss X11 and TCP forwarding 307.Pp 308If the user is using X11 (the 309.Ev DISPLAY 310environment variable is set), the connection to the X11 display can 311be forwarded to the remote side in such a way that any X11 312programs started from the shell (or command) will go through the 313encrypted channel, and the connection to the real X server will be made 314from the local machine. 315The user should not manually set 316.Ev DISPLAY . 317Forwarding of X11 connections weakens the security of ssh and is 318disabled by default. X11 forwarding can be enabled on the command line 319or in configuration files. 320.Pp 321The 322.Ev DISPLAY 323value set by 324.Nm 325will point to the server machine, but with a display number greater 326than zero. 327This is normal, and happens because 328.Nm 329creates a 330.Dq proxy 331X server on the server machine for forwarding the 332connections over the encrypted channel. 333.Pp 334.Nm 335will also automatically set up Xauthority data on the server machine. 336For this purpose, it will generate a random authorization cookie, 337store it in Xauthority on the server, and verify that any forwarded 338connections carry this cookie and replace it by the real cookie when 339the connection is opened. 340The real authentication cookie is never 341sent to the server machine (and no cookies are sent in the plain). 342.Pp 343If the user is using an authentication agent, the connection to the agent 344is automatically forwarded to the remote side unless disabled on 345command line or in a configuration file. 346.Pp 347Forwarding of arbitrary TCP/IP connections over the secure channel can 348be specified either on command line or in a configuration file. 349One possible application of TCP/IP forwarding is a secure connection to an 350electronic purse; another is going through firewalls. 351.Pp 352.Ss Server authentication 353.Pp 354.Nm 355automatically maintains and checks a database containing 356identifications for all hosts it has ever been used with. 357RSA host keys are stored in 358.Pa $HOME/.ssh/known_hosts 359and 360host keys used in the protocol version 2 are stored in 361.Pa $HOME/.ssh/known_hosts2 362in the user's home directory. 363Additionally, the files 364.Pa /etc/ssh/ssh_known_hosts 365and 366.Pa /etc/ssh/ssh_known_hosts2 367are automatically checked for known hosts. 368Any new hosts are automatically added to the user's file. 369If a host's identification 370ever changes, 371.Nm 372warns about this and disables password authentication to prevent a 373trojan horse from getting the user's password. 374Another purpose of 375this mechanism is to prevent man-in-the-middle attacks which could 376otherwise be used to circumvent the encryption. 377The 378.Cm StrictHostKeyChecking 379option (see below) can be used to prevent logins to machines whose 380host key is not known or has changed. 381.Pp 382The options are as follows: 383.Bl -tag -width Ds 384.It Fl a 385Disables forwarding of the authentication agent connection. 386.It Fl A 387Enables forwarding of the authentication agent connection. 388This can also be specified on a per-host basis in a configuration file. 389.It Fl c Ar blowfish|3des 390Selects the cipher to use for encrypting the session. 391.Ar 3des 392is used by default. 393It is believed to be secure. 394.Ar 3des 395(triple-des) is an encrypt-decrypt-encrypt triple with three different keys. 396It is presumably more secure than the 397.Ar des 398cipher which is no longer fully supported in 399.Nm ssh . 400.Ar blowfish 401is a fast block cipher, it appears very secure and is much faster than 402.Ar 3des . 403.It Fl c Ar cipher_spec 404Additionally, for protocol version 2 a comma-separated list of ciphers can 405be specified in order of preference. 406See 407.Cm Ciphers 408for more information. 409.It Fl e Ar ch|^ch|none 410Sets the escape character for sessions with a pty (default: 411.Ql ~ ) . 412The escape character is only recognized at the beginning of a line. 413The escape character followed by a dot 414.Pq Ql \&. 415closes the connection, followed 416by control-Z suspends the connection, and followed by itself sends the 417escape character once. 418Setting the character to 419.Dq none 420disables any escapes and makes the session fully transparent. 421.It Fl f 422Requests 423.Nm 424to go to background just before command execution. 425This is useful if 426.Nm 427is going to ask for passwords or passphrases, but the user 428wants it in the background. 429This implies 430.Fl n . 431The recommended way to start X11 programs at a remote site is with 432something like 433.Ic ssh -f host xterm . 434.It Fl g 435Allows remote hosts to connect to local forwarded ports. 436.It Fl i Ar identity_file 437Selects the file from which the identity (private key) for 438RSA or DSA authentication is read. 439Default is 440.Pa $HOME/.ssh/identity 441in the user's home directory. 442Identity files may also be specified on 443a per-host basis in the configuration file. 444It is possible to have multiple 445.Fl i 446options (and multiple identities specified in 447configuration files). 448.It Fl k 449Disables forwarding of Kerberos tickets and AFS tokens. 450This may also be specified on a per-host basis in the configuration file. 451.It Fl l Ar login_name 452Specifies the user to log in as on the remote machine. 453This also may be specified on a per-host basis in the configuration file. 454.It Fl m Ar mac_spec 455Additionally, for protocol version 2 a comma-separated list of MAC 456(message authentication code) algorithms can 457be specified in order of preference. 458See the 459.Cm MACs 460keyword for more information. 461.It Fl n 462Redirects stdin from 463.Pa /dev/null 464(actually, prevents reading from stdin). 465This must be used when 466.Nm 467is run in the background. 468A common trick is to use this to run X11 programs on a remote machine. 469For example, 470.Ic ssh -n shadows.cs.hut.fi emacs & 471will start an emacs on shadows.cs.hut.fi, and the X11 472connection will be automatically forwarded over an encrypted channel. 473The 474.Nm 475program will be put in the background. 476(This does not work if 477.Nm 478needs to ask for a password or passphrase; see also the 479.Fl f 480option.) 481.It Fl N 482Do not execute a remote command. 483This is useful if you just want to forward ports 484(protocol version 2 only). 485.It Fl o Ar option 486Can be used to give options in the format used in the config file. 487This is useful for specifying options for which there is no separate 488command-line flag. 489The option has the same format as a line in the configuration file. 490.It Fl p Ar port 491Port to connect to on the remote host. 492This can be specified on a 493per-host basis in the configuration file. 494.It Fl P 495Use a non-privileged port for outgoing connections. 496This can be used if your firewall does 497not permit connections from privileged ports. 498Note that this option turns off 499.Cm RhostsAuthentication 500and 501.Cm RhostsRSAAuthentication 502for older servers. 503.It Fl q 504Quiet mode. 505Causes all warning and diagnostic messages to be suppressed. 506Only fatal errors are displayed. 507.It Fl s 508May be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the use 509of SSH as a secure transport for other application (eg. sftp). The 510subsystem is specified as the remote command. 511.It Fl t 512Force pseudo-tty allocation. 513This can be used to execute arbitrary 514screen-based programs on a remote machine, which can be very useful, 515e.g., when implementing menu services. 516Multiple 517.Fl t 518options force tty allocation, even if 519.Nm 520has no local tty. 521.It Fl T 522Disable pseudo-tty allocation. 523.It Fl v 524Verbose mode. 525Causes 526.Nm 527to print debugging messages about its progress. 528This is helpful in 529debugging connection, authentication, and configuration problems. 530Multiple 531.Fl v 532options increases the verbosity. 533Maximum is 3. 534.It Fl x 535Disables X11 forwarding. 536.It Fl X 537Enables X11 forwarding. 538This can also be specified on a per-host basis in a configuration file. 539.It Fl C 540Requests compression of all data (including stdin, stdout, stderr, and 541data for forwarded X11 and TCP/IP connections). 542The compression algorithm is the same used by 543.Xr gzip 1 , 544and the 545.Dq level 546can be controlled by the 547.Cm CompressionLevel 548option (see below). 549Compression is desirable on modem lines and other 550slow connections, but will only slow down things on fast networks. 551The default value can be set on a host-by-host basis in the 552configuration files; see the 553.Cm Compress 554option below. 555.It Fl L Ar port:host:hostport 556Specifies that the given port on the local (client) host is to be 557forwarded to the given host and port on the remote side. 558This works by allocating a socket to listen to 559.Ar port 560on the local side, and whenever a connection is made to this port, the 561connection is forwarded over the secure channel, and a connection is 562made to 563.Ar host 564port 565.Ar hostport 566from the remote machine. 567Port forwardings can also be specified in the configuration file. 568Only root can forward privileged ports. 569IPv6 addresses can be specified with an alternative syntax: 570.Ar port/host/hostport 571.It Fl R Ar port:host:hostport 572Specifies that the given port on the remote (server) host is to be 573forwarded to the given host and port on the local side. 574This works by allocating a socket to listen to 575.Ar port 576on the remote side, and whenever a connection is made to this port, the 577connection is forwarded over the secure channel, and a connection is 578made to 579.Ar host 580port 581.Ar hostport 582from the local machine. 583Port forwardings can also be specified in the configuration file. 584Privileged ports can be forwarded only when 585logging in as root on the remote machine. 586IPv6 addresses can be specified with an alternative syntax: 587.Ar port/host/hostport 588.It Fl 1 589Forces 590.Nm 591to try protocol version 1 only. 592.It Fl 2 593Forces 594.Nm 595to try protocol version 2 only. 596.It Fl 4 597Forces 598.Nm 599to use IPv4 addresses only. 600.It Fl 6 601Forces 602.Nm 603to use IPv6 addresses only. 604.El 605.Sh CONFIGURATION FILES 606.Nm 607obtains configuration data from the following sources (in this order): 608command line options, user's configuration file 609.Pq Pa $HOME/.ssh/config , 610and system-wide configuration file 611.Pq Pa /etc/ssh/ssh_config . 612For each parameter, the first obtained value 613will be used. 614The configuration files contain sections bracketed by 615.Dq Host 616specifications, and that section is only applied for hosts that 617match one of the patterns given in the specification. 618The matched host name is the one given on the command line. 619.Pp 620Since the first obtained value for each parameter is used, more 621host-specific declarations should be given near the beginning of the 622file, and general defaults at the end. 623.Pp 624The configuration file has the following format: 625.Pp 626Empty lines and lines starting with 627.Ql # 628are comments. 629.Pp 630Otherwise a line is of the format 631.Dq keyword arguments . 632The possible 633keywords and their meanings are as follows (note that the 634configuration files are case-sensitive): 635.Bl -tag -width Ds 636.It Cm Host 637Restricts the following declarations (up to the next 638.Cm Host 639keyword) to be only for those hosts that match one of the patterns 640given after the keyword. 641.Ql \&* 642and 643.Ql ? 644can be used as wildcards in the 645patterns. 646A single 647.Ql \&* 648as a pattern can be used to provide global 649defaults for all hosts. 650The host is the 651.Ar hostname 652argument given on the command line (i.e., the name is not converted to 653a canonicalized host name before matching). 654.It Cm AFSTokenPassing 655Specifies whether to pass AFS tokens to remote host. 656The argument to this keyword must be 657.Dq yes 658or 659.Dq no . 660This option applies to protocol version 1 only. 661.It Cm BatchMode 662If set to 663.Dq yes , 664passphrase/password querying will be disabled. 665This option is useful in scripts and other batch jobs where you have no 666user to supply the password. 667The argument must be 668.Dq yes 669or 670.Dq no . 671The default is 672.Dq no . 673.It Cm CheckHostIP 674If this flag is set to 675.Dq yes , 676ssh will additionally check the host IP address in the 677.Pa known_hosts 678file. 679This allows ssh to detect if a host key changed due to DNS spoofing. 680If the option is set to 681.Dq no , 682the check will not be executed. 683The default is 684.Dq yes . 685.It Cm Cipher 686Specifies the cipher to use for encrypting the session 687in protocol version 1. 688Currently, 689.Dq blowfish 690and 691.Dq 3des 692are supported. 693The default is 694.Dq 3des . 695.It Cm Ciphers 696Specifies the ciphers allowed for protocol version 2 697in order of preference. 698Multiple ciphers must be comma-separated. 699The default is 700.Pp 701.Bd -literal 702 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour, 703 aes192-cbc,aes256-cbc'' 704.Ed 705.It Cm Compression 706Specifies whether to use compression. 707The argument must be 708.Dq yes 709or 710.Dq no . 711The default is 712.Dq no . 713.It Cm CompressionLevel 714Specifies the compression level to use if compression is enabled. 715The argument must be an integer from 1 (fast) to 9 (slow, best). 716The default level is 6, which is good for most applications. 717The meaning of the values is the same as in 718.Xr gzip 1 . 719Note that this option applies to protocol version 1 only. 720.It Cm ConnectionAttempts 721Specifies the number of tries (one per second) to make before falling 722back to rsh or exiting. 723The argument must be an integer. 724This may be useful in scripts if the connection sometimes fails. 725The default is 4. 726.It Cm EscapeChar 727Sets the escape character (default: 728.Ql ~ ) . 729The escape character can also 730be set on the command line. 731The argument should be a single character, 732.Ql ^ 733followed by a letter, or 734.Dq none 735to disable the escape 736character entirely (making the connection transparent for binary 737data). 738.It Cm FallBackToRsh 739Specifies that if connecting via 740.Nm 741fails due to a connection refused error (there is no 742.Xr sshd 8 743listening on the remote host), 744.Xr rsh 1 745should automatically be used instead (after a suitable warning about 746the session being unencrypted). 747The argument must be 748.Dq yes 749or 750.Dq no . 751The default is 752.Dq no . 753.It Cm ForwardAgent 754Specifies whether the connection to the authentication agent (if any) 755will be forwarded to the remote machine. 756The argument must be 757.Dq yes 758or 759.Dq no . 760The default is 761.Dq no . 762.It Cm ForwardX11 763Specifies whether X11 connections will be automatically redirected 764over the secure channel and 765.Ev DISPLAY 766set. 767The argument must be 768.Dq yes 769or 770.Dq no . 771The default is 772.Dq no . 773.It Cm GatewayPorts 774Specifies whether remote hosts are allowed to connect to local 775forwarded ports. 776The argument must be 777.Dq yes 778or 779.Dq no . 780The default is 781.Dq no . 782.It Cm GlobalKnownHostsFile 783Specifies a file to use for the protocol version 1 global 784host key database instead of 785.Pa /etc/ssh/ssh_known_hosts . 786.It Cm GlobalKnownHostsFile2 787Specifies a file to use for the protocol version 2 global 788host key database instead of 789.Pa /etc/ssh/ssh_known_hosts2 . 790.It Cm HostbasedAuthentication 791Specifies whether to try rhosts based authentication with public key 792authentication. 793The argument must be 794.Dq yes 795or 796.Dq no . 797The default is 798.Dq yes . 799This option applies to protocol version 2 only and 800is similar to 801.Cm RhostsRSAAuthentication . 802.It Cm HostKeyAlgorithms 803Specfies the protocol version 2 host key algorithms 804that the client wants to use in order of preference. 805The default for this option is: 806.Dq ssh-rsa,ssh-dss 807.It Cm HostKeyAlias 808Specifies an alias that should be used instead of the 809real host name when looking up or saving the host key 810in the host key database files. 811This option is useful for tunneling ssh connections 812or if you have multiple servers running on a single host. 813>>>>>>> 1.1.1.7 814.It Cm HostName 815Specifies the real host name to log into. 816This can be used to specify nicknames or abbreviations for hosts. 817Default is the name given on the command line. 818Numeric IP addresses are also permitted (both on the command line and in 819.Cm HostName 820specifications). 821.It Cm IdentityFile 822Specifies the file from which the user's RSA or DSA authentication identity 823is read (default 824.Pa $HOME/.ssh/identity 825in the user's home directory). 826Additionally, any identities represented by the authentication agent 827will be used for authentication. 828The file name may use the tilde 829syntax to refer to a user's home directory. 830It is possible to have 831multiple identity files specified in configuration files; all these 832identities will be tried in sequence. 833.It Cm KeepAlive 834Specifies whether the system should send keepalive messages to the 835other side. 836If they are sent, death of the connection or crash of one 837of the machines will be properly noticed. 838However, this means that 839connections will die if the route is down temporarily, and some people 840find it annoying. 841.Pp 842The default is 843.Dq yes 844(to send keepalives), and the client will notice 845if the network goes down or the remote host dies. 846This is important in scripts, and many users want it too. 847.Pp 848To disable keepalives, the value should be set to 849.Dq no 850in both the server and the client configuration files. 851.It Cm KerberosAuthentication 852Specifies whether Kerberos authentication will be used. 853The argument to this keyword must be 854.Dq yes 855or 856.Dq no . 857.It Cm KerberosTgtPassing 858Specifies whether a Kerberos TGT will be forwarded to the server. 859This will only work if the Kerberos server is actually an AFS kaserver. 860The argument to this keyword must be 861.Dq yes 862or 863.Dq no . 864.It Cm LocalForward 865Specifies that a TCP/IP port on the local machine be forwarded over 866the secure channel to given host:port from the remote machine. 867The first argument must be a port number, and the second must be 868host:port. 869Multiple forwardings may be specified, and additional 870forwardings can be given on the command line. 871Only the superuser can forward privileged ports. 872.It Cm LogLevel 873Gives the verbosity level that is used when logging messages from 874.Nm ssh . 875The possible values are: 876QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG. 877The default is INFO. 878.It Cm MACs 879Specifies the MAC (message authentication code) algorithms 880in order of preference. 881The MAC algorithm is used in protocol version 2 882for data integrity protection. 883Multiple algorithms must be comma-separated. 884The default is 885.Pp 886.Bd -literal 887 ``hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com, 888 hmac-sha1-96,hmac-md5-96'' 889.Ed 890.It Cm NumberOfPasswordPrompts 891Specifies the number of password prompts before giving up. 892The argument to this keyword must be an integer. 893Default is 3. 894.It Cm PasswordAuthentication 895Specifies whether to use password authentication. 896The argument to this keyword must be 897.Dq yes 898or 899.Dq no . 900The default is 901.Dq yes . 902.It Cm Port 903Specifies the port number to connect on the remote host. 904Default is 22. 905.It Cm PreferredAuthentications 906Specifies the order in which the client should try protocol 2 907authentication methods. This allows a client to prefer one method (e.g. 908.Cm keyboard-interactive ) 909over another method (e.g. 910.Cm password ) 911The default for this option is: 912.Dq publickey, password, keyboard-interactive 913.It Cm Protocol 914Specifies the protocol versions 915.Nm 916should support in order of preference. 917The possible values are 918.Dq 1 919and 920.Dq 2 . 921Multiple versions must be comma-separated. 922The default is 923.Dq 2,1 . 924This means that 925.Nm 926tries version 2 and falls back to version 1 927if version 2 is not available. 928.It Cm ProxyCommand 929Specifies the command to use to connect to the server. 930The command 931string extends to the end of the line, and is executed with 932.Pa /bin/sh . 933In the command string, 934.Ql %h 935will be substituted by the host name to 936connect and 937.Ql %p 938by the port. 939The command can be basically anything, 940and should read from its standard input and write to its standard output. 941It should eventually connect an 942.Xr sshd 8 943server running on some machine, or execute 944.Ic sshd -i 945somewhere. 946Host key management will be done using the 947HostName of the host being connected (defaulting to the name typed by 948the user). 949Note that 950.Cm CheckHostIP 951is not available for connects with a proxy command. 952.Pp 953.It Cm PubkeyAuthentication 954Specifies whether to try public key authentication. 955The argument to this keyword must be 956.Dq yes 957or 958.Dq no . 959The default is 960.Dq yes . 961This option applies to protocol version 2 only. 962.It Cm RemoteForward 963Specifies that a TCP/IP port on the remote machine be forwarded over 964the secure channel to given host:port from the local machine. 965The first argument must be a port number, and the second must be 966host:port. 967Multiple forwardings may be specified, and additional 968forwardings can be given on the command line. 969Only the superuser can forward privileged ports. 970.It Cm RhostsAuthentication 971Specifies whether to try rhosts based authentication. 972Note that this 973declaration only affects the client side and has no effect whatsoever 974on security. 975Disabling rhosts authentication may reduce 976authentication time on slow connections when rhosts authentication is 977not used. 978Most servers do not permit RhostsAuthentication because it 979is not secure (see 980.Cm RhostsRSAAuthentication ). 981The argument to this keyword must be 982.Dq yes 983or 984.Dq no . 985The default is 986.Dq yes . 987This option applies to protocol version 1 only. 988.It Cm RhostsRSAAuthentication 989Specifies whether to try rhosts based authentication with RSA host 990authentication. 991The argument must be 992.Dq yes 993or 994.Dq no . 995The default is 996.Dq yes . 997This option applies to protocol version 1 only. 998.It Cm RSAAuthentication 999Specifies whether to try RSA authentication. 1000The argument to this keyword must be 1001.Dq yes 1002or 1003.Dq no . 1004RSA authentication will only be 1005attempted if the identity file exists, or an authentication agent is 1006running. 1007The default is 1008.Dq yes . 1009Note that this option applies to protocol version 1 only. 1010.It Cm ChallengeResponseAuthentication 1011Specifies whether to use challenge response authentication. 1012Currently there is only support for 1013.Xr skey 1 1014authentication. 1015The argument to this keyword must be 1016.Dq yes 1017or 1018.Dq no . 1019The default is 1020.Dq no . 1021.It Cm StrictHostKeyChecking 1022If this flag is set to 1023.Dq yes , 1024.Nm 1025will never automatically add host keys to the 1026.Pa $HOME/.ssh/known_hosts 1027and 1028.Pa $HOME/.ssh/known_hosts2 1029files, and refuses to connect to hosts whose host key has changed. 1030This provides maximum protection against trojan horse attacks. 1031However, it can be somewhat annoying if you don't have good 1032.Pa /etc/ssh/ssh_known_hosts 1033and 1034.Pa /etc/ssh/ssh_known_hosts2 1035files installed and frequently 1036connect to new hosts. 1037This option forces the user to manually 1038add all new hosts. 1039If this flag is set to 1040.Dq no , 1041.Nm 1042will automatically add new host keys to the 1043user known hosts files. 1044If this flag is set to 1045.Dq ask , 1046new host keys 1047will be added to the user known host files only after the user 1048has confirmed that is what they really want to do, and 1049.Nm 1050will refuse to connect to hosts whose host key has changed. 1051The host keys of 1052known hosts will be verified automatically in all cases. 1053The argument must be 1054.Dq yes , 1055.Dq no 1056or 1057.Dq ask . 1058The default is 1059.Dq ask . 1060.It Cm UsePrivilegedPort 1061Specifies whether to use a privileged port for outgoing connections. 1062The argument must be 1063.Dq yes 1064or 1065.Dq no . 1066The default is 1067.Dq no . 1068Note that you need to set this option to 1069.Dq yes 1070if you want to use 1071.Cm RhostsAuthentication 1072and 1073.Cm RhostsRSAAuthentication 1074with older servers. 1075.It Cm User 1076Specifies the user to log in as. 1077This can be useful if you have a different user name on different machines. 1078This saves the trouble of 1079having to remember to give the user name on the command line. 1080.It Cm UserKnownHostsFile 1081Specifies a file to use for the protocol version 1 user 1082host key database instead of 1083.Pa $HOME/.ssh/known_hosts . 1084.It Cm UserKnownHostsFile2 1085Specifies a file to use for the protocol version 2 user 1086host key database instead of 1087.Pa $HOME/.ssh/known_hosts2 . 1088.It Cm UseRsh 1089Specifies that rlogin/rsh should be used for this host. 1090It is possible that the host does not at all support the 1091.Nm 1092protocol. 1093This causes 1094.Nm 1095to immediately execute 1096.Xr rsh 1 . 1097All other options (except 1098.Cm HostName ) 1099are ignored if this has been specified. 1100The argument must be 1101.Dq yes 1102or 1103.Dq no . 1104.It Cm XAuthLocation 1105Specifies the location of the 1106.Xr xauth 1 1107program. 1108The default is 1109.Pa /usr/X11R6/bin/xauth . 1110.El 1111.Sh ENVIRONMENT 1112.Nm 1113will normally set the following environment variables: 1114.Bl -tag -width Ds 1115.It Ev DISPLAY 1116The 1117.Ev DISPLAY 1118variable indicates the location of the X11 server. 1119It is automatically set by 1120.Nm 1121to point to a value of the form 1122.Dq hostname:n 1123where hostname indicates 1124the host where the shell runs, and n is an integer \*(>= 1. 1125.Nm 1126uses this special value to forward X11 connections over the secure 1127channel. 1128The user should normally not set 1129.Ev DISPLAY 1130explicitly, as that 1131will render the X11 connection insecure (and will require the user to 1132manually copy any required authorization cookies). 1133.It Ev HOME 1134Set to the path of the user's home directory. 1135.It Ev LOGNAME 1136Synonym for 1137.Ev USER ; 1138set for compatibility with systems that use this variable. 1139.It Ev MAIL 1140Set to point the user's mailbox. 1141.It Ev PATH 1142Set to the default 1143.Ev PATH , 1144as specified when compiling 1145.Nm ssh . 1146.It Ev SSH_AUTH_SOCK 1147indicates the path of a unix-domain socket used to communicate with the 1148agent. 1149.It Ev SSH_CLIENT 1150Identifies the client end of the connection. 1151The variable contains 1152three space-separated values: client ip-address, client port number, 1153and server port number. 1154.It Ev SSH_ORIGINAL_COMMAND 1155The variable contains the original command line if a forced command 1156is executed. 1157It can be used to extract the original arguments. 1158.It Ev SSH_TTY 1159This is set to the name of the tty (path to the device) associated 1160with the current shell or command. 1161If the current session has no tty, 1162this variable is not set. 1163.It Ev TZ 1164The timezone variable is set to indicate the present timezone if it 1165was set when the daemon was started (i.e., the daemon passes the value 1166on to new connections). 1167.It Ev USER 1168Set to the name of the user logging in. 1169.El 1170.Pp 1171Additionally, 1172.Nm 1173reads 1174.Pa $HOME/.ssh/environment , 1175and adds lines of the format 1176.Dq VARNAME=value 1177to the environment. 1178.Sh FILES 1179.Bl -tag -width Ds 1180.It Pa $HOME/.ssh/known_hosts, $HOME/.ssh/known_hosts2 1181Records host keys for all hosts the user has logged into (that are not 1182in 1183.Pa /etc/ssh/ssh_known_hosts 1184for protocol version 1 or 1185.Pa /etc/ssh/ssh_known_hosts2 1186for protocol version 2). 1187See 1188.Xr sshd 8 . 1189.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa 1190Contains the authentication identity of the user. 1191They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively. 1192These files 1193contain sensitive data and should be readable by the user but not 1194accessible by others (read/write/execute). 1195Note that 1196.Nm 1197ignores a private key file if it is accessible by others. 1198It is possible to specify a passphrase when 1199generating the key; the passphrase will be used to encrypt the 1200sensitive part of this file using 3DES. 1201.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub 1202Contains the public key for authentication (public part of the 1203identity file in human-readable form). 1204The contents of the 1205.Pa $HOME/.ssh/identity.pub 1206file should be added to 1207.Pa $HOME/.ssh/authorized_keys 1208on all machines 1209where you wish to log in using protocol version 1 RSA authentication. 1210The contents of the 1211.Pa $HOME/.ssh/id_dsa.pub 1212and 1213.Pa $HOME/.ssh/id_rsa.pub 1214file should be added to 1215.Pa $HOME/.ssh/authorized_keys2 1216on all machines 1217where you wish to log in using protocol version 2 DSA/RSA authentication. 1218These files are not 1219sensitive and can (but need not) be readable by anyone. 1220These files are 1221never used automatically and are not necessary; they are only provided for 1222the convenience of the user. 1223.It Pa $HOME/.ssh/config 1224This is the per-user configuration file. 1225The format of this file is described above. 1226This file is used by the 1227.Nm 1228client. 1229This file does not usually contain any sensitive information, 1230but the recommended permissions are read/write for the user, and not 1231accessible by others. 1232.It Pa $HOME/.ssh/authorized_keys 1233Lists the RSA keys that can be used for logging in as this user. 1234The format of this file is described in the 1235.Xr sshd 8 1236manual page. 1237In the simplest form the format is the same as the .pub 1238identity files (that is, each line contains the number of bits in 1239modulus, public exponent, modulus, and comment fields, separated by 1240spaces). 1241This file is not highly sensitive, but the recommended 1242permissions are read/write for the user, and not accessible by others. 1243.It Pa $HOME/.ssh/authorized_keys2 1244Lists the public keys (RSA/DSA) that can be used for logging in as this user. 1245This file is not highly sensitive, but the recommended 1246permissions are read/write for the user, and not accessible by others. 1247.It Pa /etc/ssh/ssh_known_hosts, /etc/ssh/ssh_known_hosts2 1248Systemwide list of known host keys. 1249.Pa /etc/ssh/ssh_known_hosts 1250contains RSA and 1251.Pa /etc/ssh/ssh_known_hosts2 1252contains RSA or DSA keys for protocol version 2. 1253These files should be prepared by the 1254system administrator to contain the public host keys of all machines in the 1255organization. 1256This file should be world-readable. 1257This file contains 1258public keys, one per line, in the following format (fields separated 1259by spaces): system name, number of bits in modulus, public exponent, 1260modulus, and optional comment field. 1261When different names are used 1262for the same machine, all such names should be listed, separated by 1263commas. 1264The format is described on the 1265.Xr sshd 8 1266manual page. 1267.Pp 1268The canonical system name (as returned by name servers) is used by 1269.Xr sshd 8 1270to verify the client host when logging in; other names are needed because 1271.Nm 1272does not convert the user-supplied name to a canonical name before 1273checking the key, because someone with access to the name servers 1274would then be able to fool host authentication. 1275.It Pa /etc/ssh/ssh_config 1276Systemwide configuration file. 1277This file provides defaults for those 1278values that are not specified in the user's configuration file, and 1279for those users who do not have a configuration file. 1280This file must be world-readable. 1281.It Pa $HOME/.rhosts 1282This file is used in 1283.Pa \&.rhosts 1284authentication to list the 1285host/user pairs that are permitted to log in. 1286(Note that this file is 1287also used by rlogin and rsh, which makes using this file insecure.) 1288Each line of the file contains a host name (in the canonical form 1289returned by name servers), and then a user name on that host, 1290separated by a space. 1291On some machines this file may need to be 1292world-readable if the user's home directory is on a NFS partition, 1293because 1294.Xr sshd 8 1295reads it as root. 1296Additionally, this file must be owned by the user, 1297and must not have write permissions for anyone else. 1298The recommended 1299permission for most machines is read/write for the user, and not 1300accessible by others. 1301.Pp 1302Note that by default 1303.Xr sshd 8 1304will be installed so that it requires successful RSA host 1305authentication before permitting \s+2.\s0rhosts authentication. 1306If your server machine does not have the client's host key in 1307.Pa /etc/ssh/ssh_known_hosts , 1308you can store it in 1309.Pa $HOME/.ssh/known_hosts . 1310The easiest way to do this is to 1311connect back to the client from the server machine using ssh; this 1312will automatically add the host key to 1313.Pa $HOME/.ssh/known_hosts . 1314.It Pa $HOME/.shosts 1315This file is used exactly the same way as 1316.Pa \&.rhosts . 1317The purpose for 1318having this file is to be able to use rhosts authentication with 1319.Nm 1320without permitting login with 1321.Xr rlogin 1 1322or 1323.Xr rsh 1 . 1324.It Pa /etc/hosts.equiv 1325This file is used during 1326.Pa \&.rhosts 1327authentication. 1328It contains 1329canonical hosts names, one per line (the full format is described on 1330the 1331.Xr sshd 8 1332manual page). 1333If the client host is found in this file, login is 1334automatically permitted provided client and server user names are the 1335same. 1336Additionally, successful RSA host authentication is normally 1337required. 1338This file should only be writable by root. 1339.It Pa /etc/ssh/shosts.equiv 1340This file is processed exactly as 1341.Pa /etc/hosts.equiv . 1342This file may be useful to permit logins using 1343.Nm 1344but not using rsh/rlogin. 1345.It Pa /etc/ssh/sshrc 1346Commands in this file are executed by 1347.Nm 1348when the user logs in just before the user's shell (or command) is started. 1349See the 1350.Xr sshd 8 1351manual page for more information. 1352.It Pa $HOME/.ssh/rc 1353Commands in this file are executed by 1354.Nm 1355when the user logs in just before the user's shell (or command) is 1356started. 1357See the 1358.Xr sshd 8 1359manual page for more information. 1360.It Pa $HOME/.ssh/environment 1361Contains additional definitions for environment variables, see section 1362.Sx ENVIRONMENT 1363above. 1364.El 1365.Sh AUTHORS 1366OpenSSH is a derivative of the original and free 1367ssh 1.2.12 release by Tatu Ylonen. 1368Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, 1369Theo de Raadt and Dug Song 1370removed many bugs, re-added newer features and 1371created OpenSSH. 1372Markus Friedl contributed the support for SSH 1373protocol versions 1.5 and 2.0. 1374.Sh SEE ALSO 1375.Xr rlogin 1 , 1376.Xr rsh 1 , 1377.Xr scp 1 , 1378.Xr sftp 1 , 1379.Xr ssh-add 1 , 1380.Xr ssh-agent 1 , 1381.Xr ssh-keygen 1 , 1382.Xr telnet 1 , 1383.Xr sshd 8 1384.Rs 1385.%A T. Ylonen 1386.%A T. Kivinen 1387.%A M. Saarinen 1388.%A T. Rinne 1389.%A S. Lehtinen 1390.%T "SSH Protocol Architecture" 1391.%N draft-ietf-secsh-architecture-07.txt 1392.%D January 2001 1393.%O work in progress material 1394.Re 1395