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