]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - crypto/openssh/sshd.8
Document FreeBSD defaults and paths.
[FreeBSD/FreeBSD.git] / crypto / openssh / sshd.8
1 .\"  -*- nroff -*-
2 .\"
3 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 .\"                    All rights reserved
6 .\"
7 .\" As far as I am concerned, the code I have written for this software
8 .\" can be used freely for any purpose.  Any derived versions of this
9 .\" software must be clearly marked as such, and if the derived work is
10 .\" incompatible with the protocol description in the RFC file, it must be
11 .\" called by a name other than "ssh" or "Secure Shell".
12 .\"
13 .\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
14 .\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
15 .\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
16 .\"
17 .\" Redistribution and use in source and binary forms, with or without
18 .\" modification, are permitted provided that the following conditions
19 .\" are met:
20 .\" 1. Redistributions of source code must retain the above copyright
21 .\"    notice, this list of conditions and the following disclaimer.
22 .\" 2. Redistributions in binary form must reproduce the above copyright
23 .\"    notice, this list of conditions and the following disclaimer in the
24 .\"    documentation and/or other materials provided with the distribution.
25 .\"
26 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
36 .\"
37 .\" $OpenBSD: sshd.8,v 1.184 2002/06/20 19:56:07 stevesk Exp $
38 .\" $FreeBSD$
39 .Dd September 25, 1999
40 .Dt SSHD 8
41 .Os
42 .Sh NAME
43 .Nm sshd
44 .Nd OpenSSH SSH daemon
45 .Sh SYNOPSIS
46 .Nm sshd
47 .Op Fl deiqtD46
48 .Op Fl b Ar bits
49 .Op Fl f Ar config_file
50 .Op Fl g Ar login_grace_time
51 .Op Fl h Ar host_key_file
52 .Op Fl k Ar key_gen_time
53 .Op Fl o Ar option
54 .Op Fl p Ar port
55 .Op Fl u Ar len
56 .Sh DESCRIPTION
57 .Nm
58 (SSH Daemon) is the daemon program for
59 .Xr ssh 1 .
60 Together these programs replace rlogin and rsh, and
61 provide secure encrypted communications between two untrusted hosts
62 over an insecure network.
63 The programs are intended to be as easy to
64 install and use as possible.
65 .Pp
66 .Nm
67 is the daemon that listens for connections from clients.
68 It is normally started at boot from
69 .Pa /etc/rc.d/sshd .
70 It forks a new
71 daemon for each incoming connection.
72 The forked daemons handle
73 key exchange, encryption, authentication, command execution,
74 and data exchange.
75 This implementation of
76 .Nm
77 supports both SSH protocol version 1 and 2 simultaneously.
78 .Nm
79 works as follows.
80 .Pp
81 .Ss SSH protocol version 1
82 .Pp
83 Each host has a host-specific RSA key
84 (normally 1024 bits) used to identify the host.
85 Additionally, when
86 the daemon starts, it generates a server RSA key (normally 768 bits).
87 This key is normally regenerated every hour if it has been used, and
88 is never stored on disk.
89 .Pp
90 Whenever a client connects the daemon responds with its public
91 host and server keys.
92 The client compares the
93 RSA host key against its own database to verify that it has not changed.
94 The client then generates a 256 bit random number.
95 It encrypts this
96 random number using both the host key and the server key, and sends
97 the encrypted number to the server.
98 Both sides then use this
99 random number as a session key which is used to encrypt all further
100 communications in the session.
101 The rest of the session is encrypted
102 using a conventional cipher, currently Blowfish or 3DES, with 3DES
103 being used by default.
104 The client selects the encryption algorithm
105 to use from those offered by the server.
106 .Pp
107 Next, the server and the client enter an authentication dialog.
108 The client tries to authenticate itself using
109 .Pa .rhosts
110 authentication,
111 .Pa .rhosts
112 authentication combined with RSA host
113 authentication, RSA challenge-response authentication, or password
114 based authentication.
115 .Pp
116 Rhosts authentication is normally disabled
117 because it is fundamentally insecure, but can be enabled in the server
118 configuration file if desired.
119 System security is not improved unless
120 .Nm rshd ,
121 .Nm rlogind ,
122 and
123 .Xr rexecd
124 are disabled (thus completely disabling
125 .Xr rlogin
126 and
127 .Xr rsh
128 into the machine).
129 .Pp
130 .Ss SSH protocol version 2
131 .Pp
132 Version 2 works similarly:
133 Each host has a host-specific key (RSA or DSA) used to identify the host.
134 However, when the daemon starts, it does not generate a server key.
135 Forward security is provided through a Diffie-Hellman key agreement.
136 This key agreement results in a shared session key.
137 .Pp
138 The rest of the session is encrypted using a symmetric cipher, currently
139 128 bit AES, Blowfish, 3DES, CAST128, Arcfour, 192 bit AES, or 256 bit AES.
140 The client selects the encryption algorithm
141 to use from those offered by the server.
142 Additionally, session integrity is provided
143 through a cryptographic message authentication code
144 (hmac-sha1 or hmac-md5).
145 .Pp
146 Protocol version 2 provides a public key based
147 user (PubkeyAuthentication) or
148 client host (HostbasedAuthentication) authentication method,
149 conventional password authentication and challenge response based methods.
150 .Pp
151 .Ss Command execution and data forwarding
152 .Pp
153 If the client successfully authenticates itself, a dialog for
154 preparing the session is entered.
155 At this time the client may request
156 things like allocating a pseudo-tty, forwarding X11 connections,
157 forwarding TCP/IP connections, or forwarding the authentication agent
158 connection over the secure channel.
159 .Pp
160 Finally, the client either requests a shell or execution of a command.
161 The sides then enter session mode.
162 In this mode, either side may send
163 data at any time, and such data is forwarded to/from the shell or
164 command on the server side, and the user terminal in the client side.
165 .Pp
166 When the user program terminates and all forwarded X11 and other
167 connections have been closed, the server sends command exit status to
168 the client, and both sides exit.
169 .Pp
170 .Nm
171 can be configured using command-line options or a configuration
172 file.
173 Command-line options override values specified in the
174 configuration file.
175 .Pp
176 .Nm
177 rereads its configuration file when it receives a hangup signal,
178 .Dv SIGHUP ,
179 by executing itself with the name it was started as, i.e.,
180 .Pa /usr/sbin/sshd .
181 .Pp
182 The options are as follows:
183 .Bl -tag -width Ds
184 .It Fl b Ar bits
185 Specifies the number of bits in the ephemeral protocol version 1
186 server key (default 768).
187 .It Fl d
188 Debug mode.
189 The server sends verbose debug output to the system
190 log, and does not put itself in the background.
191 The server also will not fork and will only process one connection.
192 This option is only intended for debugging for the server.
193 Multiple -d options increase the debugging level.
194 Maximum is 3.
195 .It Fl e
196 When this option is specified,
197 .Nm
198 will send the output to the standard error instead of the system log.
199 .It Fl f Ar configuration_file
200 Specifies the name of the configuration file.
201 The default is
202 .Pa /etc/ssh/sshd_config .
203 .Nm
204 refuses to start if there is no configuration file.
205 .It Fl g Ar login_grace_time
206 Gives the grace time for clients to authenticate themselves (default
207 600 seconds).
208 If the client fails to authenticate the user within
209 this many seconds, the server disconnects and exits.
210 A value of zero indicates no limit.
211 .It Fl h Ar host_key_file
212 Specifies a file from which a host key is read.
213 This option must be given if
214 .Nm
215 is not run as root (as the normal
216 host key files are normally not readable by anyone but root).
217 The default is
218 .Pa /etc/ssh/ssh_host_key
219 for protocol version 1, and
220 .Pa /etc/ssh/ssh_host_rsa_key
221 and
222 .Pa /etc/ssh/ssh_host_dsa_key
223 for protocol version 2.
224 It is possible to have multiple host key files for
225 the different protocol versions and host key algorithms.
226 .It Fl i
227 Specifies that
228 .Nm
229 is being run from inetd.
230 .Nm
231 is normally not run
232 from inetd because it needs to generate the server key before it can
233 respond to the client, and this may take tens of seconds.
234 Clients would have to wait too long if the key was regenerated every time.
235 However, with small key sizes (e.g., 512) using
236 .Nm
237 from inetd may
238 be feasible.
239 .It Fl k Ar key_gen_time
240 Specifies how often the ephemeral protocol version 1 server key is
241 regenerated (default 3600 seconds, or one hour).
242 The motivation for regenerating the key fairly
243 often is that the key is not stored anywhere, and after about an hour,
244 it becomes impossible to recover the key for decrypting intercepted
245 communications even if the machine is cracked into or physically
246 seized.
247 A value of zero indicates that the key will never be regenerated.
248 .It Fl o Ar option
249 Can be used to give options in the format used in the configuration file.
250 This is useful for specifying options for which there is no separate
251 command-line flag.
252 .It Fl p Ar port
253 Specifies the port on which the server listens for connections
254 (default 22).
255 Multiple port options are permitted.
256 Ports specified in the configuration file are ignored when a
257 command-line port is specified.
258 .It Fl q
259 Quiet mode.
260 Nothing is sent to the system log.
261 Normally the beginning,
262 authentication, and termination of each connection is logged.
263 .It Fl t
264 Test mode.
265 Only check the validity of the configuration file and sanity of the keys.
266 This is useful for updating
267 .Nm
268 reliably as configuration options may change.
269 .It Fl u Ar len
270 This option is used to specify the size of the field
271 in the
272 .Li utmp
273 structure that holds the remote host name.
274 If the resolved host name is longer than
275 .Ar len ,
276 the dotted decimal value will be used instead.
277 This allows hosts with very long host names that
278 overflow this field to still be uniquely identified.
279 Specifying
280 .Fl u0
281 indicates that only dotted decimal addresses
282 should be put into the
283 .Pa utmp
284 file.
285 .Fl u0
286 is also be used to prevent
287 .Nm
288 from making DNS requests unless the authentication
289 mechanism or configuration requires it.
290 Authentication mechanisms that may require DNS include
291 .Cm RhostsAuthentication ,
292 .Cm RhostsRSAAuthentication ,
293 .Cm HostbasedAuthentication
294 and using a
295 .Cm from="pattern-list"
296 option in a key file.
297 Configuration options that require DNS include using a
298 USER@HOST pattern in
299 .Cm AllowUsers
300 or
301 .Cm DenyUsers .
302 .It Fl D
303 When this option is specified
304 .Nm
305 will not detach and does not become a daemon.
306 This allows easy monitoring of
307 .Nm sshd .
308 .It Fl 4
309 Forces
310 .Nm
311 to use IPv4 addresses only.
312 .It Fl 6
313 Forces
314 .Nm
315 to use IPv6 addresses only.
316 .El
317 .Sh CONFIGURATION FILE
318 .Nm
319 reads configuration data from
320 .Pa /etc/ssh/sshd_config
321 (or the file specified with
322 .Fl f
323 on the command line).
324 The file format and configuration options are described in
325 .Xr sshd_config 5 .
326 .Sh LOGIN PROCESS
327 When a user successfully logs in,
328 .Nm
329 does the following:
330 .Bl -enum -offset indent
331 .It
332 If the login is on a tty, and no command has been specified,
333 prints last login time and
334 .Pa /etc/motd
335 (unless prevented in the configuration file or by
336 .Pa $HOME/.hushlogin ;
337 see the
338 .Sx FILES
339 section).
340 .It
341 If the login is on a tty, records login time.
342 .It
343 Checks
344 .Pa /etc/nologin and
345 .Pa /var/run/nologin ;
346 if one exists, it prints the contents and quits
347 (unless root).
348 .It
349 Changes to run with normal user privileges.
350 .It
351 Sets up basic environment.
352 .It
353 Reads
354 .Pa $HOME/.ssh/environment
355 if it exists.
356 .It
357 Changes to user's home directory.
358 .It
359 If
360 .Pa $HOME/.ssh/rc
361 exists, runs it; else if
362 .Pa /etc/ssh/sshrc
363 exists, runs
364 it; otherwise runs
365 .Xr xauth 1 .
366 The
367 .Dq rc
368 files are given the X11
369 authentication protocol and cookie (if applicable) in standard input.
370 .It
371 Runs user's shell or command.
372 .El
373 .Sh AUTHORIZED_KEYS FILE FORMAT
374 .Pa $HOME/.ssh/authorized_keys
375 is the default file that lists the public keys that are
376 permitted for RSA authentication in protocol version 1
377 and for public key authentication (PubkeyAuthentication)
378 in protocol version 2.
379 .Cm AuthorizedKeysFile
380 may be used to specify an alternative file.
381 .Pp
382 Each line of the file contains one
383 key (empty lines and lines starting with a
384 .Ql #
385 are ignored as
386 comments).
387 Each RSA public key consists of the following fields, separated by
388 spaces: options, bits, exponent, modulus, comment.
389 Each protocol version 2 public key consists of:
390 options, keytype, base64 encoded key, comment.
391 The options fields
392 are optional; its presence is determined by whether the line starts
393 with a number or not (the option field never starts with a number).
394 The bits, exponent, modulus and comment fields give the RSA key for
395 protocol version 1; the
396 comment field is not used for anything (but may be convenient for the
397 user to identify the key).
398 For protocol version 2 the keytype is
399 .Dq ssh-dss
400 or
401 .Dq ssh-rsa .
402 .Pp
403 Note that lines in this file are usually several hundred bytes long
404 (because of the size of the RSA key modulus).
405 You don't want to type them in; instead, copy the
406 .Pa identity.pub ,
407 .Pa id_dsa.pub
408 or the
409 .Pa id_rsa.pub
410 file and edit it.
411 .Pp
412 .Nm
413 enforces a minimum RSA key modulus size for protocol 1
414 and protocol 2 keys of 768 bits.
415 .Pp
416 The options (if present) consist of comma-separated option
417 specifications.
418 No spaces are permitted, except within double quotes.
419 The following option specifications are supported (note
420 that option keywords are case-insensitive):
421 .Bl -tag -width Ds
422 .It Cm from="pattern-list"
423 Specifies that in addition to RSA authentication, the canonical name
424 of the remote host must be present in the comma-separated list of
425 patterns
426 .Pf ( Ql *
427 and
428 .Ql ?
429 serve as wildcards).
430 The list may also contain
431 patterns negated by prefixing them with
432 .Ql ! ;
433 if the canonical host name matches a negated pattern, the key is not accepted.
434 The purpose
435 of this option is to optionally increase security: RSA authentication
436 by itself does not trust the network or name servers or anything (but
437 the key); however, if somebody somehow steals the key, the key
438 permits an intruder to log in from anywhere in the world.
439 This additional option makes using a stolen key more difficult (name
440 servers and/or routers would have to be compromised in addition to
441 just the key).
442 .It Cm command="command"
443 Specifies that the command is executed whenever this key is used for
444 authentication.
445 The command supplied by the user (if any) is ignored.
446 The command is run on a pty if the client requests a pty;
447 otherwise it is run without a tty.
448 If a 8-bit clean channel is required,
449 one must not request a pty or should specify
450 .Cm no-pty .
451 A quote may be included in the command by quoting it with a backslash.
452 This option might be useful
453 to restrict certain RSA keys to perform just a specific operation.
454 An example might be a key that permits remote backups but nothing else.
455 Note that the client may specify TCP/IP and/or X11
456 forwarding unless they are explicitly prohibited.
457 Note that this option applies to shell, command or subsystem execution.
458 .It Cm environment="NAME=value"
459 Specifies that the string is to be added to the environment when
460 logging in using this key.
461 Environment variables set this way
462 override other default environment values.
463 Multiple options of this type are permitted.
464 This option is automatically disabled if
465 .Cm UseLogin
466 is enabled.
467 .It Cm no-port-forwarding
468 Forbids TCP/IP forwarding when this key is used for authentication.
469 Any port forward requests by the client will return an error.
470 This might be used, e.g., in connection with the
471 .Cm command
472 option.
473 .It Cm no-X11-forwarding
474 Forbids X11 forwarding when this key is used for authentication.
475 Any X11 forward requests by the client will return an error.
476 .It Cm no-agent-forwarding
477 Forbids authentication agent forwarding when this key is used for
478 authentication.
479 .It Cm no-pty
480 Prevents tty allocation (a request to allocate a pty will fail).
481 .It Cm permitopen="host:port"
482 Limit local
483 .Li ``ssh -L''
484 port forwarding such that it may only connect to the specified host and
485 port.
486 IPv6 addresses can be specified with an alternative syntax:
487 .Ar host/port .
488 Multiple
489 .Cm permitopen
490 options may be applied separated by commas. No pattern matching is
491 performed on the specified hostnames, they must be literal domains or
492 addresses.
493 .El
494 .Ss Examples
495 1024 33 12121.\|.\|.\|312314325 ylo@foo.bar
496 .Pp
497 from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23.\|.\|.\|2334 ylo@niksula
498 .Pp
499 command="dump /home",no-pty,no-port-forwarding 1024 33 23.\|.\|.\|2323 backup.hut.fi
500 .Pp
501 permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23.\|.\|.\|2323
502 .Sh SSH_KNOWN_HOSTS FILE FORMAT
503 The
504 .Pa /etc/ssh/ssh_known_hosts
505 and
506 .Pa $HOME/.ssh/known_hosts
507 files contain host public keys for all known hosts.
508 The global file should
509 be prepared by the administrator (optional), and the per-user file is
510 maintained automatically: whenever the user connects from an unknown host
511 its key is added to the per-user file.
512 .Pp
513 Each line in these files contains the following fields: hostnames,
514 bits, exponent, modulus, comment.
515 The fields are separated by spaces.
516 .Pp
517 Hostnames is a comma-separated list of patterns ('*' and '?' act as
518 wildcards); each pattern in turn is matched against the canonical host
519 name (when authenticating a client) or against the user-supplied
520 name (when authenticating a server).
521 A pattern may also be preceded by
522 .Ql !
523 to indicate negation: if the host name matches a negated
524 pattern, it is not accepted (by that line) even if it matched another
525 pattern on the line.
526 .Pp
527 Bits, exponent, and modulus are taken directly from the RSA host key; they
528 can be obtained, e.g., from
529 .Pa /etc/ssh/ssh_host_key.pub .
530 The optional comment field continues to the end of the line, and is not used.
531 .Pp
532 Lines starting with
533 .Ql #
534 and empty lines are ignored as comments.
535 .Pp
536 When performing host authentication, authentication is accepted if any
537 matching line has the proper key.
538 It is thus permissible (but not
539 recommended) to have several lines or different host keys for the same
540 names.
541 This will inevitably happen when short forms of host names
542 from different domains are put in the file.
543 It is possible
544 that the files contain conflicting information; authentication is
545 accepted if valid information can be found from either file.
546 .Pp
547 Note that the lines in these files are typically hundreds of characters
548 long, and you definitely don't want to type in the host keys by hand.
549 Rather, generate them by a script
550 or by taking
551 .Pa /etc/ssh/ssh_host_key.pub
552 and adding the host names at the front.
553 .Ss Examples
554 .Bd -literal
555 closenet,.\|.\|.\|,130.233.208.41 1024 37 159.\|.\|.93 closenet.hut.fi
556 cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....=
557 .Ed
558 .Sh FILES
559 .Bl -tag -width Ds
560 .It Pa /etc/ssh/sshd_config
561 Contains configuration data for
562 .Nm sshd .
563 The file format and configuration options are described in
564 .Xr sshd_config 5 .
565 .It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
566 These three files contain the private parts of the host keys.
567 These files should only be owned by root, readable only by root, and not
568 accessible to others.
569 Note that
570 .Nm
571 does not start if this file is group/world-accessible.
572 .It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pub
573 These three files contain the public parts of the host keys.
574 These files should be world-readable but writable only by
575 root.
576 Their contents should match the respective private parts.
577 These files are not
578 really used for anything; they are provided for the convenience of
579 the user so their contents can be copied to known hosts files.
580 These files are created using
581 .Xr ssh-keygen 1 .
582 .It Pa /etc/ssh/moduli
583 Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
584 .It Pa /var/run/sshd.pid
585 Contains the process ID of the
586 .Nm
587 listening for connections (if there are several daemons running
588 concurrently for different ports, this contains the pid of the one
589 started last).
590 The content of this file is not sensitive; it can be world-readable.
591 .It Pa $HOME/.ssh/authorized_keys
592 Lists the public keys (RSA or DSA) that can be used to log into the user's account.
593 This file must be readable by root (which may on some machines imply
594 it being world-readable if the user's home directory resides on an NFS
595 volume).
596 It is recommended that it not be accessible by others.
597 The format of this file is described above.
598 Users will place the contents of their
599 .Pa identity.pub ,
600 .Pa id_dsa.pub
601 and/or
602 .Pa id_rsa.pub
603 files into this file, as described in
604 .Xr ssh-keygen 1 .
605 .It Pa "/etc/ssh/ssh_known_hosts" and "$HOME/.ssh/known_hosts"
606 These files are consulted when using rhosts with RSA host
607 authentication or protocol version 2 hostbased authentication
608 to check the public key of the host.
609 The key must be listed in one of these files to be accepted.
610 The client uses the same files
611 to verify that it is connecting to the correct remote host.
612 These files should be writable only by root/the owner.
613 .Pa /etc/ssh/ssh_known_hosts
614 should be world-readable, and
615 .Pa $HOME/.ssh/known_hosts
616 can but need not be world-readable.
617 .It Pa /etc/nologin
618 If this file exists,
619 .Nm
620 refuses to let anyone except root log in.
621 The contents of the file
622 are displayed to anyone trying to log in, and non-root connections are
623 refused.
624 The file should be world-readable.
625 .It Pa /etc/hosts.allow, /etc/hosts.deny
626 Access controls that should be enforced by tcp-wrappers are defined here.
627 Further details are described in
628 .Xr hosts_access 5 .
629 .It Pa $HOME/.rhosts
630 This file contains host-username pairs, separated by a space, one per
631 line.
632 The given user on the corresponding host is permitted to log in
633 without password.
634 The same file is used by rlogind and rshd.
635 The file must
636 be writable only by the user; it is recommended that it not be
637 accessible by others.
638 .Pp
639 If is also possible to use netgroups in the file.
640 Either host or user
641 name may be of the form +@groupname to specify all hosts or all users
642 in the group.
643 .It Pa $HOME/.shosts
644 For ssh,
645 this file is exactly the same as for
646 .Pa .rhosts .
647 However, this file is
648 not used by rlogin and rshd, so using this permits access using SSH only.
649 .It Pa /etc/hosts.equiv
650 This file is used during
651 .Pa .rhosts
652 authentication.
653 In the simplest form, this file contains host names, one per line.
654 Users on
655 those hosts are permitted to log in without a password, provided they
656 have the same user name on both machines.
657 The host name may also be
658 followed by a user name; such users are permitted to log in as
659 .Em any
660 user on this machine (except root).
661 Additionally, the syntax
662 .Dq +@group
663 can be used to specify netgroups.
664 Negated entries start with
665 .Ql \&- .
666 .Pp
667 If the client host/user is successfully matched in this file, login is
668 automatically permitted provided the client and server user names are the
669 same.
670 Additionally, successful RSA host authentication is normally required.
671 This file must be writable only by root; it is recommended
672 that it be world-readable.
673 .Pp
674 .Sy "Warning: It is almost never a good idea to use user names in"
675 .Pa hosts.equiv .
676 Beware that it really means that the named user(s) can log in as
677 .Em anybody ,
678 which includes bin, daemon, adm, and other accounts that own critical
679 binaries and directories.
680 Using a user name practically grants the user root access.
681 The only valid use for user names that I can think
682 of is in negative entries.
683 .Pp
684 Note that this warning also applies to rsh/rlogin.
685 .It Pa /etc/ssh/shosts.equiv
686 This is processed exactly as
687 .Pa /etc/hosts.equiv .
688 However, this file may be useful in environments that want to run both
689 rsh/rlogin and ssh.
690 .It Pa $HOME/.ssh/environment
691 This file is read into the environment at login (if it exists).
692 It can only contain empty lines, comment lines (that start with
693 .Ql # ) ,
694 and assignment lines of the form name=value.
695 The file should be writable
696 only by the user; it need not be readable by anyone else.
697 .It Pa $HOME/.ssh/rc
698 If this file exists, it is run with
699 .Pa /bin/sh
700 after reading the
701 environment files but before starting the user's shell or command.
702 It must not produce any output on stdout; stderr must be used
703 instead.
704 If X11 forwarding is in use, it will receive the "proto cookie" pair in
705 its standard input (and
706 .Ev DISPLAY
707 in its environment).
708 The script must call
709 .Xr xauth 1
710 because
711 .Nm
712 will not run xauth automatically to add X11 cookies.
713 .Pp
714 The primary purpose of this file is to run any initialization routines
715 which may be needed before the user's home directory becomes
716 accessible; AFS is a particular example of such an environment.
717 .Pp
718 This file will probably contain some initialization code followed by
719 something similar to:
720 .Bd -literal
721 if read proto cookie && [ -n "$DISPLAY" ]; then
722         if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
723                 # X11UseLocalhost=yes
724                 xauth add unix:`echo $DISPLAY |
725                     cut -c11-` $proto $cookie
726         else
727                 # X11UseLocalhost=no
728                 xauth add $DISPLAY $proto $cookie
729         fi
730 fi
731 .Ed
732 .Pp
733 If this file does not exist,
734 .Pa /etc/ssh/sshrc
735 is run, and if that
736 does not exist either, xauth is used to add the cookie.
737 .Pp
738 This file should be writable only by the user, and need not be
739 readable by anyone else.
740 .It Pa /etc/ssh/sshrc
741 Like
742 .Pa $HOME/.ssh/rc .
743 This can be used to specify
744 machine-specific login-time initializations globally.
745 This file should be writable only by root, and should be world-readable.
746 .El
747 .Sh AUTHORS
748 OpenSSH is a derivative of the original and free
749 ssh 1.2.12 release by Tatu Ylonen.
750 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
751 Theo de Raadt and Dug Song
752 removed many bugs, re-added newer features and
753 created OpenSSH.
754 Markus Friedl contributed the support for SSH
755 protocol versions 1.5 and 2.0.
756 Niels Provos and Markus Friedl contributed support
757 for privilege separation.
758 .Sh SEE ALSO
759 .Xr scp 1 ,
760 .Xr sftp 1 ,
761 .Xr ssh 1 ,
762 .Xr ssh-add 1 ,
763 .Xr ssh-agent 1 ,
764 .Xr ssh-keygen 1 ,
765 .Xr login.conf 5 ,
766 .Xr moduli 5 ,
767 .Xr sshd_config 5 ,
768 .Xr sftp-server 8
769 .Rs
770 .%A T. Ylonen
771 .%A T. Kivinen
772 .%A M. Saarinen
773 .%A T. Rinne
774 .%A S. Lehtinen
775 .%T "SSH Protocol Architecture"
776 .%N draft-ietf-secsh-architecture-12.txt
777 .%D January 2002
778 .%O work in progress material
779 .Re
780 .Rs
781 .%A M. Friedl
782 .%A N. Provos
783 .%A W. A. Simpson
784 .%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol"
785 .%N draft-ietf-secsh-dh-group-exchange-02.txt
786 .%D January 2002
787 .%O work in progress material
788 .Re