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

Diff for /src/usr.bin/ssh/sshd.8 between version 1.208 and 1.208.2.2

version 1.208, 2005/06/08 03:50:00 version 1.208.2.2, 2006/10/06 03:19:33
Line 56 
Line 56 
 .Ek  .Ek
 .Sh DESCRIPTION  .Sh DESCRIPTION
 .Nm  .Nm
 (SSH Daemon) is the daemon program for  (OpenSSH Daemon) is the daemon program for
 .Xr ssh 1 .  .Xr ssh 1 .
 Together these programs replace rlogin and rsh, and  Together these programs replace rlogin and rsh, and
 provide secure encrypted communications between two untrusted hosts  provide secure encrypted communications between two untrusted hosts
 over an insecure network.  over an insecure network.
 The programs are intended to be as easy to  
 install and use as possible.  
 .Pp  .Pp
 .Nm  .Nm
 is the daemon that listens for connections from clients.  listens for connections from clients.
 It is normally started at boot from  It is normally started at boot from
 .Pa /etc/rc .  .Pa /etc/rc .
 It forks a new  It forks a new
Line 73 
Line 71 
 The forked daemons handle  The forked daemons handle
 key exchange, encryption, authentication, command execution,  key exchange, encryption, authentication, command execution,
 and data exchange.  and data exchange.
 This implementation of  
 .Nm  
 supports both SSH protocol version 1 and 2 simultaneously.  
 .Nm  
 works as follows:  
 .Ss SSH protocol version 1  
 Each host has a host-specific RSA key  
 (normally 2048 bits) used to identify the host.  
 Additionally, when  
 the daemon starts, it generates a server RSA key (normally 768 bits).  
 This key is normally regenerated every hour if it has been used, and  
 is never stored on disk.  
 .Pp  .Pp
 Whenever a client connects, the daemon responds with its public  
 host and server keys.  
 The client compares the  
 RSA host key against its own database to verify that it has not changed.  
 The client then generates a 256-bit random number.  
 It encrypts this  
 random number using both the host key and the server key, and sends  
 the encrypted number to the server.  
 Both sides then use this  
 random number as a session key which is used to encrypt all further  
 communications in the session.  
 The rest of the session is encrypted  
 using a conventional cipher, currently Blowfish or 3DES, with 3DES  
 being used by default.  
 The client selects the encryption algorithm  
 to use from those offered by the server.  
 .Pp  
 Next, the server and the client enter an authentication dialog.  
 The client tries to authenticate itself using  
 .Em rhosts  
 authentication combined with RSA host  
 authentication, RSA challenge-response authentication, or password  
 based authentication.  
 .Pp  
 System security is not improved unless  
 .Nm rshd ,  
 .Nm rlogind ,  
 and  
 .Nm rexecd  
 are disabled (thus completely disabling  
 .Xr rlogin  
 and  
 .Xr rsh  
 into the machine).  
 .Ss SSH protocol version 2  
 Version 2 works similarly:  
 Each host has a host-specific key (RSA or DSA) used to identify the host.  
 However, when the daemon starts, it does not generate a server key.  
 Forward security is provided through a Diffie-Hellman key agreement.  
 This key agreement results in a shared session key.  
 .Pp  
 The rest of the session is encrypted using a symmetric cipher, currently  
 128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.  
 The client selects the encryption algorithm  
 to use from those offered by the server.  
 Additionally, session integrity is provided  
 through a cryptographic message authentication code  
 (hmac-sha1 or hmac-md5).  
 .Pp  
 Protocol version 2 provides a public key based  
 user (PubkeyAuthentication) or  
 client host (HostbasedAuthentication) authentication method,  
 conventional password authentication and challenge response based methods.  
 .Ss Command execution and data forwarding  
 If the client successfully authenticates itself, a dialog for  
 preparing the session is entered.  
 At this time the client may request  
 things like allocating a pseudo-tty, forwarding X11 connections,  
 forwarding TCP/IP connections, or forwarding the authentication agent  
 connection over the secure channel.  
 .Pp  
 Finally, the client either requests a shell or execution of a command.  
 The sides then enter session mode.  
 In this mode, either side may send  
 data at any time, and such data is forwarded to/from the shell or  
 command on the server side, and the user terminal in the client side.  
 .Pp  
 When the user program terminates and all forwarded X11 and other  
 connections have been closed, the server sends command exit status to  
 the client, and both sides exit.  
 .Pp  
 .Nm  .Nm
 can be configured using command-line options or a configuration file  can be configured using command-line options or a configuration file
 (by default  (by default
 .Xr sshd_config 5 ) .  .Xr sshd_config 5 ) ;
 Command-line options override values specified in the  command-line options override values specified in the
 configuration file.  configuration file.
 .Pp  
 .Nm  .Nm
 rereads its configuration file when it receives a hangup signal,  rereads its configuration file when it receives a hangup signal,
 .Dv SIGHUP ,  .Dv SIGHUP ,
 by executing itself with the name and options it was started with, e.g.,  by executing itself with the name and options it was started with, e.g.\&
 .Pa /usr/sbin/sshd .  .Pa /usr/sbin/sshd .
 .Pp  .Pp
 The options are as follows:  The options are as follows:
