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