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