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