Line 240 
Line 154 
 from inetd because it needs to generate the server key before it can  from inetd because it needs to generate the server key before it can
 respond to the client, and this may take tens of seconds.  respond to the client, and this may take tens of seconds.
 Clients would have to wait too long if the key was regenerated every time.  Clients would have to wait too long if the key was regenerated every time.
 However, with small key sizes (e.g., 512) using  However, with small key sizes (e.g. 512) using
 .Nm  .Nm
 from inetd may  from inetd may
 be feasible.  be feasible.
Line 263 
Line 177 
 Specifies the port on which the server listens for connections  Specifies the port on which the server listens for connections
 (default 22).  (default 22).
 Multiple port options are permitted.  Multiple port options are permitted.
 Ports specified in the configuration file are ignored when a  Ports specified in the configuration file with the
 command-line port is specified.  .Cm Port
   option are ignored when a command-line port is specified.
   Ports specified using the
   .Cm ListenAddress
   option override command-line ports.
 .It Fl q  .It Fl q
 Quiet mode.  Quiet mode.
 Nothing is sent to the system log.  Nothing is sent to the system log.
Line 299 
Line 217 
 mechanism or configuration requires it.  mechanism or configuration requires it.
 Authentication mechanisms that may require DNS include  Authentication mechanisms that may require DNS include
 .Cm RhostsRSAAuthentication ,  .Cm RhostsRSAAuthentication ,
 .Cm HostbasedAuthentication  .Cm HostbasedAuthentication ,
 and using a  and using a
 .Cm from="pattern-list"  .Cm from="pattern-list"
 option in a key file.  option in a key file.
Line 309 
Line 227 
 or  or
 .Cm DenyUsers .  .Cm DenyUsers .
 .El  .El
 .Sh CONFIGURATION FILE  .Sh AUTHENTICATION
 .Nm  The OpenSSH SSH daemon supports SSH protocols 1 and 2.
 reads configuration data from  Both protocols are supported by default,
 .Pa /etc/ssh/sshd_config  though this can be changed via the
 (or the file specified with  .Cm Protocol
 .Fl f  option in
 on the command line).  
 The file format and configuration options are described in  
 .Xr sshd_config 5 .  .Xr sshd_config 5 .
   Protocol 2 supports both RSA and DSA keys;
   protocol 1 only supports RSA keys.
   For both protocols,
   each host has a host-specific key,
   normally 2048 bits,
   used to identify the host.
   .Pp
   Forward security for protocol 1 is provided through
   an additional server key,
   normally 768 bits,
   generated when the server starts.
   This key is normally regenerated every hour if it has been used, and
   is never stored on disk.
   Whenever a client connects, the daemon responds with its public
   host and server keys.
   The client compares the
   RSA host key against its own database to verify that it has not changed.
   The client then generates a 256-bit random number.
   It encrypts this
   random number using both the host key and the server key, and sends
   the encrypted number to the server.
   Both sides then use this
   random number as a session key which is used to encrypt all further
   communications in the session.
   The rest of the session is encrypted
   using a conventional cipher, currently Blowfish or 3DES, with 3DES
   being used by default.
   The client selects the encryption algorithm
   to use from those offered by the server.
   .Pp
   For protocol 2,
   forward security is provided through a Diffie-Hellman key agreement.
   This key agreement results in a shared session key.
   The rest of the session is encrypted using a symmetric cipher, currently
   128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.
   The client selects the encryption algorithm
   to use from those offered by the server.
   Additionally, session integrity is provided
   through a cryptographic message authentication code
   (hmac-sha1 or hmac-md5).
   .Pp
   Finally, the server and the client enter an authentication dialog.
   The client tries to authenticate itself using
   host-based authentication,
   public key authentication,
   challenge-response authentication,
   or password authentication.
   .Pp
   If the client successfully authenticates itself, a dialog for
   preparing the session is entered.
   At this time the client may request
   things like allocating a pseudo-tty, forwarding X11 connections,
   forwarding TCP connections, or forwarding the authentication agent
   connection over the secure channel.
   .Pp
   After this, the client either requests a shell or execution of a command.
   The sides then enter session mode.
   In this mode, either side may send
   data at any time, and such data is forwarded to/from the shell or
   command on the server side, and the user terminal in the client side.
   .Pp
   When the user program terminates and all forwarded X11 and other
   connections have been closed, the server sends command exit status to
   the client, and both sides exit.
 .Sh LOGIN PROCESS  .Sh LOGIN PROCESS
 When a user successfully logs in,  When a user successfully logs in,
 .Nm  .Nm
