[BACK]Return to ssh.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Annotation of src/usr.bin/ssh/ssh.1, Revision 1.31

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