summaryrefslogtreecommitdiff
path: root/sshd.8
diff options
context:
space:
mode:
Diffstat (limited to 'sshd.8')
-rw-r--r--sshd.8556
1 files changed, 272 insertions, 284 deletions
diff --git a/sshd.8 b/sshd.8
index 51d339b65..522279ee3 100644
--- a/sshd.8
+++ b/sshd.8
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: sshd.8,v 1.215 2006/02/01 09:11:41 jmc Exp $ 37.\" $OpenBSD: sshd.8,v 1.234 2006/08/21 08:15:57 dtucker Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSHD 8 39.Dt SSHD 8
40.Os 40.Os
@@ -81,7 +81,7 @@ configuration file.
81.Nm 81.Nm
82rereads its configuration file when it receives a hangup signal, 82rereads its configuration file when it receives a hangup signal,
83.Dv SIGHUP , 83.Dv SIGHUP ,
84by executing itself with the name and options it was started with, e.g., 84by executing itself with the name and options it was started with, e.g.\&
85.Pa /usr/sbin/sshd . 85.Pa /usr/sbin/sshd .
86.Pp 86.Pp
87The options are as follows: 87The options are as follows:
@@ -154,7 +154,7 @@ is normally not run
154from inetd because it needs to generate the server key before it can 154from inetd because it needs to generate the server key before it can
155respond to the client, and this may take tens of seconds. 155respond to the client, and this may take tens of seconds.
156Clients would have to wait too long if the key was regenerated every time. 156Clients would have to wait too long if the key was regenerated every time.
157However, with small key sizes (e.g., 512) using 157However, with small key sizes (e.g. 512) using
158.Nm 158.Nm
159from inetd may 159from inetd may
160be feasible. 160be feasible.
@@ -308,17 +308,6 @@ or
308.Ql \&*NP\&* 308.Ql \&*NP\&*
309). 309).
310.Pp 310.Pp
311System security is not improved unless
312.Nm rshd ,
313.Nm rlogind ,
314and
315.Nm rexecd
316are disabled (thus completely disabling
317.Xr rlogin
318and
319.Xr rsh
320into the machine).
321.Sh COMMAND EXECUTION AND DATA FORWARDING
322If the client successfully authenticates itself, a dialog for 311If the client successfully authenticates itself, a dialog for
323preparing the session is entered. 312preparing the session is entered.
324At this time the client may request 313At this time the client may request
@@ -326,7 +315,7 @@ things like allocating a pseudo-tty, forwarding X11 connections,
326forwarding TCP connections, or forwarding the authentication agent 315forwarding TCP connections, or forwarding the authentication agent
327connection over the secure channel. 316connection over the secure channel.
328.Pp 317.Pp
329Finally, the client either requests a shell or execution of a command. 318After this, the client either requests a shell or execution of a command.
330The sides then enter session mode. 319The sides then enter session mode.
331In this mode, either side may send 320In this mode, either side may send
332data at any time, and such data is forwarded to/from the shell or 321data at any time, and such data is forwarded to/from the shell or
@@ -381,31 +370,73 @@ The
381.Dq rc 370.Dq rc
382files are given the X11 371files are given the X11
383authentication protocol and cookie in standard input. 372authentication protocol and cookie in standard input.
373See
374.Sx SSHRC ,
375below.
384.It 376.It
385Runs user's shell or command. 377Runs user's shell or command.
386.El 378.El
379.Sh SSHRC
380If the file
381.Pa ~/.ssh/rc
382exists,
383.Xr sh 1
384runs it after reading the
385environment files but before starting the user's shell or command.
386It must not produce any output on stdout; stderr must be used
387instead.
388If X11 forwarding is in use, it will receive the "proto cookie" pair in
389its standard input (and
390.Ev DISPLAY
391in its environment).
392The script must call
393.Xr xauth 1
394because
395.Nm
396will not run xauth automatically to add X11 cookies.
397.Pp
398The primary purpose of this file is to run any initialization routines
399which may be needed before the user's home directory becomes
400accessible; AFS is a particular example of such an environment.
401.Pp
402This file will probably contain some initialization code followed by
403something similar to:
404.Bd -literal -offset 3n
405if read proto cookie && [ -n "$DISPLAY" ]; then
406 if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
407 # X11UseLocalhost=yes
408 echo add unix:`echo $DISPLAY |
409 cut -c11-` $proto $cookie
410 else
411 # X11UseLocalhost=no
412 echo add $DISPLAY $proto $cookie
413 fi | xauth -q -
414fi
415.Ed
416.Pp
417If this file does not exist,
418.Pa /etc/ssh/sshrc
419is run, and if that
420does not exist either, xauth is used to add the cookie.
387.Sh AUTHORIZED_KEYS FILE FORMAT 421.Sh AUTHORIZED_KEYS FILE FORMAT
388.Pa ~/.ssh/authorized_keys
389is the default file that lists the public keys that are
390permitted for RSA authentication in protocol version 1
391and for public key authentication (PubkeyAuthentication)
392in protocol version 2.
393.Cm AuthorizedKeysFile 422.Cm AuthorizedKeysFile
394may be used to specify an alternative file. 423specifies the file containing public keys for
395.Pp 424public key authentication;
425if none is specified, the default is
426.Pa ~/.ssh/authorized_keys .
396Each line of the file contains one 427Each line of the file contains one
397key (empty lines and lines starting with a 428key (empty lines and lines starting with a
398.Ql # 429.Ql #
399are ignored as 430are ignored as
400comments). 431comments).
401Each RSA public key consists of the following fields, separated by 432Protocol 1 public keys consist of the following space-separated fields:
402spaces: options, bits, exponent, modulus, comment. 433options, bits, exponent, modulus, comment.
403Each protocol version 2 public key consists of: 434Protocol 2 public key consist of:
404options, keytype, base64 encoded key, comment. 435options, keytype, base64-encoded key, comment.
405The options field 436The options field is optional;
406is optional; its presence is determined by whether the line starts 437its presence is determined by whether the line starts
407with a number or not (the options field never starts with a number). 438with a number or not (the options field never starts with a number).
408The bits, exponent, modulus and comment fields give the RSA key for 439The bits, exponent, modulus, and comment fields give the RSA key for
409protocol version 1; the 440protocol version 1; the
410comment field is not used for anything (but may be convenient for the 441comment field is not used for anything (but may be convenient for the
411user to identify the key). 442user to identify the key).
@@ -420,7 +451,7 @@ Note that lines in this file are usually several hundred bytes long
420keys up to 16 kilobits. 451keys up to 16 kilobits.
421You don't want to type them in; instead, copy the 452You don't want to type them in; instead, copy the
422.Pa identity.pub , 453.Pa identity.pub ,
423.Pa id_dsa.pub 454.Pa id_dsa.pub ,
424or the 455or the
425.Pa id_rsa.pub 456.Pa id_rsa.pub
426file and edit it. 457file and edit it.
@@ -435,26 +466,6 @@ No spaces are permitted, except within double quotes.
435The following option specifications are supported (note 466The following option specifications are supported (note
436that option keywords are case-insensitive): 467that option keywords are case-insensitive):
437.Bl -tag -width Ds 468.Bl -tag -width Ds
438.It Cm from="pattern-list"
439Specifies that in addition to public key authentication, the canonical name
440of the remote host must be present in the comma-separated list of
441patterns
442.Pf ( Ql \&*
443and
444.Ql \&?
445serve as wildcards).
446The list may also contain
447patterns negated by prefixing them with
448.Ql \&! ;
449if the canonical host name matches a negated pattern, the key is not accepted.
450The purpose
451of this option is to optionally increase security: public key authentication
452by itself does not trust the network or name servers or anything (but
453the key); however, if somebody somehow steals the key, the key
454permits an intruder to log in from anywhere in the world.
455This additional option makes using a stolen key more difficult (name
456servers and/or routers would have to be compromised in addition to
457just the key).
458.It Cm command="command" 469.It Cm command="command"
459Specifies that the command is executed whenever this key is used for 470Specifies that the command is executed whenever this key is used for
460authentication. 471authentication.
@@ -470,6 +481,9 @@ to restrict certain public keys to perform just a specific operation.
470An example might be a key that permits remote backups but nothing else. 481An example might be a key that permits remote backups but nothing else.
471Note that the client may specify TCP and/or X11 482Note that the client may specify TCP and/or X11
472forwarding unless they are explicitly prohibited. 483forwarding unless they are explicitly prohibited.
484The command originally supplied by the client is available in the
485.Ev SSH_ORIGINAL_COMMAND
486environment variable.
473Note that this option applies to shell, command or subsystem execution. 487Note that this option applies to shell, command or subsystem execution.
474.It Cm environment="NAME=value" 488.It Cm environment="NAME=value"
475Specifies that the string is to be added to the environment when 489Specifies that the string is to be added to the environment when
@@ -484,20 +498,38 @@ option.
484This option is automatically disabled if 498This option is automatically disabled if
485.Cm UseLogin 499.Cm UseLogin
486is enabled. 500is enabled.
501.It Cm from="pattern-list"
502Specifies that in addition to public key authentication, the canonical name
503of the remote host must be present in the comma-separated list of
504patterns.
505The purpose
506of this option is to optionally increase security: public key authentication
507by itself does not trust the network or name servers or anything (but
508the key); however, if somebody somehow steals the key, the key
509permits an intruder to log in from anywhere in the world.
510This additional option makes using a stolen key more difficult (name
511servers and/or routers would have to be compromised in addition to
512just the key).
513.Pp
514See
515.Sx PATTERNS
516in
517.Xr ssh_config 5
518for more information on patterns.
519.It Cm no-agent-forwarding
520Forbids authentication agent forwarding when this key is used for
521authentication.
487.It Cm no-port-forwarding 522.It Cm no-port-forwarding
488Forbids TCP forwarding when this key is used for authentication. 523Forbids TCP forwarding when this key is used for authentication.
489Any port forward requests by the client will return an error. 524Any port forward requests by the client will return an error.
490This might be used, e.g., in connection with the 525This might be used, e.g. in connection with the
491.Cm command 526.Cm command
492option. 527option.
528.It Cm no-pty
529Prevents tty allocation (a request to allocate a pty will fail).
493.It Cm no-X11-forwarding 530.It Cm no-X11-forwarding
494Forbids X11 forwarding when this key is used for authentication. 531Forbids X11 forwarding when this key is used for authentication.
495Any X11 forward requests by the client will return an error. 532Any X11 forward requests by the client will return an error.
496.It Cm no-agent-forwarding
497Forbids authentication agent forwarding when this key is used for
498authentication.
499.It Cm no-pty
500Prevents tty allocation (a request to allocate a pty will fail).
501.It Cm permitopen="host:port" 533.It Cm permitopen="host:port"
502Limit local 534Limit local
503.Li ``ssh -L'' 535.Li ``ssh -L''
@@ -517,16 +549,20 @@ device on the server.
517Without this option, the next available device will be used if 549Without this option, the next available device will be used if
518the client requests a tunnel. 550the client requests a tunnel.
519.El 551.El
520.Ss Examples
5211024 33 12121...312314325 ylo@foo.bar
522.Pp 552.Pp
523from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula 553An example authorized_keys file:
524.Pp 554.Bd -literal -offset 3n
525command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 backup.hut.fi 555# Comments allowed at start of line
526.Pp 556ssh-rsa AAAAB3Nza...LiPk== user@example.net
527permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23...2323 557from="*.sales.example.net,!pc.sales.example.net" ssh-rsa
528.Pp 558AAAAB2...19Q== john@example.net
529tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== reyk@openbsd.org 559command="dump /home",no-pty,no-port-forwarding ssh-dss
560AAAAC3...51R== example.net
561permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
562AAAAB5...21S==
563tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
564jane@example.net
565.Ed
530.Sh SSH_KNOWN_HOSTS FILE FORMAT 566.Sh SSH_KNOWN_HOSTS FILE FORMAT
531The 567The
532.Pa /etc/ssh/ssh_known_hosts 568.Pa /etc/ssh/ssh_known_hosts
@@ -535,7 +571,7 @@ and
535files contain host public keys for all known hosts. 571files contain host public keys for all known hosts.
536The global file should 572The global file should
537be prepared by the administrator (optional), and the per-user file is 573be prepared by the administrator (optional), and the per-user file is
538maintained automatically: whenever the user connects from an unknown host 574maintained automatically: whenever the user connects from an unknown host,
539its key is added to the per-user file. 575its key is added to the per-user file.
540.Pp 576.Pp
541Each line in these files contains the following fields: hostnames, 577Each line in these files contains the following fields: hostnames,
@@ -543,7 +579,7 @@ bits, exponent, modulus, comment.
543The fields are separated by spaces. 579The fields are separated by spaces.
544.Pp 580.Pp
545Hostnames is a comma-separated list of patterns 581Hostnames is a comma-separated list of patterns
546.Pf ( Ql \&* 582.Pf ( Ql *
547and 583and
548.Ql \&? 584.Ql \&?
549act as 585act as
@@ -555,6 +591,13 @@ A pattern may also be preceded by
555to indicate negation: if the host name matches a negated 591to indicate negation: if the host name matches a negated
556pattern, it is not accepted (by that line) even if it matched another 592pattern, it is not accepted (by that line) even if it matched another
557pattern on the line. 593pattern on the line.
594A hostname or address may optionally be enclosed within
595.Ql \&[
596and
597.Ql \&]
598brackets then followed by
599.Ql \&:
600and a non-standard port number.
558.Pp 601.Pp
559Alternately, hostnames may be stored in a hashed form which hides host names 602Alternately, hostnames may be stored in a hashed form which hides host names
560and addresses should the file's contents be disclosed. 603and addresses should the file's contents be disclosed.
@@ -565,7 +608,7 @@ Only one hashed hostname may appear on a single line and none of the above
565negation or wildcard operators may be applied. 608negation or wildcard operators may be applied.
566.Pp 609.Pp
567Bits, exponent, and modulus are taken directly from the RSA host key; they 610Bits, exponent, and modulus are taken directly from the RSA host key; they
568can be obtained, e.g., from 611can be obtained, for example, from
569.Pa /etc/ssh/ssh_host_key.pub . 612.Pa /etc/ssh/ssh_host_key.pub .
570The optional comment field continues to the end of the line, and is not used. 613The optional comment field continues to the end of the line, and is not used.
571.Pp 614.Pp
@@ -590,88 +633,19 @@ Rather, generate them by a script
590or by taking 633or by taking
591.Pa /etc/ssh/ssh_host_key.pub 634.Pa /etc/ssh/ssh_host_key.pub
592and adding the host names at the front. 635and adding the host names at the front.
593.Ss Examples 636.Pp
594.Bd -literal 637An example ssh_known_hosts file:
595closenet,...,130.233.208.41 1024 37 159...93 closenet.hut.fi 638.Bd -literal -offset 3n
596cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....= 639# Comments allowed at start of line
597.Ed 640closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
598.Bd -literal 641cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
599# A hashed hostname 642# A hashed hostname
600|1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa 643|1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
601AAAA1234.....= 644AAAA1234.....=
602.Ed 645.Ed
603.Sh FILES 646.Sh FILES
604.Bl -tag -width Ds 647.Bl -tag -width Ds -compact
605.It Pa /etc/ssh/sshd_config 648.It ~/.hushlogin
606Contains configuration data for
607.Nm sshd .
608The file format and configuration options are described in
609.Xr sshd_config 5 .
610.It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
611These three files contain the private parts of the host keys.
612These files should only be owned by root, readable only by root, and not
613accessible to others.
614Note that
615.Nm
616does not start if this file is group/world-accessible.
617.It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pub
618These three files contain the public parts of the host keys.
619These files should be world-readable but writable only by
620root.
621Their contents should match the respective private parts.
622These files are not
623really used for anything; they are provided for the convenience of
624the user so their contents can be copied to known hosts files.
625These files are created using
626.Xr ssh-keygen 1 .
627.It Pa /etc/moduli
628Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
629The file format is described in
630.Xr moduli 5 .
631.It Pa /var/empty
632.Xr chroot 2
633directory used by
634.Nm
635during privilege separation in the pre-authentication phase.
636The directory should not contain any files and must be owned by root
637and not group or world-writable.
638.It Pa /var/run/sshd.pid
639Contains the process ID of the
640.Nm
641listening for connections (if there are several daemons running
642concurrently for different ports, this contains the process ID of the one
643started last).
644The content of this file is not sensitive; it can be world-readable.
645.It Pa ~/.ssh/authorized_keys
646Lists the public keys (RSA or DSA) that can be used to log into the user's account.
647This file must be readable by root (which may on some machines imply
648it being world-readable if the user's home directory resides on an NFS
649volume).
650It is recommended that it not be accessible by others.
651The format of this file is described above.
652Users will place the contents of their
653.Pa identity.pub ,
654.Pa id_dsa.pub
655and/or
656.Pa id_rsa.pub
657files into this file, as described in
658.Xr ssh-keygen 1 .
659.It Pa "/etc/ssh/ssh_known_hosts", "~/.ssh/known_hosts"
660These files are consulted when using rhosts with RSA host
661authentication or protocol version 2 hostbased authentication
662to check the public key of the host.
663The key must be listed in one of these files to be accepted.
664The client uses the same files
665to verify that it is connecting to the correct remote host.
666These files should be writable only by root/the owner.
667.Pa /etc/ssh/ssh_known_hosts
668should be world-readable, and
669.Pa ~/.ssh/known_hosts
670can, but need not be, world-readable.
671.It Pa /etc/motd
672See
673.Xr motd 5 .
674.It Pa ~/.hushlogin
675This file is used to suppress printing the last login time and 649This file is used to suppress printing the last login time and
676.Pa /etc/motd , 650.Pa /etc/motd ,
677if 651if
@@ -682,86 +656,49 @@ respectively,
682are enabled. 656are enabled.
683It does not suppress printing of the banner specified by 657It does not suppress printing of the banner specified by
684.Cm Banner . 658.Cm Banner .
685.It Pa /etc/nologin 659.Pp
686If this file exists, 660.It ~/.rhosts
661This file is used for host-based authentication (see
662.Xr ssh 1
663for more information).
664On some machines this file may need to be
665world-readable if the user's home directory is on an NFS partition,
666because
687.Nm 667.Nm
688refuses to let anyone except root log in. 668reads it as root.
689The contents of the file 669Additionally, this file must be owned by the user,
690are displayed to anyone trying to log in, and non-root connections are 670and must not have write permissions for anyone else.
691refused. 671The recommended
692The file should be world-readable. 672permission for most machines is read/write for the user, and not
693.It Pa /etc/hosts.allow, /etc/hosts.deny
694Access controls that should be enforced by tcp-wrappers are defined here.
695Further details are described in
696.Xr hosts_access 5 .
697.It Pa ~/.rhosts
698This file is used during
699.Cm RhostsRSAAuthentication
700and
701.Cm HostbasedAuthentication
702and contains host-username pairs, separated by a space, one per
703line.
704The given user on the corresponding host is permitted to log in
705without a password.
706The same file is used by rlogind and rshd.
707The file must
708be writable only by the user; it is recommended that it not be
709accessible by others. 673accessible by others.
710.Pp 674.Pp
711It is also possible to use netgroups in the file. 675.It ~/.shosts
712Either host or user 676This file is used in exactly the same way as
713name may be of the form +@groupname to specify all hosts or all users 677.Pa .rhosts ,
714in the group. 678but allows host-based authentication without permitting login with
715.It Pa ~/.shosts 679rlogin/rsh.
716For ssh, 680.Pp
717this file is exactly the same as for 681.It ~/.ssh/authorized_keys
718.Pa .rhosts . 682Lists the public keys (RSA/DSA) that can be used for logging in as this user.
719However, this file is 683The format of this file is described above.
720not used by rlogin and rshd, so using this permits access using SSH only. 684The content of the file is not highly sensitive, but the recommended
721.It Pa /etc/hosts.equiv 685permissions are read/write for the user, and not accessible by others.
722This file is used during 686.Pp
723.Cm RhostsRSAAuthentication 687If this file, the
724and 688.Pa ~/.ssh
725.Cm HostbasedAuthentication 689directory, or the user's home directory are writable
726authentication. 690by other users, then the file could be modified or replaced by unauthorized
727In the simplest form, this file contains host names, one per line. 691users.
728Users on 692In this case,
729those hosts are permitted to log in without a password, provided they 693.Nm
730have the same user name on both machines. 694will not allow it to be used unless the
731The host name may also be 695.Cm StrictModes
732followed by a user name; such users are permitted to log in as 696option has been set to
733.Em any 697.Dq no .
734user on this machine (except root). 698The recommended permissions can be set by executing
735Additionally, the syntax 699.Dq chmod go-w ~/ ~/.ssh ~/.ssh/authorized_keys .
736.Dq +@group 700.Pp
737can be used to specify netgroups. 701.It ~/.ssh/environment
738Negated entries start with
739.Ql \&- .
740.Pp
741If the client host/user is successfully matched in this file, login is
742automatically permitted provided the client and server user names are the
743same.
744Additionally, successful client host key authentication is required.
745This file must be writable only by root; it is recommended
746that it be world-readable.
747.Pp
748.Sy "Warning: It is almost never a good idea to use user names in"
749.Pa hosts.equiv .
750Beware that it really means that the named user(s) can log in as
751.Em anybody ,
752which includes bin, daemon, adm, and other accounts that own critical
753binaries and directories.
754Using a user name practically grants the user root access.
755The only valid use for user names that I can think
756of is in negative entries.
757.Pp
758Note that this warning also applies to rsh/rlogin.
759.It Pa /etc/shosts.equiv
760This is processed exactly as
761.Pa /etc/hosts.equiv .
762However, this file may be useful in environments that want to run both
763rsh/rlogin and ssh.
764.It Pa ~/.ssh/environment
765This file is read into the environment at login (if it exists). 702This file is read into the environment at login (if it exists).
766It can only contain empty lines, comment lines (that start with 703It can only contain empty lines, comment lines (that start with
767.Ql # ) , 704.Ql # ) ,
@@ -772,55 +709,115 @@ Environment processing is disabled by default and is
772controlled via the 709controlled via the
773.Cm PermitUserEnvironment 710.Cm PermitUserEnvironment
774option. 711option.
775.It Pa ~/.ssh/rc 712.Pp
776If this file exists, it is run with 713.It ~/.ssh/known_hosts
777.Pa /bin/sh 714Contains a list of host keys for all hosts the user has logged into
778after reading the 715that are not already in the systemwide list of known host keys.
779environment files but before starting the user's shell or command. 716The format of this file is described above.
780It must not produce any output on stdout; stderr must be used 717This file should be writable only by root/the owner and
781instead. 718can, but need not be, world-readable.
782If X11 forwarding is in use, it will receive the "proto cookie" pair in 719.Pp
783its standard input (and 720.It ~/.ssh/rc
784.Ev DISPLAY 721Contains initialization routines to be run before
785in its environment). 722the user's home directory becomes accessible.
786The script must call 723This file should be writable only by the user, and need not be
787.Xr xauth 1 724readable by anyone else.
788because 725.Pp
726.It /etc/hosts.allow
727.It /etc/hosts.deny
728Access controls that should be enforced by tcp-wrappers are defined here.
729Further details are described in
730.Xr hosts_access 5 .
731.Pp
732.It /etc/hosts.equiv
733This file is for host-based authentication (see
734.Xr ssh 1 ) .
735It should only be writable by root.
736.Pp
737.It /etc/moduli
738Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
739The file format is described in
740.Xr moduli 5 .
741.Pp
742.It /etc/motd
743See
744.Xr motd 5 .
745.Pp
746.It /etc/nologin
747If this file exists,
789.Nm 748.Nm
790will not run xauth automatically to add X11 cookies. 749refuses to let anyone except root log in.
750The contents of the file
751are displayed to anyone trying to log in, and non-root connections are
752refused.
753The file should be world-readable.
791.Pp 754.Pp
792The primary purpose of this file is to run any initialization routines 755.It /etc/shosts.equiv
793which may be needed before the user's home directory becomes 756This file is used in exactly the same way as
794accessible; AFS is a particular example of such an environment. 757.Pa hosts.equiv ,
758but allows host-based authentication without permitting login with
759rlogin/rsh.
760.Pp
761.It /etc/ssh/ssh_known_hosts
762Systemwide list of known host keys.
763This file should be prepared by the
764system administrator to contain the public host keys of all machines in the
765organization.
766The format of this file is described above.
767This file should be writable only by root/the owner and
768should be world-readable.
795.Pp 769.Pp
796This file will probably contain some initialization code followed by 770.It /etc/ssh/ssh_host_key
797something similar to: 771.It /etc/ssh/ssh_host_dsa_key
798.Bd -literal 772.It /etc/ssh/ssh_host_rsa_key
799if read proto cookie && [ -n "$DISPLAY" ]; then 773These three files contain the private parts of the host keys.
800 if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then 774These files should only be owned by root, readable only by root, and not
801 # X11UseLocalhost=yes 775accessible to others.
802 echo add unix:`echo $DISPLAY | 776Note that
803 cut -c11-` $proto $cookie 777.Nm
804 else 778does not start if these files are group/world-accessible.
805 # X11UseLocalhost=no
806 echo add $DISPLAY $proto $cookie
807 fi | xauth -q -
808fi
809.Ed
810.Pp 779.Pp
811If this file does not exist, 780.It /etc/ssh/ssh_host_key.pub
812.Pa /etc/ssh/sshrc 781.It /etc/ssh/ssh_host_dsa_key.pub
813is run, and if that 782.It /etc/ssh/ssh_host_rsa_key.pub
814does not exist either, xauth is used to add the cookie. 783These three files contain the public parts of the host keys.
784These files should be world-readable but writable only by
785root.
786Their contents should match the respective private parts.
787These files are not
788really used for anything; they are provided for the convenience of
789the user so their contents can be copied to known hosts files.
790These files are created using
791.Xr ssh-keygen 1 .
815.Pp 792.Pp
816This file should be writable only by the user, and need not be 793.It /etc/ssh/sshd_config
817readable by anyone else. 794Contains configuration data for
818.It Pa /etc/ssh/sshrc 795.Nm sshd .
819Like 796The file format and configuration options are described in
820.Pa ~/.ssh/rc . 797.Xr sshd_config 5 .
821This can be used to specify 798.Pp
799.It /etc/ssh/sshrc
800Similar to
801.Pa ~/.ssh/rc ,
802it can be used to specify
822machine-specific login-time initializations globally. 803machine-specific login-time initializations globally.
823This file should be writable only by root, and should be world-readable. 804This file should be writable only by root, and should be world-readable.
805.Pp
806.It /var/empty
807.Xr chroot 2
808directory used by
809.Nm
810during privilege separation in the pre-authentication phase.
811The directory should not contain any files and must be owned by root
812and not group or world-writable.
813.Pp
814.It /var/run/sshd.pid
815Contains the process ID of the
816.Nm
817listening for connections (if there are several daemons running
818concurrently for different ports, this contains the process ID of the one
819started last).
820The content of this file is not sensitive; it can be world-readable.
824.El 821.El
825.Sh SEE ALSO 822.Sh SEE ALSO
826.Xr scp 1 , 823.Xr scp 1 ,
@@ -836,26 +833,6 @@ This file should be writable only by root, and should be world-readable.
836.Xr sshd_config 5 , 833.Xr sshd_config 5 ,
837.Xr inetd 8 , 834.Xr inetd 8 ,
838.Xr sftp-server 8 835.Xr sftp-server 8
839.Rs
840.%A T. Ylonen
841.%A T. Kivinen
842.%A M. Saarinen
843.%A T. Rinne
844.%A S. Lehtinen
845.%T "SSH Protocol Architecture"
846.%N draft-ietf-secsh-architecture-12.txt
847.%D January 2002
848.%O work in progress material
849.Re
850.Rs
851.%A M. Friedl
852.%A N. Provos
853.%A W. A. Simpson
854.%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol"
855.%N draft-ietf-secsh-dh-group-exchange-02.txt
856.%D January 2002
857.%O work in progress material
858.Re
859.Sh AUTHORS 836.Sh AUTHORS
860OpenSSH is a derivative of the original and free 837OpenSSH is a derivative of the original and free
861ssh 1.2.12 release by Tatu Ylonen. 838ssh 1.2.12 release by Tatu Ylonen.
@@ -867,3 +844,14 @@ Markus Friedl contributed the support for SSH
867protocol versions 1.5 and 2.0. 844protocol versions 1.5 and 2.0.
868Niels Provos and Markus Friedl contributed support 845Niels Provos and Markus Friedl contributed support
869for privilege separation. 846for privilege separation.
847.Sh CAVEATS
848System security is not improved unless
849.Nm rshd ,
850.Nm rlogind ,
851and
852.Nm rexecd
853are disabled (thus completely disabling
854.Xr rlogin
855and
856.Xr rsh
857into the machine).