Line 364 
Line 344 
 .Dq rc  .Dq rc
 files are given the X11  files are given the X11
 authentication protocol and cookie in standard input.  authentication protocol and cookie in standard input.
   See
   .Sx SSHRC ,
   below.
 .It  .It
 Runs user's shell or command.  Runs user's shell or command.
 .El  .El
   .Sh SSHRC
   If the file
   .Pa ~/.ssh/rc
   exists,
   .Xr sh 1
   runs it after reading the
   environment files but before starting the user's shell or command.
   It must not produce any output on stdout; stderr must be used
   instead.
   If X11 forwarding is in use, it will receive the "proto cookie" pair in
   its standard input (and
   .Ev DISPLAY
   in its environment).
   The script must call
   .Xr xauth 1
   because
   .Nm
   will not run xauth automatically to add X11 cookies.
   .Pp
   The primary purpose of this file is to run any initialization routines
   which may be needed before the user's home directory becomes
   accessible; AFS is a particular example of such an environment.
   .Pp
   This file will probably contain some initialization code followed by
   something similar to:
   .Bd -literal -offset 3n
   if read proto cookie && [ -n "$DISPLAY" ]; then
           if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
                   # X11UseLocalhost=yes
                   echo add unix:`echo $DISPLAY |
                       cut -c11-` $proto $cookie
           else
                   # X11UseLocalhost=no
                   echo add $DISPLAY $proto $cookie
           fi | xauth -q -
   fi
   .Ed
   .Pp
   If this file does not exist,
   .Pa /etc/ssh/sshrc
   is run, and if that
   does not exist either, xauth is used to add the cookie.
 .Sh AUTHORIZED_KEYS FILE FORMAT  .Sh AUTHORIZED_KEYS FILE FORMAT
 .Pa ~/.ssh/authorized_keys  
 is the default file that lists the public keys that are  
 permitted for RSA authentication in protocol version 1  
 and for public key authentication (PubkeyAuthentication)  
 in protocol version 2.  
 .Cm AuthorizedKeysFile  .Cm AuthorizedKeysFile
 may be used to specify an alternative file.  specifies the file containing public keys for
 .Pp  public key authentication;
   if none is specified, the default is
   .Pa ~/.ssh/authorized_keys .
 Each line of the file contains one  Each line of the file contains one
 key (empty lines and lines starting with a  key (empty lines and lines starting with a
 .Ql #  .Ql #
 are ignored as  are ignored as
 comments).  comments).
 Each RSA public key consists of the following fields, separated by  Protocol 1 public keys consist of the following space-separated fields:
 spaces: options, bits, exponent, modulus, comment.  options, bits, exponent, modulus, comment.
 Each protocol version 2 public key consists of:  Protocol 2 public key consist of:
 options, keytype, base64 encoded key, comment.  options, keytype, base64-encoded key, comment.
 The options field  The options field is optional;
 is optional; its presence is determined by whether the line starts  its presence is determined by whether the line starts
 with a number or not (the options field never starts with a number).  with a number or not (the options field never starts with a number).
 The bits, exponent, modulus and comment fields give the RSA key for  The bits, exponent, modulus, and comment fields give the RSA key for
 protocol version 1; the  protocol version 1; the
 comment field is not used for anything (but may be convenient for the  comment field is not used for anything (but may be convenient for the
 user to identify the key).  user to identify the key).
Line 403 
Line 425 
 keys up to 16 kilobits.  keys up to 16 kilobits.
 You don't want to type them in; instead, copy the  You don't want to type them in; instead, copy the
 .Pa identity.pub ,  .Pa identity.pub ,
 .Pa id_dsa.pub  .Pa id_dsa.pub ,
 or the  or the
 .Pa id_rsa.pub  .Pa id_rsa.pub
 file and edit it.  file and edit it.
