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