1 '\" te
   2 .\" To view license terms, attribution, and copyright for OpenSSH, the default path is /var/sadm/pkg/SUNWsshdr/install/copyright. If the Solaris operating environment has been installed anywhere other than the default, modify the specified path to access the file at
   3 .\" the installed location.
   4 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
   5 .TH SSH 1 "May 20, 2009"
   6 .SH NAME
   7 ssh \- secure shell client (remote login program)
   8 .SH SYNOPSIS
   9 .LP
  10 .nf
  11 \fBssh\fR [\fB-l\fR \fIlogin_name\fR] \fIhostname\fR | \fIuser@hostname\fR [ \fIcommand\fR]
  12 .fi
  13 
  14 .LP
  15 .nf
  16 \fBssh\fR [\fB-afgknqstvxACNTX1246\fR] [\fB-b\fR \fIbind_address\fR] [\fB-m\fR \fImac_spec\fR]
  17      [\fB-c\fR \fIcipher_spec\fR] [\fB-e\fR \fIescape_char\fR] [\fB-i\fR \fIidentity_file\fR]
  18      [\fB-l\fR \fIlogin_name\fR] [\fB-F\fR \fIconfigfile\fR] [\fB-o\fR \fIoption\fR] [\fB-p\fR \fIport\fR]
  19      [\fB-L\fR [\fIbind_address\fR\fB:\fR]\fIport\fR\fB:\fR\fIhost\fR\fB:\fR\fIhostport\fR]
  20      [\fB-R\fR [\fIbind_address\fR\fB:\fR]\fIport\fR\fB:\fR\fIhost\fR\fB:\fR\fIhostport\fR]
  21      [\fB-D\fR [\fIbind_address\fR\fB:\fR]\fIport\fR] \fIhostname\fR | \fIuser\fR\fB@\fR\fIhostname\fR [\fIcommand\fR]
  22 .fi
  23 
  24 .SH DESCRIPTION
  25 .LP
  26 \fBssh\fR (Secure Shell) is a program for logging into a remote machine and for
  27 executing commands on a remote machine. It is intended to replace \fBrlogin\fR
  28 and \fBrsh\fR, and to provide secure encrypted communications between two
  29 untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP
  30 ports can also be forwarded over the secure channel.
  31 .sp
  32 .LP
  33 \fBssh\fR connects and logs into the specified hostname. The user must prove
  34 his or her identity to the remote machine using one of several methods
  35 depending on the protocol version used:
  36 .SS "SSH Protocol Version 1"
  37 .LP
  38 First, if the machine the user logs in from is listed in \fB/etc/hosts.equiv\fR
  39 or \fB/etc/shosts.equiv\fR on the remote machine, and the user names are the
  40 same on both sides, the user is immediately permitted to log in. Second,
  41 if .\fBrhosts\fR or \fB\&.shosts\fR exists in the user's home directory on the
  42 remote machine and contains a line containing the name of the client machine
  43 and the name of the user on that machine, the user is permitted to log in. This
  44 form of authentication alone is normally not allowed by the server because it
  45 is not secure.
  46 .sp
  47 .LP
  48 The second (and primary) authentication method is the \fBrhosts\fR or
  49 \fBhosts.equiv\fR method combined with RSA-based host authentication. It means
  50 that if the login would be permitted by \fB$HOME/.rhosts\fR,
  51 \fB$HOME/.shosts\fR, \fB/etc/hosts.equiv\fR, or \fB/etc/shosts.equiv\fR, and if
  52 additionally the server can verify the client's host key (see
  53 \fB/etc/ssh_known_hosts\fR in the FILES section), only then is login permitted.
  54 This authentication method closes security holes due to \fBIP\fR spoofing,
  55 \fBDNS\fR spoofing, and routing spoofing.
  56 .sp
  57 .LP
  58 \fBNote to the administrator:\fR \fB/etc/hosts.equiv\fR, \fB$HOME/.rhosts\fR,
  59 and the rlogin/rsh protocol in general, are inherently insecure and should be
  60 disabled if security is desired.
  61 .sp
  62 .LP
  63 As a third authentication method, \fBssh\fR supports \fBRSA\fR-based
  64 authentication. The scheme is based on public-key cryptography. There are
  65 cryptosystems where encryption and decryption are done using separate keys, and
  66 it is not possible to derive the decryption key from the encryption key.
  67 \fBRSA\fR is one such system. The idea is that each user creates a
  68 public/private key pair for authentication purposes. The server knows the
  69 public key, and only the user knows the private key. The file
  70 \fB$HOME/.ssh/authorized_keys\fR lists the public keys that are permitted for
  71 logging in. When the user logs in, the \fBssh\fR program tells the server which
  72 key pair it would like to use for authentication. The server checks if this key
  73 is permitted, and if so, sends the user (actually the \fBssh\fR program running
  74 on behalf of the user) a challenge in the form of a random number, encrypted by
  75 the user's public key. The challenge can only be decrypted using the proper
  76 private key. The user's client then decrypts the challenge using the private
  77 key, proving that he or she knows the private key but without disclosing it to
  78 the server.
  79 .sp
  80 .LP
  81 \fBssh\fR implements the \fBRSA\fR authentication protocol automatically. The
  82 user creates his or her \fBRSA\fR key pair by running \fBssh-keygen\fR(1). This
  83 stores the private key in \fB$HOME/.ssh/identity\fR and the public key in
  84 \fB$HOME/.ssh/identity.pub\fR in the user's home directory. The user should
  85 then copy the \fBidentity.pub\fR to \fB$HOME/.ssh/authorized_keys\fR in his or
  86 her home directory on the remote machine (the \fBauthorized_keys\fR file
  87 corresponds to the conventional \fB$HOME/.rhosts\fR file, and has one key per
  88 line, though the lines can be very long). After this, the user can log in
  89 without giving the password. \fBRSA\fR authentication is much more secure than
  90 \fBrhosts\fR authentication.
  91 .sp
  92 .LP
  93 The most convenient way to use \fBRSA\fR authentication can be with an
  94 authentication agent. See \fBssh-agent\fR(1) for more information.
  95 .sp
  96 .LP
  97 If other authentication methods fail, \fBssh\fR prompts the user for a
  98 password. The password is sent to the remote host for checking. However, since
  99 all communications are encrypted, the password cannot be seen by someone
 100 listening on the network.
 101 .SS "SSH Protocol Version 2"
 102 .LP
 103 The SSH version 2 protocol supports multiple user authentication methods, some
 104 of which are similar to those available with the SSH protocol version 1. These
 105 authentication mechanisms are negotiated by the client and server, with the
 106 client trying methods in the order specified in the
 107 \fBPreferredAuthentications\fR client configuration option. The server decides
 108 when enough authentication methods have passed successfully so as to complete
 109 the authentication phase of the protocol.
 110 .sp
 111 .LP
 112 When a user connects by using protocol version 2, similar authentication
 113 methods are available. Using the default values for
 114 \fBPreferredAuthentications\fR, the client tries to authenticate first by using
 115 the hostbased method. If this method fails, public key authentication is
 116 attempted. Finally, if this method fails, keyboard-interactive and password
 117 authentication are tried.
 118 .sp
 119 .LP
 120 The public key method is similar to \fBRSA\fR authentication described in the
 121 previous section and allows the \fBRSA\fR or \fBDSA\fR algorithm to be used:
 122 The client uses his or her private key, \fB$HOME/.ssh/id_dsa\fR or
 123 \fB$HOME/.ssh/id_rsa\fR, to sign the session identifier and sends the result to
 124 the server. The server checks whether the matching public key is listed in
 125 \fB$HOME/.ssh/authorized_keys\fR and grants access if both the key is found and
 126 the signature is correct. The session identifier is derived from a shared
 127 Diffie-Hellman value and is only known to the client and the server.
 128 .sp
 129 .LP
 130 If public key authentication fails or is not available, a password can be sent
 131 encrypted to the remote host for proving the user's identity, or an extended
 132 prompt/reply protocol can be engaged.
 133 .sp
 134 .LP
 135 Additionally, \fBssh\fR supports hostbased or challenge response
 136 authentication.
 137 .sp
 138 .LP
 139 Protocol 2 provides additional mechanisms for confidentiality (the traffic is
 140 encrypted using 3DES, Blowfish, CAST128 or Arcfour) and integrity
 141 (\fBhmac-sha1\fR, \fBhmac-md5\fR). Protocol 1 lacks a strong mechanism for
 142 ensuring the integrity of the connection.
 143 .SS "Login Session and Remote Execution"
 144 .LP
 145 When the user's identity has been accepted by the server, the server either
 146 executes the specified command, or logs into the machine and gives the user a
 147 normal shell on the remote machine. All communication with the remote command
 148 or shell is automatically encrypted.
 149 .sp
 150 .LP
 151 If a pseudo-terminal has been allocated (normal login session), the user can
 152 use the escape characters noted below. If a pseudo-terminal has been allocated
 153 (normal login session), the user can disconnect with \fB~.\fR, and suspend
 154 \fBssh\fR with \fB~^Z\fR. All forwarded connections can be listed with
 155 \fB~#\fR. If the session blocks waiting for forwarded X11 or TCP/IP connections
 156 to terminate, \fBssh\fR can be backgrounded with \fB~&\fR, although this should
 157 not be used while the user shell is active, as it can cause the shell to hang.
 158 All available escapes can be listed with \fB~?\fR.
 159 .sp
 160 .LP
 161 A single tilde character can be sent as \fB~~\fR, or by following the tilde
 162 with a character other than those described above. The escape character must
 163 always follow a newline to be interpreted as special. The escape character can
 164 be changed in configuration files or on the command line.
 165 .sp
 166 .LP
 167 If no pseudo tty has been allocated, the session is transparent and can be used
 168 to reliably transfer binary data. On most systems, setting the escape character
 169 to "\fBnone\fR" also makes the session transparent even if a tty is used.
 170 .sp
 171 .LP
 172 The session terminates when the command or shell on the remote machine exits
 173 and all X11 and TCP/IP connections have been closed. The exit status of the
 174 remote program is returned as the exit status of \fBssh\fR.
 175 .SS "Escape Characters"
 176 .LP
 177 When a pseudo-terminal has been requested, \fBssh\fR supports a number of
 178 functions through the use of an escape character.
 179 .sp
 180 .LP
 181 A single tilde character can be sent as \fB~~\fR or by following the tilde with
 182 a character other than those described below. The escape character must always
 183 follow a newline to be interpreted as special. The escape character can be
 184 changed in configuration files using the \fBEscapeChar\fR configuration
 185 directive or on the command line by the \fB-e\fR option.
 186 .sp
 187 .LP
 188 The supported escapes, assuming the default \fB~\fR, are:
 189 .sp
 190 .ne 2
 191 .na
 192 \fB\fB~.\fR\fR
 193 .ad
 194 .RS 7n
 195 Disconnect.
 196 .RE
 197 
 198 .sp
 199 .ne 2
 200 .na
 201 \fB\fB~^Z\fR\fR
 202 .ad
 203 .RS 7n
 204 Background \fBssh\fR.
 205 .RE
 206 
 207 .sp
 208 .ne 2
 209 .na
 210 \fB\fB~#\fR\fR
 211 .ad
 212 .RS 7n
 213 List forwarded connections.
 214 .RE
 215 
 216 .sp
 217 .ne 2
 218 .na
 219 \fB\fB~&\fR\fR
 220 .ad
 221 .RS 7n
 222 Background \fBssh\fR at logout when waiting for forwarded connection / X11
 223 sessions to terminate.
 224 .RE
 225 
 226 .sp
 227 .ne 2
 228 .na
 229 \fB\fB~?\fR\fR
 230 .ad
 231 .RS 7n
 232 Display a list of escape characters.
 233 .RE
 234 
 235 .sp
 236 .ne 2
 237 .na
 238 \fB\fB~B\fR\fR
 239 .ad
 240 .RS 7n
 241 Send a break to the remote system. Only useful for SSH protocol version 2 and
 242 if the peer supports it.
 243 .RE
 244 
 245 .sp
 246 .ne 2
 247 .na
 248 \fB\fB~C\fR\fR
 249 .ad
 250 .RS 7n
 251 Open command line. Only useful for adding port forwardings using the \fB-L\fR
 252 and \fB-R\fR options).
 253 .RE
 254 
 255 .sp
 256 .ne 2
 257 .na
 258 \fB\fB~R\fR\fR
 259 .ad
 260 .RS 7n
 261 Request rekeying of the connection. Only useful for SSH protocol version 2 and
 262 if the peer supports it.
 263 .RE
 264 
 265 .SS "X11 and TCP Forwarding"
 266 .LP
 267 If the \fBForwardX11\fR variable is set to ``\fByes\fR'' (or, see the
 268 description of the \fB-X\fR and \fB-x\fR options described later) and the user
 269 is using X11 (the \fBDISPLAY\fR environment variable is set), the connection to
 270 the X11 display is automatically forwarded to the remote side in such a way
 271 that any X11 programs started from the shell (or command) goes through the
 272 encrypted channel, and the connection to the real X server is made from the
 273 local machine. The user should not manually set \fBDISPLAY\fR. Forwarding of
 274 X11 connections can be configured on the command line or in configuration
 275 files.
 276 .sp
 277 .LP
 278 The \fBDISPLAY\fR value set by \fBssh\fR points to the server machine, but with
 279 a display number greater than zero. This is normal behavior, because \fBssh\fR
 280 creates a "proxy" X11 server on the server machine for forwarding the
 281 connections over the encrypted channel.
 282 .sp
 283 .LP
 284 \fBssh\fR also automatically sets up \fBXauthority\fR data on the server
 285 machine. For this purpose, it generates a random authorization cookie, store it
 286 in \fBXauthority\fR on the server, and verify that any forwarded connections
 287 carry this cookie and replace it by the real cookie when the connection is
 288 opened. The real authentication cookie is never sent to the server machine (and
 289 no cookies are sent in the plain).
 290 .sp
 291 .LP
 292 If the \fBForwardAgent\fR variable is set to "\fByes\fR" (or, see the
 293 description of the \fB-A\fR and \fB-a\fR options described later) and the user
 294 is using an authentication agent, the connection to the agent is automatically
 295 forwarded to the remote side.
 296 .sp
 297 .LP
 298 Forwarding of arbitrary TCP/IP connections over the secure channel can be
 299 specified either on the command line or in a configuration file. One possible
 300 application of TCP/IP forwarding is a secure connection to an electronic purse.
 301 Another possible application is firewall traversal.
 302 .SS "Server Authentication"
 303 .LP
 304 \fBssh\fR automatically maintains and checks a database containing
 305 identifications for all hosts it has ever been used with. Host keys are stored
 306 in \fB$HOME/.ssh/known_hosts\fR in the user's home directory. Additionally, the
 307 file \fB/etc/ssh_known_hosts\fR is automatically checked for known hosts. The
 308 behavior of \fBssh\fR with respect to unknown host keys is controlled by the
 309 \fBStrictHostKeyChecking\fR parameter. If a host's identification ever changes,
 310 \fBssh\fR warns about this and disables password authentication to prevent a
 311 trojan horse from getting the user's password. Another purpose of this
 312 mechanism is to prevent attacks by intermediaries which could otherwise be used
 313 to circumvent the encryption. The \fBStrictHostKeyChecking\fR option can be
 314 used to prevent logins to machines whose host key is not known or has changed.
 315 .sp
 316 .LP
 317 However, when using key exchange protected by GSS-API, the server can advertise
 318 a host key. The client automatically adds this host key to its known hosts
 319 file, \fB$HOME/.ssh/known_hosts\fR, regardless of the setting of the
 320 \fBStrictHostKeyChecking\fR option, unless the advertised host key collides
 321 with an existing known hosts entry.
 322 .sp
 323 .LP
 324 When the user's GSS-API credentials expire, the client continues to be able to
 325 rekey the session using the server's public host key to protect the key
 326 exchanges.
 327 .SS "GSS-API User and Server Authentication"
 328 .LP
 329 \fBssh\fR uses the user's GSS-API credentials to authenticate the client to the
 330 server wherever possible, if \fBGssKeyEx\fR and/or \fBGssAuthentication\fR are
 331 set.
 332 .sp
 333 .LP
 334 With \fBGssKeyEx\fR, one can have an SSHv2 server that has no host public keys,
 335 so that only \fBGssKeyEx\fR can be used. With such servers, rekeying fails if
 336 the client's credentials are expired.
 337 .sp
 338 .LP
 339 GSS-API user authentication has the disadvantage that it does not obviate the
 340 need for SSH host keys, but its failure does not impact rekeying. \fBssh\fR can
 341 try other authentication methods (such as public key, password, and so on) if
 342 GSS-API authentication fails.
 343 .sp
 344 .LP
 345 Delegation of GSS-API credentials can be quite useful, but is not without
 346 danger. As with passwords, users should not delegate GSS credentials to
 347 untrusted servers, since a compromised server can use a user's delegated GSS
 348 credentials to impersonate the user.
 349 .sp
 350 .LP
 351 GSS-API user authorization is covered in \fBgss_auth_rules\fR(5).
 352 .sp
 353 .LP
 354 Rekeying can be used to redelegate credentials when \fBGssKeyEx\fR is
 355 "\fByes\fR". (See \fB~R\fR under \fBEscape Characters\fR above.)
 356 .SH OPTIONS
 357 .LP
 358 The following options are supported:
 359 .sp
 360 .ne 2
 361 .na
 362 \fB\fB-1\fR\fR
 363 .ad
 364 .sp .6
 365 .RS 4n
 366 Forces \fBssh\fR to try protocol version 1 only.
 367 .RE
 368 
 369 .sp
 370 .ne 2
 371 .na
 372 \fB\fB-2\fR\fR
 373 .ad
 374 .sp .6
 375 .RS 4n
 376 Forces \fBssh\fR to try protocol version 2 only.
 377 .RE
 378 
 379 .sp
 380 .ne 2
 381 .na
 382 \fB\fB-4\fR\fR
 383 .ad
 384 .sp .6
 385 .RS 4n
 386 Forces \fBssh\fR to use IPv4 addresses only.
 387 .RE
 388 
 389 .sp
 390 .ne 2
 391 .na
 392 \fB\fB-6\fR\fR
 393 .ad
 394 .sp .6
 395 .RS 4n
 396 Forces \fBssh\fR to use IPv6 addresses only.
 397 .RE
 398 
 399 .sp
 400 .ne 2
 401 .na
 402 \fB\fB-a\fR\fR
 403 .ad
 404 .sp .6
 405 .RS 4n
 406 Disables forwarding of the authentication agent connection.
 407 .RE
 408 
 409 .sp
 410 .ne 2
 411 .na
 412 \fB\fB-A\fR\fR
 413 .ad
 414 .sp .6
 415 .RS 4n
 416 Enables forwarding of the authentication agent connection. This can also be
 417 specified on a per-host basis in a configuration file.
 418 .sp
 419 Agent forwarding should be enabled with caution. Users with the ability to
 420 bypass file permissions on the remote host (for the agent's UNIX-domain socket)
 421 can access the local agent through the forwarded connection. An attacker cannot
 422 obtain key material from the agent. However, the attacker can perform
 423 operations on the keys that enable the attacker to authenticate using the
 424 identities loaded into the agent.
 425 .RE
 426 
 427 .sp
 428 .ne 2
 429 .na
 430 \fB\fB-b\fR \fIbind_address\fR\fR
 431 .ad
 432 .sp .6
 433 .RS 4n
 434 Specifies the interface to transmit from on machines with multiple interfaces
 435 or aliased addresses.
 436 .RE
 437 
 438 .sp
 439 .ne 2
 440 .na
 441 \fB\fB-c\fR \fIcipher_spec\fR\fR
 442 .ad
 443 .sp .6
 444 .RS 4n
 445 Selects the cipher specification for encrypting the session.
 446 .sp
 447 For protocol version 1, \fIcipher_spec\fR is a single cipher. See the
 448 \fBCipher\fR option in \fBssh_config\fR(4) for more information.
 449 .sp
 450 For protocol version 2, \fIcipher_spec\fR is a comma-separated list of ciphers
 451 listed in order of preference. See the \fICiphers\fR option in
 452 \fBssh_config\fR(4) for more information.
 453 .RE
 454 
 455 .sp
 456 .ne 2
 457 .na
 458 \fB\fB-C\fR\fR
 459 .ad
 460 .sp .6
 461 .RS 4n
 462 Requests compression of all data (including stdin, stdout, stderr, and data for
 463 forwarded X11 and TCP/IP connections). The compression algorithm is the same
 464 used by \fBgzip\fR(1). The \fBgzip\fR man page is available in the
 465 \fBSUNWsfman\fR package. The "level" can be controlled by the
 466 \fBCompressionLevel\fR option (see \fBssh_config\fR(4)). Compression is
 467 desirable on modem lines and other slow connections, but only slows down things
 468 on fast networks. The default value can be set on a host-by-host basis in the
 469 configuration files. See the \fBCompression\fR option in \fBssh_config\fR(4).
 470 .RE
 471 
 472 .sp
 473 .ne 2
 474 .na
 475 \fB\fB-D\fR [\fIbind_address\fR\fB:\fR]\fIport\fR\fR
 476 .ad
 477 .sp .6
 478 .RS 4n
 479 Specifies a local \fBdynamic\fR application-level port forwarding. This works
 480 by allocating a socket to listen to port on the local side, optionally bound to
 481 the specified \fIbind_address\fR. Whenever a connection is made to this port,
 482 the connection is forwarded over the secure channel. The application protocol
 483 is then used to determine where to connect to from the remote machine.
 484 Currently, the \fBSOCKS4\fR and \fBSOCKS5\fR protocols are supported and
 485 \fBssh\fR acts as a SOCKS server. Only a user with enough privileges can
 486 forward privileged ports. Dynamic port forwardings can also be specified in the
 487 configuration file.
 488 .sp
 489 IPv6 addresses can be specified with an alternative syntax:
 490 \fB[\fR\fIbind_address\fR\fB/]\fR\fIport\fR or by enclosing the address in
 491 square brackets. By default, the local port is bound in accordance with the
 492 \fBGatewayPorts\fR setting. However, an explicit \fIbind_address\fR can be used
 493 to bind the connection to a specific address. The \fIbind_address\fR of
 494 \fBlocalhost\fR indicates that the listening port be bound for local use only,
 495 while an empty address or \fB*\fR indicates that the port should be available
 496 from all interfaces.
 497 .RE
 498 
 499 .sp
 500 .ne 2
 501 .na
 502 \fB\fB-e\fR \fIch\fR | ^\fIch\fR | none\fR
 503 .ad
 504 .sp .6
 505 .RS 4n
 506 Sets the escape character for sessions with a pty (default: `\fB~\fR'). The
 507 escape character is only recognized at the beginning of a line. The escape
 508 character followed by a dot (\fB\&.\fR) closes the connection. If followed by
 509 CTRL-z, the escape character suspends the connection. If followed by itself,
 510 the escape character sends itself once. Setting the character to \fBnone\fR
 511 disables any escapes and makes the session fully transparent.
 512 .RE
 513 
 514 .sp
 515 .ne 2
 516 .na
 517 \fB\fB-f\fR\fR
 518 .ad
 519 .sp .6
 520 .RS 4n
 521 Requests \fBssh\fR to go to background just before command execution. This is
 522 useful if \fBssh\fR is going to ask for passwords or passphrases, but the user
 523 wants it in the background. This implies the \fB-n\fR option. The recommended
 524 way to start X11 programs at a remote site is with something like \fBssh\fR
 525 \fB-f\fR \fIhost\fR \fIxterm\fR.
 526 .RE
 527 
 528 .sp
 529 .ne 2
 530 .na
 531 \fB\fB-F\fR \fIconfigfile\fR\fR
 532 .ad
 533 .sp .6
 534 .RS 4n
 535 Specifies an alternative per-user configuration file. If a configuration file
 536 is specified on the command line, the system-wide configuration file,
 537 \fB/etc/ssh_config\fR, is ignored. The default for the per-user configuration
 538 file is \fB$HOME/.ssh/config\fR.
 539 .RE
 540 
 541 .sp
 542 .ne 2
 543 .na
 544 \fB\fB-g\fR\fR
 545 .ad
 546 .sp .6
 547 .RS 4n
 548 Allows remote hosts to connect to local forwarded ports.
 549 .RE
 550 
 551 .sp
 552 .ne 2
 553 .na
 554 \fB\fB-i\fR \fIidentity_file\fR\fR
 555 .ad
 556 .sp .6
 557 .RS 4n
 558 Selects a file from which the identity (private key) for \fBRSA\fR or \fBDSA\fR
 559 authentication is read. The default is \fB$HOME/.ssh/identity\fR for protocol
 560 version 1, and \fB$HOME/.ssh/id_rsa\fR and \fB$HOME/.ssh/id_dsa\fR for protocol
 561 version 2. Identity files can also be specified on a per-host basis in the
 562 configuration file. It is possible to have multiple \fB-i\fR options (and
 563 multiple identities specified in configuration files).
 564 .RE
 565 
 566 .sp
 567 .ne 2
 568 .na
 569 \fB\fB-l\fR \fIlogin_name\fR\fR
 570 .ad
 571 .sp .6
 572 .RS 4n
 573 Specifies the user to log in as on the remote machine. This also can be
 574 specified on a per-host basis in the configuration file.
 575 .RE
 576 
 577 .sp
 578 .ne 2
 579 .na
 580 \fB\fB-L\fR [\fIbind_address:\fR]\fIport\fR:\fIhost\fR:\fIhostport\fR\fR
 581 .ad
 582 .sp .6
 583 .RS 4n
 584 Specifies that the specified port on the local (client) host is to be forwarded
 585 to the specified host and port on the remote side. This works by allocating a
 586 socket to listen to the port on the local side, optionally bound to the
 587 specified \fIbind_address\fR. Then, whenever a connection is made to this port,
 588 the connection is forwarded over the secure channel and a connection is made to
 589 host port \fIhostport\fR from the remote machine. Port forwardings can also be
 590 specified in the configuration file. Only a user with enough privileges can
 591 forward privileged ports. IPv6 addresses can be specified with an alternative
 592 syntax: \fB[\fR\fIbind_address\fR\fB/]\fR\fIport\fR\fB/\fR\fIhost\fR\fB/\fR\fIh
 593 ostport\fR or by enclosing the address in square brackets.
 594 .sp
 595 By default, the local port is bound in accordance with the \fBGatewayPorts\fR
 596 setting. However, an explicit \fIbind_address\fR can be used to bind the
 597 connection to a specific address. The \fIbind_address\fR of \fBlocalhost\fR
 598 indicates that the listening port be bound for local use only, while an empty
 599 address or \fB*\fR indicates that the port should be available from all
 600 interfaces.
 601 .RE
 602 
 603 .sp
 604 .ne 2
 605 .na
 606 \fB\fB-m\fR \fImac_spec\fR\fR
 607 .ad
 608 .sp .6
 609 .RS 4n
 610 Additionally, for protocol version 2 a comma-separated list of \fBMAC\fR
 611 (message authentication code) algorithms can be specified in order of
 612 preference. See the MACs keyword for more information.
 613 .RE
 614 
 615 .sp
 616 .ne 2
 617 .na
 618 \fB\fB-n\fR\fR
 619 .ad
 620 .sp .6
 621 .RS 4n
 622 Redirects \fBstdin\fR from \fB/dev/null\fR (actually, prevents reading from
 623 \fBstdin\fR). This must be used when \fBssh\fR is run in the background. A
 624 common trick is to use this to run X11 programs on a remote machine. For
 625 example,
 626 .sp
 627 .in +2
 628 .nf
 629 ssh -n shadows.cs.hut.fi emacs &
 630 .fi
 631 .in -2
 632 .sp
 633 
 634 starts an \fBemacs\fR on \fBshadows.cs.hut.fi\fR, and the X11 connection is
 635 automatically forwarded over an encrypted channel. The \fBssh\fR program is put
 636 in the background. This does not work if \fBssh\fR needs to ask for a password
 637 or passphrase. See also the \fB-f\fR option.
 638 .RE
 639 
 640 .sp
 641 .ne 2
 642 .na
 643 \fB\fB-N\fR\fR
 644 .ad
 645 .sp .6
 646 .RS 4n
 647 Does not execute a remote command. This is useful if you just want to forward
 648 ports (protocol version 2 only).
 649 .RE
 650 
 651 .sp
 652 .ne 2
 653 .na
 654 \fB\fB-o\fR \fIoption\fR\fR
 655 .ad
 656 .sp .6
 657 .RS 4n
 658 Can be used to give options in the format used in the configuration file. This
 659 is useful for specifying options for which there is no separate command-line
 660 flag. The option has the same format as a line in the configuration file.
 661 .RE
 662 
 663 .sp
 664 .ne 2
 665 .na
 666 \fB\fB-p\fR \fIport\fR\fR
 667 .ad
 668 .sp .6
 669 .RS 4n
 670 Specifies the port to connect to on the remote host. This can be specified on a
 671 per-host basis in the configuration file.
 672 .RE
 673 
 674 .sp
 675 .ne 2
 676 .na
 677 \fB\fB-P\fR\fR
 678 .ad
 679 .sp .6
 680 .RS 4n
 681 Obsoleted option. SSHv1 connections from privileged ports are not supported.
 682 .RE
 683 
 684 .sp
 685 .ne 2
 686 .na
 687 \fB\fB-q\fR\fR
 688 .ad
 689 .sp .6
 690 .RS 4n
 691 Quiet mode. Causes all warning and diagnostic messages to be suppressed. Only
 692 fatal errors are displayed.
 693 .RE
 694 
 695 .sp
 696 .ne 2
 697 .na
 698 \fB\fB-R\fR [\fIbind_address\fR:]\fIport\fR:\fIhost\fR:\fIhostport\fR\fR
 699 .ad
 700 .sp .6
 701 .RS 4n
 702 Specifies that the specified port on the remote (server) host is to be
 703 forwarded to the specified host and port on the local side. This works by
 704 allocating a socket to listen to the port on the remote side. Then, whenever a
 705 connection is made to this port, the connection is forwarded over the secure
 706 channel and a connection is made to host port \fIhostport\fR from the local
 707 machine. Port forwardings can also be specified in the configuration file.
 708 Privileged ports can be forwarded only when logging in on the remote machine as
 709 a user with enough privileges.
 710 .sp
 711 IPv6 addresses can be specified by enclosing the address in square braces or
 712 using an alternative syntax: \fB[\fR\fIbind_address\fR\fB/]\fR\fIhost\fR\fB/\fR
 713 \fIport\fR\fB/\fR\fIhostport\fR.
 714 .sp
 715 By default, the listening socket on the server is bound to the loopback
 716 interface only. This can be overridden by specifying a \fIbind_address\fR. An
 717 empty \fIbind_address\fR, or the address \fB*\fR, indicates that the remote
 718 socket should listen on all interfaces. Specifying a remote \fIbind_address\fR
 719 only succeeds if the server's \fBGatewayPorts\fR option is enabled. See
 720 \fBsshd_config\fR(4).
 721 .RE
 722 
 723 .sp
 724 .ne 2
 725 .na
 726 \fB\fB-s\fR\fR
 727 .ad
 728 .sp .6
 729 .RS 4n
 730 Can be used to request invocation of a subsystem on the remote system.
 731 Subsystems are a feature of the SSH2 protocol which facilitate the use of SSH
 732 as a secure transport for other applications, for example, \fBsftp\fR. The
 733 subsystem is specified as the remote command.
 734 .RE
 735 
 736 .sp
 737 .ne 2
 738 .na
 739 \fB\fB-t\fR\fR
 740 .ad
 741 .sp .6
 742 .RS 4n
 743 Forces pseudo-tty allocation. This can be used to execute arbitrary
 744 screen-based programs on a remote machine, which can be very useful, for
 745 example, when implementing menu services. Multiple \fB-t\fR options force
 746 allocation, even if \fBssh\fR has no local \fBtty\fR.
 747 .RE
 748 
 749 .sp
 750 .ne 2
 751 .na
 752 \fB\fB-T\fR\fR
 753 .ad
 754 .sp .6
 755 .RS 4n
 756 Disables pseudo-tty allocation (protocol version 2 only).
 757 .RE
 758 
 759 .sp
 760 .ne 2
 761 .na
 762 \fB\fB-v\fR\fR
 763 .ad
 764 .sp .6
 765 .RS 4n
 766 Verbose mode. Causes \fBssh\fR to print debugging messages about its progress.
 767 This is helpful in debugging connection, authentication, and configuration
 768 problems. Multiple \fB-v\fR options increase the verbosity. Maximum is 3.
 769 .RE
 770 
 771 .sp
 772 .ne 2
 773 .na
 774 \fB\fB-x\fR\fR
 775 .ad
 776 .sp .6
 777 .RS 4n
 778 Disables X11 forwarding.
 779 .RE
 780 
 781 .sp
 782 .ne 2
 783 .na
 784 \fB\fB-X\fR\fR
 785 .ad
 786 .sp .6
 787 .RS 4n
 788 Enables X11 forwarding. This can also be specified on a per-host basis in a
 789 configuration file.
 790 .sp
 791 X11 forwarding should be enabled with caution. Users with the ability to bypass
 792 file permissions on the remote host (for the user's X authorization database)
 793 can access the local X11 display through the forwarded connection. An attacker
 794 can then be able to perform activities such as keystroke monitoring.
 795 .sp
 796 For this reason, X11 forwarding might be subjected to X11 SECURITY extension
 797 restrictions. Refer to the \fBForwardX11Trusted\fR directive in
 798 \fBssh_config\fR(4) for more information.
 799 .sp
 800 If X11 forwarding is enabled, remote X11 clients is trusted by default. This
 801 means that they have full access to the original X11 display.
 802 .RE
 803 
 804 .SH ENVIRONMENT VARIABLES
 805 .LP
 806 \fBssh\fR normally sets the following environment variables:
 807 .sp
 808 .ne 2
 809 .na
 810 \fB\fBDISPLAY\fR\fR
 811 .ad
 812 .sp .6
 813 .RS 4n
 814 The \fBDISPLAY\fR variable must be set for X11 display forwarding to work.
 815 .RE
 816 
 817 .sp
 818 .ne 2
 819 .na
 820 \fB\fBSSH_ASKPASS\fR\fR
 821 .ad
 822 .sp .6
 823 .RS 4n
 824 If \fBssh\fR needs a passphrase, it reads the passphrase from the current
 825 terminal if it was run from a terminal. If \fBssh\fR does not have a terminal
 826 associated with it but \fBDISPLAY\fR and \fBSSH_ASKPASS\fR are set, it executes
 827 the program specified by \fBSSH_ASKPASS\fR and opens an X11 window to read the
 828 passphrase. This is particularly useful when calling \fBssh\fR from a .Xsession
 829 or related script. On some machines it might be necessary to redirect the input
 830 from \fB/dev/null\fR to make this work. The system is shipped with
 831 \fB/usr/lib/ssh/ssh-askpass\fR which is the default value for \fBSSH_ASKPASS\fR
 832 .RE
 833 
 834 .sp
 835 .ne 2
 836 .na
 837 \fB\fBSSH_AUTH_SOCK\fR\fR
 838 .ad
 839 .sp .6
 840 .RS 4n
 841 Indicates the path of a unix-domain socket used to communicate with the agent.
 842 .RE
 843 
 844 .sp
 845 .ne 2
 846 .na
 847 \fB\fBSSH_LANGS\fR\fR
 848 .ad
 849 .sp .6
 850 .RS 4n
 851 A comma-separated list of IETF language tags (see RFC3066) indicating the
 852 languages that the user can read and write. Used for negotiation of the locale
 853 on the server.
 854 .RE
 855 
 856 .sp
 857 .ne 2
 858 .na
 859 \fB\fBLANG\fR, \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR,\fR
 860 .ad
 861 .br
 862 .na
 863 \fB\fBLC_MESSAGES\fR, \fBLC_MONETARY\fR, \fBLC_NUMERIC\fR, \fBLC_TIME\fR\fR
 864 .ad
 865 .sp .6
 866 .RS 4n
 867 The values of these environment variables can be set in remote sessions
 868 according to the locale settings on the client side and availability of support
 869 for those locales on the server side. Environment Variable Passing (see \fIRFC
 870 4254\fR) is used for passing them over to the server side.
 871 .RE
 872 
 873 .sp
 874 .LP
 875 See the \fBENVIRONMENT VARIABLES\fR section in the \fBsshd\fR(1M) man page for
 876 more information on how locale setting can be further changed depending on
 877 server side configuration.
 878 .SH EXIT STATUS
 879 .LP
 880 The status of the remote program is returned as the exit status of \fBssh\fR.
 881 \fB255\fR is returned if an error occurred at anytime during the \fBssh\fR
 882 connection, including the initial key exchange.
 883 .SH FILES
 884 .ne 2
 885 .na
 886 \fB\fB$HOME/.ssh/known_hosts\fR\fR
 887 .ad
 888 .RS 26n
 889 Records host keys for all hosts the user has logged into that are not in
 890 \fB/etc/ssh/ssh_known_hosts\fR. See \fBsshd\fR(1M).
 891 .RE
 892 
 893 .sp
 894 .ne 2
 895 .na
 896 \fB\fB$HOME/.ssh/identity\fR\fR
 897 .ad
 898 .br
 899 .na
 900 \fB\fB$HOME/.ssh/id_dsa\fR\fR
 901 .ad
 902 .br
 903 .na
 904 \fB\fB$HOME/.ssh/id_ssa\fR\fR
 905 .ad
 906 .RS 26n
 907 Contains the authentication identity of the user. These files are for protocol
 908 1 \fBRSA\fR, protocol 2 \fBDSA\fR, and protocol 2 \fBRSA\fR, respectively.
 909 These files contain sensitive data and should be readable by the user but not
 910 accessible by others (read/write/execute). \fBssh\fR ignores a private key file
 911 if it is accessible by others. It is possible to specify a passphrase when
 912 generating the key. The passphrase is used to encrypt the sensitive part of
 913 this file using \fB3DES\fR.
 914 .RE
 915 
 916 .sp
 917 .ne 2
 918 .na
 919 \fB\fB/etc/ssh/sshrc\fR\fR
 920 .ad
 921 .RS 26n
 922 Commands in this file are executed by \fBssh\fR when the user logs in just
 923 before the user's shell or command is started. See \fBsshd\fR(1M) for more
 924 information.
 925 .RE
 926 
 927 .sp
 928 .ne 2
 929 .na
 930 \fB\fB$HOME/.ssh/rc\fR\fR
 931 .ad
 932 .RS 26n
 933 Commands in this file are executed by \fBssh\fR when the user logs in just
 934 before the user's shell or command is started. See \fBsshd\fR(1M) for more
 935 information.
 936 .RE
 937 
 938 .sp
 939 .ne 2
 940 .na
 941 \fB\fB$HOME/.ssh/environment\fR\fR
 942 .ad
 943 .RS 26n
 944 Contains additional definitions for environment variables. See ENVIRONMENT
 945 VARIABLES.
 946 .RE
 947 
 948 .SH ATTRIBUTES
 949 .LP
 950 See \fBattributes\fR(5) for descriptions of the following attributes:
 951 .sp
 952 
 953 .sp
 954 .TS
 955 box;
 956 c | c
 957 l | l .
 958 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 959 _
 960 Interface Stability     See below.
 961 .TE
 962 
 963 .sp
 964 .LP
 965 The command line syntax is Committed. The remote locale selection through
 966 passing \fBLC_*\fR environment variables is Uncommitted.
 967 .SH SEE ALSO
 968 .LP
 969 \fBrlogin\fR(1), \fBrsh\fR(1), \fBscp\fR(1), \fBssh-add\fR(1),
 970 \fBssh-agent\fR(1), \fBssh-keygen\fR(1), \fBssh-http-proxy-connect\fR(1),
 971 \fBssh-socks5-proxy-connect\fR(1), \fBtelnet\fR(1), \fBsshd\fR(1M),
 972 \fBssh_config\fR(4), \fBsshd_config\fR(4), \fBattributes\fR(5),
 973 \fBgss_auth_rules\fR(5), \fBkerberos\fR(5), \fBprivileges\fR(5)
 974 .sp
 975 .LP
 976 \fIRFC 1928\fR
 977 .sp
 978 .LP
 979 \fIRFC 4254\fR