Line 418 
Line 440 
 The following option specifications are supported (note  The following option specifications are supported (note
 that option keywords are case-insensitive):  that option keywords are case-insensitive):
 .Bl -tag -width Ds  .Bl -tag -width Ds
 .It Cm from="pattern-list"  
 Specifies that in addition to public key authentication, the canonical name  
 of the remote host must be present in the comma-separated list of  
 patterns  
 .Pf ( Ql \&*  
 and  
 .Ql \&?  
 serve as wildcards).  
 The list may also contain  
 patterns negated by prefixing them with  
 .Ql \&! ;  
 if the canonical host name matches a negated pattern, the key is not accepted.  
 The purpose  
 of this option is to optionally increase security: public key authentication  
 by itself does not trust the network or name servers or anything (but  
 the key); however, if somebody somehow steals the key, the key  
 permits an intruder to log in from anywhere in the world.  
 This additional option makes using a stolen key more difficult (name  
 servers and/or routers would have to be compromised in addition to  
 just the key).  
 .It Cm command="command"  .It Cm command="command"
 Specifies that the command is executed whenever this key is used for  Specifies that the command is executed whenever this key is used for
 authentication.  authentication.
Line 451 
Line 453 
 This option might be useful  This option might be useful
 to restrict certain public keys to perform just a specific operation.  to restrict certain public keys to perform just a specific operation.
 An example might be a key that permits remote backups but nothing else.  An example might be a key that permits remote backups but nothing else.
 Note that the client may specify TCP/IP and/or X11  Note that the client may specify TCP and/or X11
 forwarding unless they are explicitly prohibited.  forwarding unless they are explicitly prohibited.
   The command originally supplied by the client is available in the
   .Ev SSH_ORIGINAL_COMMAND
   environment variable.
 Note that this option applies to shell, command or subsystem execution.  Note that this option applies to shell, command or subsystem execution.
 .It Cm environment="NAME=value"  .It Cm environment="NAME=value"
 Specifies that the string is to be added to the environment when  Specifies that the string is to be added to the environment when
Line 467 
Line 472 
 This option is automatically disabled if  This option is automatically disabled if
 .Cm UseLogin  .Cm UseLogin
 is enabled.  is enabled.
   .It Cm from="pattern-list"
   Specifies that in addition to public key authentication, the canonical name
   of the remote host must be present in the comma-separated list of
   patterns.
   The purpose
   of this option is to optionally increase security: public key authentication
   by itself does not trust the network or name servers or anything (but
   the key); however, if somebody somehow steals the key, the key
   permits an intruder to log in from anywhere in the world.
   This additional option makes using a stolen key more difficult (name
   servers and/or routers would have to be compromised in addition to
   just the key).
   .Pp
   See
   .Sx PATTERNS
   in
   .Xr ssh_config 5
   for more information on patterns.
   .It Cm no-agent-forwarding
   Forbids authentication agent forwarding when this key is used for
   authentication.
 .It Cm no-port-forwarding  .It Cm no-port-forwarding
 Forbids TCP/IP forwarding when this key is used for authentication.  Forbids TCP forwarding when this key is used for authentication.
 Any port forward requests by the client will return an error.  Any port forward requests by the client will return an error.
 This might be used, e.g., in connection with the  This might be used, e.g. in connection with the
 .Cm command  .Cm command
 option.  option.
   .It Cm no-pty
   Prevents tty allocation (a request to allocate a pty will fail).
 .It Cm no-X11-forwarding  .It Cm no-X11-forwarding
 Forbids X11 forwarding when this key is used for authentication.  Forbids X11 forwarding when this key is used for authentication.
 Any X11 forward requests by the client will return an error.  Any X11 forward requests by the client will return an error.
 .It Cm no-agent-forwarding  
 Forbids authentication agent forwarding when this key is used for  
 authentication.  
 .It Cm no-pty  
 Prevents tty allocation (a request to allocate a pty will fail).  
 .It Cm permitopen="host:port"  .It Cm permitopen="host:port"
 Limit local  Limit local
 .Li ``ssh -L''  .Li ``ssh -L''
