[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.2.2 and 1.209

version 1.208.2.2, 2006/10/06 03:19:33 version 1.209, 2005/12/06 22:38:28
Line 56 
Line 56 
 .Ek  .Ek
 .Sh DESCRIPTION  .Sh DESCRIPTION
 .Nm  .Nm
 (OpenSSH Daemon) is the daemon program for  (SSH 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
 listens for connections from clients.  is the daemon that 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 71 
Line 73 
 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 154 
Line 240 
 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 177 
Line 263 
 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 with the  Ports specified in the configuration file are ignored when a
 .Cm Port  command-line port is specified.
 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 217 
Line 299 
 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 227 
Line 309 
 or  or
 .Cm DenyUsers .  .Cm DenyUsers .
 .El  .El
 .Sh AUTHENTICATION  .Sh CONFIGURATION FILE
 The OpenSSH SSH daemon supports SSH protocols 1 and 2.  .Nm
 Both protocols are supported by default,  reads configuration data from
 though this can be changed via the  .Pa /etc/ssh/sshd_config
 .Cm Protocol  (or the file specified with
 option in  .Fl f
   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 344 
Line 364 
 .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
 specifies the file containing public keys for  may be used to specify an alternative file.
 public key authentication;  .Pp
 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).
 Protocol 1 public keys consist of the following space-separated fields:  Each RSA public key consists of the following fields, separated by
 options, bits, exponent, modulus, comment.  spaces: options, bits, exponent, modulus, comment.
 Protocol 2 public key consist of:  Each protocol version 2 public key consists of:
 options, keytype, base64-encoded key, comment.  options, keytype, base64 encoded key, comment.
 The options field is optional;  The options field
 its presence is determined by whether the line starts  is optional; 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 425 
Line 403 
 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 440 
Line 418 
 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 453 
Line 451 
 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 and/or X11  Note that the client may specify TCP/IP 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 472 
Line 467 
 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 forwarding when this key is used for authentication.  Forbids TCP/IP 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 523 
Line 500 
 Without this option, the next available device will be used if  Without this option, the next available device will be used if
 the client requests a tunnel.  the client requests a tunnel.
 .El  .El
   .Ss Examples
   1024 33 12121...312314325 ylo@foo.bar
 .Pp  .Pp
 An example authorized_keys file:  from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula
 .Bd -literal -offset 3n  .Pp
 # Comments allowed at start of line  command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 backup.hut.fi
 ssh-rsa AAAAB3Nza...LiPk== user@example.net  .Pp
 from="*.sales.example.net,!pc.sales.example.net" ssh-rsa  permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23...2323
 AAAAB2...19Q== john@example.net  .Pp
 command="dump /home",no-pty,no-port-forwarding ssh-dss  tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== reyk@openbsd.org
 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 545 
Line 518 
 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 553 
Line 526 
 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 565 
Line 538 
 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 582 
Line 548 
 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, for example, from  can be obtained, e.g., 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 607 
Line 573 
 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.
 .Pp  .Ss Examples
 An example ssh_known_hosts file:  .Bd -literal
 .Bd -literal -offset 3n  closenet,...,130.233.208.41 1024 37 159...93 closenet.hut.fi
 # Comments allowed at start of line  cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....=
 closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net  .Ed
 cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=  .Bd -literal
 # 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 -compact  .Bl -tag -width Ds
 .It ~/.hushlogin  .It Pa /etc/ssh/sshd_config
   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 630 
Line 665 
 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 .
 .Pp  .It Pa /etc/nologin
 .It ~/.rhosts  If this file exists,
 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
 reads it as root.  refuses to let anyone except root log in.
 Additionally, this file must be owned by the user,  The contents of the file
 and must not have write permissions for anyone else.  are displayed to anyone trying to log in, and non-root connections are
 The recommended  refused.
 permission for most machines is read/write for the user, and not  The file should be world-readable.
   .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 ~/.shosts  It is also possible to use netgroups in the file.
 This file is used in exactly the same way as  Either host or user
 .Pa .rhosts ,  name may be of the form +@groupname to specify all hosts or all users
 but allows host-based authentication without permitting login with  in the group.
 rlogin/rsh.  .It Pa ~/.shosts
   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
 .It ~/.ssh/authorized_keys  If the client host/user is successfully matched in this file, login is
 Lists the public keys (RSA/DSA) that can be used for logging in as this user.  automatically permitted provided the client and server user names are the
 The format of this file is described above.  same.
 The content of the file is not highly sensitive, but the recommended  Additionally, successful client host key authentication is required.
 permissions are read/write for the user, and not accessible by others.  This file must be writable only by root; it is recommended
   that it be world-readable.
 .Pp  .Pp
 If this file, the  .Sy "Warning: It is almost never a good idea to use user names in"
 .Pa ~/.ssh  .Pa hosts.equiv .
 directory, or the user's home directory are writable  Beware that it really means that the named user(s) can log in as
 by other users, then the file could be modified or replaced by unauthorized  .Em anybody ,
 users.  which includes bin, daemon, adm, and other accounts that own critical
 In this case,  binaries and directories.
 .Nm  Using a user name practically grants the user root access.
 will not allow it to be used unless the  The only valid use for user names that I can think
 .Cm StrictModes  of is in negative entries.
 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
 .It ~/.ssh/environment  Note that this warning also applies to rsh/rlogin.
   .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 683 
Line 755 
 controlled via the  controlled via the
 .Cm PermitUserEnvironment  .Cm PermitUserEnvironment
 option.  option.
 .Pp  .It Pa ~/.ssh/rc
 .It ~/.ssh/known_hosts  If this file exists, it is run with
 Contains a list of host keys for all hosts the user has logged into  .Pa /bin/sh
 that are not already in the systemwide list of known host keys.  after reading the
 The format of this file is described above.  environment files but before starting the user's shell or command.
 This file should be writable only by root/the owner and  It must not produce any output on stdout; stderr must be used
 can, but need not be, world-readable.  instead.
 .Pp  If X11 forwarding is in use, it will receive the "proto cookie" pair in
 .It ~/.ssh/rc  its standard input (and
 Contains initialization routines to be run before  .Ev DISPLAY
 the user's home directory becomes accessible.  in its environment).
 This file should be writable only by the user, and need not be  The script must call
 readable by anyone else.  .Xr xauth 1
 .Pp  because
 .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
 refuses to let anyone except root log in.  will not run xauth automatically to add X11 cookies.
 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
 .It /etc/shosts.equiv  The primary purpose of this file is to run any initialization routines
 This file is used in exactly the same way as  which may be needed before the user's home directory becomes
 .Pa hosts.equiv ,  accessible; AFS is a particular example of such an environment.
 but allows host-based authentication without permitting login with  
 rlogin/rsh.  
 .Pp  .Pp
 .It /etc/ssh/ssh_known_hosts  This file will probably contain some initialization code followed by
 Systemwide list of known host keys.  something similar to:
 This file should be prepared by the  .Bd -literal
 system administrator to contain the public host keys of all machines in the  if read proto cookie && [ -n "$DISPLAY" ]; then
 organization.          if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
 The format of this file is described above.                  # X11UseLocalhost=yes
 This file should be writable only by root/the owner and                  echo add unix:`echo $DISPLAY |
 should be world-readable.                      cut -c11-` $proto $cookie
           else
                   # X11UseLocalhost=no
                   echo add $DISPLAY $proto $cookie
           fi | xauth -q -
   fi
   .Ed
 .Pp  .Pp
 .It /etc/ssh/ssh_host_key  If this file does not exist,
 .It /etc/ssh/ssh_host_dsa_key  .Pa /etc/ssh/sshrc
 .It /etc/ssh/ssh_host_rsa_key  is run, and if that
 These three files contain the private parts of the host keys.  does not exist either, xauth is used to add the cookie.
 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
 .It /etc/ssh/ssh_host_key.pub  This file should be writable only by the user, and need not be
 .It /etc/ssh/ssh_host_dsa_key.pub  readable by anyone else.
 .It /etc/ssh/ssh_host_rsa_key.pub  .It Pa /etc/ssh/sshrc
 These three files contain the public parts of the host keys.  Like
 These files should be world-readable but writable only by  .Pa ~/.ssh/rc .
 root.  This can be used to specify
 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 807 
Line 819 
 .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 818 
Line 850 
 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.2.2  
changed lines
  Added in v.1.209