Line 493 
Line 516 
 options may be applied separated by commas.  options may be applied separated by commas.
 No pattern matching is performed on the specified hostnames,  No pattern matching is performed on the specified hostnames,
 they must be literal domains or addresses.  they must be literal domains or addresses.
   .It Cm tunnel="n"
   Force a
   .Xr tun 4
   device on the server.
   Without this option, the next available device will be used if
   the client requests a tunnel.
 .El  .El
 .Ss Examples  
 1024 33 12121...312314325 ylo@foo.bar  
 .Pp  .Pp
 from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula  An example authorized_keys file:
 .Pp  .Bd -literal -offset 3n
 command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 backup.hut.fi  # Comments allowed at start of line
 .Pp  ssh-rsa AAAAB3Nza...LiPk== user@example.net
 permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23...2323  from="*.sales.example.net,!pc.sales.example.net" ssh-rsa
   AAAAB2...19Q== john@example.net
   command="dump /home",no-pty,no-port-forwarding ssh-dss
   AAAAC3...51R== example.net
   permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
   AAAAB5...21S==
   tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
   jane@example.net
   .Ed
 .Sh SSH_KNOWN_HOSTS FILE FORMAT  .Sh SSH_KNOWN_HOSTS FILE FORMAT
 The  The
 .Pa /etc/ssh/ssh_known_hosts  .Pa /etc/ssh/ssh_known_hosts
Line 510 
Line 545 
 files contain host public keys for all known hosts.  files contain host public keys for all known hosts.
 The global file should  The global file should
 be prepared by the administrator (optional), and the per-user file is  be prepared by the administrator (optional), and the per-user file is
 maintained automatically: whenever the user connects from an unknown host  maintained automatically: whenever the user connects from an unknown host,
 its key is added to the per-user file.  its key is added to the per-user file.
 .Pp  .Pp
 Each line in these files contains the following fields: hostnames,  Each line in these files contains the following fields: hostnames,
Line 518 
Line 553 
 The fields are separated by spaces.  The fields are separated by spaces.
 .Pp  .Pp
 Hostnames is a comma-separated list of patterns  Hostnames is a comma-separated list of patterns
 .Pf ( Ql \&*  .Pf ( Ql *
 and  and
 .Ql \&?  .Ql \&?
 act as  act as
Line 530 
Line 565 
 to indicate negation: if the host name matches a negated  to indicate negation: if the host name matches a negated
 pattern, it is not accepted (by that line) even if it matched another  pattern, it is not accepted (by that line) even if it matched another
 pattern on the line.  pattern on the line.
   A hostname or address may optionally be enclosed within
   .Ql \&[
   and
   .Ql \&]
   brackets then followed by
   .Ql \&:
   and a non-standard port number.
 .Pp  .Pp
 Alternately, hostnames may be stored in a hashed form which hides host names  Alternately, hostnames may be stored in a hashed form which hides host names
 and addresses should the file's contents be disclosed.  and addresses should the file's contents be disclosed.
Line 540 
Line 582 
 negation or wildcard operators may be applied.  negation or wildcard operators may be applied.
 .Pp  .Pp
 Bits, exponent, and modulus are taken directly from the RSA host key; they  Bits, exponent, and modulus are taken directly from the RSA host key; they
 can be obtained, e.g., from  can be obtained, for example, from
 .Pa /etc/ssh/ssh_host_key.pub .  .Pa /etc/ssh/ssh_host_key.pub .
 The optional comment field continues to the end of the line, and is not used.  The optional comment field continues to the end of the line, and is not used.
 .Pp  .Pp
Line 565 
Line 607 
 or by taking  or by taking
 .Pa /etc/ssh/ssh_host_key.pub  .Pa /etc/ssh/ssh_host_key.pub
 and adding the host names at the front.  and adding the host names at the front.
 .Ss Examples  .Pp
 .Bd -literal  An example ssh_known_hosts file:
 closenet,...,130.233.208.41 1024 37 159...93 closenet.hut.fi  .Bd -literal -offset 3n
 cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....=  # Comments allowed at start of line
 .Ed  closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
 .Bd -literal  cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
 # A hashed hostname  # A hashed hostname
 |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa  |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
 AAAA1234.....=  AAAA1234.....=
 .Ed  .Ed
 .Sh FILES  .Sh FILES
 .Bl -tag -width Ds  .Bl -tag -width Ds -compact
 .It Pa /etc/ssh/sshd_config  .It ~/.hushlogin
 Contains configuration data for  
 .Nm sshd .  
 The file format and configuration options are described in  
 .Xr sshd_config 5 .  
 .It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key  
 These three files contain the private parts of the host keys.  
 These files should only be owned by root, readable only by root, and not  
 accessible to others.  
 Note that  
 .Nm  
 does not start if this file is group/world-accessible.  
 .It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pub  
 These three files contain the public parts of the host keys.  
 These files should be world-readable but writable only by  
 root.  
 Their contents should match the respective private parts.  
 These files are not  
 really used for anything; they are provided for the convenience of  
 the user so their contents can be copied to known hosts files.  
 These files are created using  
 .Xr ssh-keygen 1 .  
 .It Pa /etc/moduli  
 Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".  
 The file format is described in  
 .Xr moduli 5 .  
 .It Pa /var/empty  
 .Xr chroot 2  
 directory used by  
 .Nm  
 during privilege separation in the pre-authentication phase.  
 The directory should not contain any files and must be owned by root  
 and not group or world-writable.  
 .It Pa /var/run/sshd.pid  
 Contains the process ID of the  
 .Nm  
 listening for connections (if there are several daemons running  
 concurrently for different ports, this contains the process ID of the one  
 started last).  
 The content of this file is not sensitive; it can be world-readable.  
 .It Pa ~/.ssh/authorized_keys  
 Lists the public keys (RSA or DSA) that can be used to log into the user's account.  
 This file must be readable by root (which may on some machines imply  
 it being world-readable if the user's home directory resides on an NFS  
 volume).  
 It is recommended that it not be accessible by others.  
 The format of this file is described above.  
 Users will place the contents of their  
 .Pa identity.pub ,  
 .Pa id_dsa.pub  
 and/or  
 .Pa id_rsa.pub  
 files into this file, as described in  
 .Xr ssh-keygen 1 .  
 .It Pa "/etc/ssh/ssh_known_hosts", "~/.ssh/known_hosts"  
 These files are consulted when using rhosts with RSA host  
 authentication or protocol version 2 hostbased authentication  
 to check the public key of the host.  
 The key must be listed in one of these files to be accepted.  
 The client uses the same files  
 to verify that it is connecting to the correct remote host.  
 These files should be writable only by root/the owner.  
 .Pa /etc/ssh/ssh_known_hosts  
 should be world-readable, and  
 .Pa ~/.ssh/known_hosts  
 can, but need not be, world-readable.  
 .It Pa /etc/motd  
 See  
 .Xr motd 5 .  
 .It Pa ~/.hushlogin  
 This file is used to suppress printing the last login time and  This file is used to suppress printing the last login time and
 .Pa /etc/motd ,  .Pa /etc/motd ,
 if  if
Line 657 
Line 630 
 are enabled.  are enabled.
 It does not suppress printing of the banner specified by  It does not suppress printing of the banner specified by
 .Cm Banner .  .Cm Banner .
 .It Pa /etc/nologin  .Pp
 If this file exists,  .It ~/.rhosts
   This file is used for host-based authentication (see
   .Xr ssh 1
   for more information).
   On some machines this file may need to be
   world-readable if the user's home directory is on an NFS partition,
   because
 .Nm  .Nm
 refuses to let anyone except root log in.  reads it as root.
 The contents of the file  Additionally, this file must be owned by the user,
 are displayed to anyone trying to log in, and non-root connections are  and must not have write permissions for anyone else.
 refused.  The recommended
 The file should be world-readable.  permission for most machines is read/write for the user, and not
 .It Pa /etc/hosts.allow, /etc/hosts.deny  
 Access controls that should be enforced by tcp-wrappers are defined here.  
 Further details are described in  
 .Xr hosts_access 5 .  
 .It Pa ~/.rhosts  
 This file is used during  
 .Cm RhostsRSAAuthentication  
 and  
 .Cm HostbasedAuthentication  
 and contains host-username pairs, separated by a space, one per  
 line.  
 The given user on the corresponding host is permitted to log in  
 without a password.  
 The same file is used by rlogind and rshd.  
 The file must  
 be writable only by the user; it is recommended that it not be  
 accessible by others.  accessible by others.
 .Pp  .Pp
 It is also possible to use netgroups in the file.  .It ~/.shosts
 Either host or user  This file is used in exactly the same way as
 name may be of the form +@groupname to specify all hosts or all users  .Pa .rhosts ,
 in the group.  but allows host-based authentication without permitting login with
 .It Pa ~/.shosts  rlogin/rsh.
 For ssh,  
 this file is exactly the same as for  
 .Pa .rhosts .  
 However, this file is  
 not used by rlogin and rshd, so using this permits access using SSH only.  
 .It Pa /etc/hosts.equiv  
 This file is used during  
 .Cm RhostsRSAAuthentication  
 and  
 .Cm HostbasedAuthentication  
 authentication.  
 In the simplest form, this file contains host names, one per line.  
 Users on  
 those hosts are permitted to log in without a password, provided they  
 have the same user name on both machines.  
 The host name may also be  
 followed by a user name; such users are permitted to log in as  
 .Em any  
 user on this machine (except root).  
 Additionally, the syntax  
 .Dq +@group  
 can be used to specify netgroups.  
 Negated entries start with  
 .Ql \&- .  
 .Pp  .Pp
 If the client host/user is successfully matched in this file, login is  .It ~/.ssh/authorized_keys
 automatically permitted provided the client and server user names are the  Lists the public keys (RSA/DSA) that can be used for logging in as this user.
 same.  The format of this file is described above.
 Additionally, successful client host key authentication is required.  The content of the file is not highly sensitive, but the recommended
 This file must be writable only by root; it is recommended  permissions are read/write for the user, and not accessible by others.
 that it be world-readable.  
 .Pp  .Pp
 .Sy "Warning: It is almost never a good idea to use user names in"  If this file, the
 .Pa hosts.equiv .  .Pa ~/.ssh
 Beware that it really means that the named user(s) can log in as  directory, or the user's home directory are writable
 .Em anybody ,  by other users, then the file could be modified or replaced by unauthorized
 which includes bin, daemon, adm, and other accounts that own critical  users.
 binaries and directories.  In this case,
 Using a user name practically grants the user root access.  .Nm
 The only valid use for user names that I can think  will not allow it to be used unless the
 of is in negative entries.  .Cm StrictModes
   option has been set to
   .Dq no .
   The recommended permissions can be set by executing
   .Dq chmod go-w ~/ ~/.ssh ~/.ssh/authorized_keys .
 .Pp  .Pp
 Note that this warning also applies to rsh/rlogin.  .It ~/.ssh/environment
 .It Pa /etc/shosts.equiv  
 This is processed exactly as  
 .Pa /etc/hosts.equiv .  
 However, this file may be useful in environments that want to run both  
 rsh/rlogin and ssh.  
 .It Pa ~/.ssh/environment  
 This file is read into the environment at login (if it exists).  This file is read into the environment at login (if it exists).
 It can only contain empty lines, comment lines (that start with  It can only contain empty lines, comment lines (that start with
 .Ql # ) ,  .Ql # ) ,
Line 747 
Line 683 
 controlled via the  controlled via the
 .Cm PermitUserEnvironment  .Cm PermitUserEnvironment
 option.  option.
 .It Pa ~/.ssh/rc  .Pp
 If this file exists, it is run with  .It ~/.ssh/known_hosts
 .Pa /bin/sh  Contains a list of host keys for all hosts the user has logged into
 after reading the  that are not already in the systemwide list of known host keys.
 environment files but before starting the user's shell or command.  The format of this file is described above.
 It must not produce any output on stdout; stderr must be used  This file should be writable only by root/the owner and
 instead.  can, but need not be, world-readable.
 If X11 forwarding is in use, it will receive the "proto cookie" pair in  .Pp
 its standard input (and  .It ~/.ssh/rc
 .Ev DISPLAY  Contains initialization routines to be run before
 in its environment).  the user's home directory becomes accessible.
 The script must call  This file should be writable only by the user, and need not be
 .Xr xauth 1  readable by anyone else.
 because  .Pp
   .It /etc/hosts.allow
   .It /etc/hosts.deny
   Access controls that should be enforced by tcp-wrappers are defined here.
   Further details are described in
   .Xr hosts_access 5 .
   .Pp
   .It /etc/hosts.equiv
   This file is for host-based authentication (see
   .Xr ssh 1 ) .
   It should only be writable by root.
   .Pp
   .It /etc/moduli
   Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
   The file format is described in
   .Xr moduli 5 .
   .Pp
   .It /etc/motd
   See
   .Xr motd 5 .
   .Pp
   .It /etc/nologin
   If this file exists,
 .Nm  .Nm
 will not run xauth automatically to add X11 cookies.  refuses to let anyone except root log in.
   The contents of the file
   are displayed to anyone trying to log in, and non-root connections are
   refused.
   The file should be world-readable.
 .Pp  .Pp
 The primary purpose of this file is to run any initialization routines  .It /etc/shosts.equiv
 which may be needed before the user's home directory becomes  This file is used in exactly the same way as
 accessible; AFS is a particular example of such an environment.  .Pa hosts.equiv ,
   but allows host-based authentication without permitting login with
   rlogin/rsh.
 .Pp  .Pp
 This file will probably contain some initialization code followed by  .It /etc/ssh/ssh_known_hosts
 something similar to:  Systemwide list of known host keys.
 .Bd -literal  This file should be prepared by the
 if read proto cookie && [ -n "$DISPLAY" ]; then  system administrator to contain the public host keys of all machines in the
         if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then  organization.
                 # X11UseLocalhost=yes  The format of this file is described above.
                 echo add unix:`echo $DISPLAY |  This file should be writable only by root/the owner and
                     cut -c11-` $proto $cookie  should be world-readable.
         else  
                 # X11UseLocalhost=no  
                 echo add $DISPLAY $proto $cookie  
         fi | xauth -q -  
 fi  
 .Ed  
 .Pp  .Pp
 If this file does not exist,  .It /etc/ssh/ssh_host_key
 .Pa /etc/ssh/sshrc  .It /etc/ssh/ssh_host_dsa_key
 is run, and if that  .It /etc/ssh/ssh_host_rsa_key
 does not exist either, xauth is used to add the cookie.  These three files contain the private parts of the host keys.
   These files should only be owned by root, readable only by root, and not
   accessible to others.
   Note that
   .Nm
   does not start if these files are group/world-accessible.
 .Pp  .Pp
 This file should be writable only by the user, and need not be  .It /etc/ssh/ssh_host_key.pub
 readable by anyone else.  .It /etc/ssh/ssh_host_dsa_key.pub
 .It Pa /etc/ssh/sshrc  .It /etc/ssh/ssh_host_rsa_key.pub
 Like  These three files contain the public parts of the host keys.
 .Pa ~/.ssh/rc .  These files should be world-readable but writable only by
 This can be used to specify  root.
   Their contents should match the respective private parts.
   These files are not
   really used for anything; they are provided for the convenience of
   the user so their contents can be copied to known hosts files.
   These files are created using
   .Xr ssh-keygen 1 .
   .Pp
   .It /etc/ssh/sshd_config
   Contains configuration data for
   .Nm sshd .
   The file format and configuration options are described in
   .Xr sshd_config 5 .
   .Pp
   .It /etc/ssh/sshrc
   Similar to
   .Pa ~/.ssh/rc ,
   it can be used to specify
 machine-specific login-time initializations globally.  machine-specific login-time initializations globally.
 This file should be writable only by root, and should be world-readable.  This file should be writable only by root, and should be world-readable.
   .Pp
   .It /var/empty
   .Xr chroot 2
   directory used by
   .Nm
   during privilege separation in the pre-authentication phase.
   The directory should not contain any files and must be owned by root
   and not group or world-writable.
   .Pp
   .It /var/run/sshd.pid
   Contains the process ID of the
   .Nm
   listening for connections (if there are several daemons running
   concurrently for different ports, this contains the process ID of the one
   started last).
   The content of this file is not sensitive; it can be world-readable.
 .El  .El
 .Sh SEE ALSO  .Sh SEE ALSO
 .Xr scp 1 ,  .Xr scp 1 ,
Line 811 
Line 807 
 .Xr sshd_config 5 ,  .Xr sshd_config 5 ,
 .Xr inetd 8 ,  .Xr inetd 8 ,
 .Xr sftp-server 8  .Xr sftp-server 8
 .Rs  
 .%A T. Ylonen  
 .%A T. Kivinen  
 .%A M. Saarinen  
 .%A T. Rinne  
 .%A S. Lehtinen  
 .%T "SSH Protocol Architecture"  
 .%N draft-ietf-secsh-architecture-12.txt  
 .%D January 2002  
 .%O work in progress material  
 .Re  
 .Rs  
 .%A M. Friedl  
 .%A N. Provos  
 .%A W. A. Simpson  
 .%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol"  
 .%N draft-ietf-secsh-dh-group-exchange-02.txt  
 .%D January 2002  
 .%O work in progress material  
 .Re  
 .Sh AUTHORS  .Sh AUTHORS
 OpenSSH is a derivative of the original and free  OpenSSH is a derivative of the original and free
 ssh 1.2.12 release by Tatu Ylonen.  ssh 1.2.12 release by Tatu Ylonen.
Line 842 
Line 818 
 protocol versions 1.5 and 2.0.  protocol versions 1.5 and 2.0.
 Niels Provos and Markus Friedl contributed support  Niels Provos and Markus Friedl contributed support
 for privilege separation.  for privilege separation.
   .Sh CAVEATS
   System security is not improved unless
   .Nm rshd ,
   .Nm rlogind ,
   and
   .Nm rexecd
   are disabled (thus completely disabling
   .Xr rlogin
   and
   .Xr rsh
   into the machine).

Legend:
Removed from v.1.208  
changed lines
  Added in v.1.208.2.2