Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.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.247 2008/10/03 13:08:12 jmc Exp $
38 .Dd $Mdocdate: October 3 2008 $
39 .Dt SSHD 8
40 .Os
41 .Sh NAME
42 .Nm sshd
43 .Nd OpenSSH SSH daemon
44 .Sh SYNOPSIS
45 .Nm sshd
46 .Bk -words
47 .Op Fl 46DdeiqTt
48 .Op Fl b Ar bits
49 .Op Fl C Ar connection_spec
50 .Op Fl f Ar config_file
51 .Op Fl g Ar login_grace_time
52 .Op Fl h Ar host_key_file
53 .Op Fl k Ar key_gen_time
54 .Op Fl o Ar option
55 .Op Fl p Ar port
56 .Op Fl u Ar len
57 .Ek
58 .Sh DESCRIPTION
59 .Nm
60 (OpenSSH Daemon) is the daemon program for
61 .Xr ssh 1 .
62 Together these programs replace
63 .Xr rlogin 1
64 and
65 .Xr rsh 1 ,
66 and provide secure encrypted communications between two untrusted hosts
67 over an insecure network.
68 .Pp
69 .Nm
70 listens for connections from clients.
71 It is normally started at boot from
72 .Pa /etc/rc.d/sshd .
73 It forks a new
74 daemon for each incoming connection.
75 The forked daemons handle
76 key exchange, encryption, authentication, command execution,
77 and data exchange.
78 .Pp
79 .Nm
80 can be configured using command-line options or a configuration file
81 (by default
82 .Xr sshd_config 5 ) ;
83 command-line options override values specified in the
84 configuration file.
85 .Nm
86 rereads its configuration file when it receives a hangup signal,
87 .Dv SIGHUP ,
88 by executing itself with the name and options it was started with, e.g.\&
89 .Pa /usr/sbin/sshd .
90 .Pp
91 The options are as follows:
92 .Bl -tag -width Ds
93 .It Fl 4
94 Forces
95 .Nm
96 to use IPv4 addresses only.
97 .It Fl 6
98 Forces
99 .Nm
100 to use IPv6 addresses only.
101 .It Fl b Ar bits
102 Specifies the number of bits in the ephemeral protocol version 1
103 server key (default 1024).
104 .It Fl C Ar connection_spec
105 Specify the connection parameters to use for the
106 .Fl T
107 extended test mode.
108 If provided, any
109 .Cm Match
110 directives in the configuration file
111 that would apply to the specified user, host, and address will be set before
112 the configuration is written to standard output.
113 The connection parameters are supplied as keyword=value pairs.
114 The keywords are
115 .Dq user ,
116 .Dq host ,
117 and
118 .Dq addr .
119 All are required and may be supplied in any order, either with multiple
120 .Fl C
121 options or as a comma-separated list.
122 .It Fl D
123 When this option is specified,
124 .Nm
125 will not detach and does not become a daemon.
126 This allows easy monitoring of
127 .Nm sshd .
128 .It Fl d
129 Debug mode.
130 The server sends verbose debug output to the system
131 log, and does not put itself in the background.
132 The server also will not fork and will only process one connection.
133 This option is only intended for debugging for the server.
134 Multiple
135 .Fl d
136 options increase the debugging level.
137 Maximum is 3.
138 .It Fl e
139 When this option is specified,
140 .Nm
141 will send the output to the standard error instead of the system log.
142 .It Fl f Ar config_file
143 Specifies the name of the configuration file.
144 The default is
145 .Pa /etc/ssh/sshd_config .
146 .Nm
147 refuses to start if there is no configuration file.
148 .It Fl g Ar login_grace_time
149 Gives the grace time for clients to authenticate themselves (default
150 120 seconds).
151 If the client fails to authenticate the user within
152 this many seconds, the server disconnects and exits.
153 A value of zero indicates no limit.
154 .It Fl h Ar host_key_file
155 Specifies a file from which a host key is read.
156 This option must be given if
157 .Nm
158 is not run as root (as the normal
159 host key files are normally not readable by anyone but root).
160 The default is
161 .Pa /etc/ssh/ssh_host_key
162 for protocol version 1, and
163 .Pa /etc/ssh/ssh_host_rsa_key
164 and
165 .Pa /etc/ssh/ssh_host_dsa_key
166 for protocol version 2.
167 It is possible to have multiple host key files for
168 the different protocol versions and host key algorithms.
169 .It Fl i
170 Specifies that
171 .Nm
172 is being run from
173 .Xr inetd 8 .
174 .Nm
175 is normally not run
176 from inetd because it needs to generate the server key before it can
177 respond to the client, and this may take tens of seconds.
178 Clients would have to wait too long if the key was regenerated every time.
179 However, with small key sizes (e.g. 512) using
180 .Nm
181 from inetd may
182 be feasible.
183 .It Fl k Ar key_gen_time
184 Specifies how often the ephemeral protocol version 1 server key is
185 regenerated (default 3600 seconds, or one hour).
186 The motivation for regenerating the key fairly
187 often is that the key is not stored anywhere, and after about an hour
188 it becomes impossible to recover the key for decrypting intercepted
189 communications even if the machine is cracked into or physically
190 seized.
191 A value of zero indicates that the key will never be regenerated.
192 .It Fl o Ar option
193 Can be used to give options in the format used in the configuration file.
194 This is useful for specifying options for which there is no separate
195 command-line flag.
196 For full details of the options, and their values, see
197 .Xr sshd_config 5 .
198 .It Fl p Ar port
199 Specifies the port on which the server listens for connections
200 (default 22).
201 Multiple port options are permitted.
202 Ports specified in the configuration file with the
203 .Cm Port
204 option are ignored when a command-line port is specified.
205 Ports specified using the
206 .Cm ListenAddress
207 option override command-line ports.
208 .It Fl q
209 Quiet mode.
210 Nothing is sent to the system log.
211 Normally the beginning,
212 authentication, and termination of each connection is logged.
213 .It Fl T
214 Extended test mode.
215 Check the validity of the configuration file, output the effective configuration
216 to stdout and then exit.
217 Optionally,
218 .Cm Match
219 rules may be applied by specifying the connection parameters using one or more
220 .Fl C
221 options.
222 .It Fl t
223 Test mode.
224 Only check the validity of the configuration file and sanity of the keys.
225 This is useful for updating
226 .Nm
227 reliably as configuration options may change.
228 .It Fl u Ar len
229 This option is used to specify the size of the field
230 in the
231 .Li utmp
232 structure that holds the remote host name.
233 If the resolved host name is longer than
234 .Ar len ,
235 the dotted decimal value will be used instead.
236 This allows hosts with very long host names that
237 overflow this field to still be uniquely identified.
238 Specifying
239 .Fl u0
240 indicates that only dotted decimal addresses
241 should be put into the
242 .Pa utmp
243 file.
244 .Fl u0
245 may also be used to prevent
246 .Nm
247 from making DNS requests unless the authentication
248 mechanism or configuration requires it.
249 Authentication mechanisms that may require DNS include
250 .Cm RhostsRSAAuthentication ,
251 .Cm HostbasedAuthentication ,
252 and using a
253 .Cm from="pattern-list"
254 option in a key file.
255 Configuration options that require DNS include using a
256 USER@HOST pattern in
257 .Cm AllowUsers
258 or
259 .Cm DenyUsers .
260 .El
261 .Sh AUTHENTICATION
262 The OpenSSH SSH daemon supports SSH protocols 1 and 2.
263 Both protocols are supported by default,
264 though this can be changed via the
265 .Cm Protocol
266 option in
267 .Xr sshd_config 5 .
268 Protocol 2 supports both RSA and DSA keys;
269 protocol 1 only supports RSA keys.
270 For both protocols,
271 each host has a host-specific key,
272 normally 2048 bits,
273 used to identify the host.
274 .Pp
275 Forward security for protocol 1 is provided through
276 an additional server key,
277 normally 768 bits,
278 generated when the server starts.
279 This key is normally regenerated every hour if it has been used, and
280 is never stored on disk.
281 Whenever a client connects, the daemon responds with its public
282 host and server keys.
283 The client compares the
284 RSA host key against its own database to verify that it has not changed.
285 The client then generates a 256-bit random number.
286 It encrypts this
287 random number using both the host key and the server key, and sends
288 the encrypted number to the server.
289 Both sides then use this
290 random number as a session key which is used to encrypt all further
291 communications in the session.
292 The rest of the session is encrypted
293 using a conventional cipher, currently Blowfish or 3DES, with 3DES
294 being used by default.
295 The client selects the encryption algorithm
296 to use from those offered by the server.
297 .Pp
298 For protocol 2,
299 forward security is provided through a Diffie-Hellman key agreement.
300 This key agreement results in a shared session key.
301 The rest of the session is encrypted using a symmetric cipher, currently
302 128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.
303 The client selects the encryption algorithm
304 to use from those offered by the server.
305 Additionally, session integrity is provided
306 through a cryptographic message authentication code
307 (hmac-md5, hmac-sha1, umac-64 or hmac-ripemd160).
308 .Pp
309 Finally, the server and the client enter an authentication dialog.
310 The client tries to authenticate itself using
311 host-based authentication,
312 public key authentication,
313 challenge-response authentication,
314 or password authentication.
315 .Pp
316 Regardless of the authentication type, the account is checked to
317 ensure that it is accessible.  An account is not accessible if it is
318 locked, listed in
319 .Cm DenyUsers
320 or its group is listed in
321 .Cm DenyGroups
322 \&.  The definition of a locked account is system dependant. Some platforms
323 have their own account database (eg AIX) and some modify the passwd field (
324 .Ql \&*LK\&*
325 on Solaris and UnixWare,
326 .Ql \&*
327 on HP-UX, containing
328 .Ql Nologin
329 on Tru64,
330 a leading
331 .Ql \&*LOCKED\&*
332 on FreeBSD and a leading
333 .Ql \&!
334 on most Linuxes).
335 If there is a requirement to disable password authentication
336 for the account while allowing still public-key, then the passwd field
337 should be set to something other than these values (eg
338 .Ql NP
339 or
340 .Ql \&*NP\&*
341 ).
342 .Pp
343 If the client successfully authenticates itself, a dialog for
344 preparing the session is entered.
345 At this time the client may request
346 things like allocating a pseudo-tty, forwarding X11 connections,
347 forwarding TCP connections, or forwarding the authentication agent
348 connection over the secure channel.
349 .Pp
350 After this, the client either requests a shell or execution of a command.
351 The sides then enter session mode.
352 In this mode, either side may send
353 data at any time, and such data is forwarded to/from the shell or
354 command on the server side, and the user terminal in the client side.
355 .Pp
356 When the user program terminates and all forwarded X11 and other
357 connections have been closed, the server sends command exit status to
358 the client, and both sides exit.
359 .Sh LOGIN PROCESS
360 When a user successfully logs in,
361 .Nm
362 does the following:
363 .Bl -enum -offset indent
364 .It
365 If the login is on a tty, and no command has been specified,
366 prints last login time and
367 .Pa /etc/motd
368 (unless prevented in the configuration file or by
369 .Pa ~/.hushlogin ;
370 see the
371 .Sx FILES
372 section).
373 .It
374 If the login is on a tty, records login time.
375 .It
376 Checks
377 .Pa /etc/nologin and
378 .Pa /var/run/nologin ;
379 if one exists, it prints the contents and quits
380 (unless root).
381 .It
382 Changes to run with normal user privileges.
383 .It
384 Sets up basic environment.
385 .It
386 Reads the file
387 .Pa ~/.ssh/environment ,
388 if it exists, and users are allowed to change their environment.
389 See the
390 .Cm PermitUserEnvironment
391 option in
392 .Xr sshd_config 5 .
393 .It
394 Changes to user's home directory.
395 .It
396 If
397 .Pa ~/.ssh/rc
398 exists, runs it; else if
399 .Pa /etc/ssh/sshrc
400 exists, runs
401 it; otherwise runs
402 .Xr xauth 1 .
403 The
404 .Dq rc
405 files are given the X11
406 authentication protocol and cookie (if applicable) in standard input.
407 See
408 .Sx SSHRC ,
409 below.
410 .It
411 Runs user's shell or command.
412 .El
413 .Sh SSHRC
414 If the file
415 .Pa ~/.ssh/rc
416 exists,
417 .Xr sh 1
418 runs it after reading the
419 environment files but before starting the user's shell or command.
420 It must not produce any output on stdout; stderr must be used
421 instead.
422 If X11 forwarding is in use, it will receive the "proto cookie" pair in
423 its standard input (and
424 .Ev DISPLAY
425 in its environment).
426 The script must call
427 .Xr xauth 1
428 because
429 .Nm
430 will not run xauth automatically to add X11 cookies.
431 .Pp
432 The primary purpose of this file is to run any initialization routines
433 which may be needed before the user's home directory becomes
434 accessible; AFS is a particular example of such an environment.
435 .Pp
436 This file will probably contain some initialization code followed by
437 something similar to:
438 .Bd -literal -offset 3n
439 if read proto cookie && [ -n "$DISPLAY" ]; then
440         if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
441                 # X11UseLocalhost=yes
442                 echo add unix:`echo $DISPLAY |
443                     cut -c11-` $proto $cookie
444         else
445                 # X11UseLocalhost=no
446                 echo add $DISPLAY $proto $cookie
447         fi | xauth -q -
448 fi
449 .Ed
450 .Pp
451 If this file does not exist,
452 .Pa /etc/ssh/sshrc
453 is run, and if that
454 does not exist either, xauth is used to add the cookie.
455 .Sh AUTHORIZED_KEYS FILE FORMAT
456 .Cm AuthorizedKeysFile
457 specifies the file containing public keys for
458 public key authentication;
459 if none is specified, the default is
460 .Pa ~/.ssh/authorized_keys .
461 Each line of the file contains one
462 key (empty lines and lines starting with a
463 .Ql #
464 are ignored as
465 comments).
466 Protocol 1 public keys consist of the following space-separated fields:
467 options, bits, exponent, modulus, comment.
468 Protocol 2 public key consist of:
469 options, keytype, base64-encoded key, comment.
470 The options field is optional;
471 its presence is determined by whether the line starts
472 with a number or not (the options field never starts with a number).
473 The bits, exponent, modulus, and comment fields give the RSA key for
474 protocol version 1; the
475 comment field is not used for anything (but may be convenient for the
476 user to identify the key).
477 For protocol version 2 the keytype is
478 .Dq ssh-dss
479 or
480 .Dq ssh-rsa .
481 .Pp
482 Note that lines in this file are usually several hundred bytes long
483 (because of the size of the public key encoding) up to a limit of
484 8 kilobytes, which permits DSA keys up to 8 kilobits and RSA
485 keys up to 16 kilobits.
486 You don't want to type them in; instead, copy the
487 .Pa identity.pub ,
488 .Pa id_dsa.pub ,
489 or the
490 .Pa id_rsa.pub
491 file and edit it.
492 .Pp
493 .Nm
494 enforces a minimum RSA key modulus size for protocol 1
495 and protocol 2 keys of 768 bits.
496 .Pp
497 The options (if present) consist of comma-separated option
498 specifications.
499 No spaces are permitted, except within double quotes.
500 The following option specifications are supported (note
501 that option keywords are case-insensitive):
502 .Bl -tag -width Ds
503 .It Cm command="command"
504 Specifies that the command is executed whenever this key is used for
505 authentication.
506 The command supplied by the user (if any) is ignored.
507 The command is run on a pty if the client requests a pty;
508 otherwise it is run without a tty.
509 If an 8-bit clean channel is required,
510 one must not request a pty or should specify
511 .Cm no-pty .
512 A quote may be included in the command by quoting it with a backslash.
513 This option might be useful
514 to restrict certain public keys to perform just a specific operation.
515 An example might be a key that permits remote backups but nothing else.
516 Note that the client may specify TCP and/or X11
517 forwarding unless they are explicitly prohibited.
518 The command originally supplied by the client is available in the
519 .Ev SSH_ORIGINAL_COMMAND
520 environment variable.
521 Note that this option applies to shell, command or subsystem execution.
522 .It Cm environment="NAME=value"
523 Specifies that the string is to be added to the environment when
524 logging in using this key.
525 Environment variables set this way
526 override other default environment values.
527 Multiple options of this type are permitted.
528 Environment processing is disabled by default and is
529 controlled via the
530 .Cm PermitUserEnvironment
531 option.
532 This option is automatically disabled if
533 .Cm UseLogin
534 is enabled.
535 .It Cm from="pattern-list"
536 Specifies that in addition to public key authentication, either the canonical
537 name of the remote host or its IP address must be present in the
538 comma-separated list of patterns.
539 See
540 .Sx PATTERNS
541 in
542 .Xr ssh_config 5
543 for more information on patterns.
544 .Pp
545 In addition to the wildcard matching that may be applied to hostnames or
546 addresses, a
547 .Cm from
548 stanza may match IP addressess using CIDR address/masklen notation.
549 .Pp
550 The purpose of this option is to optionally increase security: public key
551 authentication by itself does not trust the network or name servers or
552 anything (but the key); however, if somebody somehow steals the key, the key
553 permits an intruder to log in from anywhere in the world.
554 This additional option makes using a stolen key more difficult (name
555 servers and/or routers would have to be compromised in addition to
556 just the key).
557 .It Cm no-agent-forwarding
558 Forbids authentication agent forwarding when this key is used for
559 authentication.
560 .It Cm no-port-forwarding
561 Forbids TCP forwarding when this key is used for authentication.
562 Any port forward requests by the client will return an error.
563 This might be used, e.g. in connection with the
564 .Cm command
565 option.
566 .It Cm no-pty
567 Prevents tty allocation (a request to allocate a pty will fail).
568 .It Cm no-user-rc
569 Disables execution of
570 .Pa ~/.ssh/rc .
571 .It Cm no-X11-forwarding
572 Forbids X11 forwarding when this key is used for authentication.
573 Any X11 forward requests by the client will return an error.
574 .It Cm permitopen="host:port"
575 Limit local
576 .Li ``ssh -L''
577 port forwarding such that it may only connect to the specified host and
578 port.
579 IPv6 addresses can be specified with an alternative syntax:
580 .Ar host Ns / Ns Ar port .
581 Multiple
582 .Cm permitopen
583 options may be applied separated by commas.
584 No pattern matching is performed on the specified hostnames,
585 they must be literal domains or addresses.
586 .It Cm tunnel="n"
587 Force a
588 .Xr tun 4
589 device on the server.
590 Without this option, the next available device will be used if
591 the client requests a tunnel.
592 .El
593 .Pp
594 An example authorized_keys file:
595 .Bd -literal -offset 3n
596 # Comments allowed at start of line
597 ssh-rsa AAAAB3Nza...LiPk== user@example.net
598 from="*.sales.example.net,!pc.sales.example.net" ssh-rsa
599 AAAAB2...19Q== john@example.net
600 command="dump /home",no-pty,no-port-forwarding ssh-dss
601 AAAAC3...51R== example.net
602 permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
603 AAAAB5...21S==
604 tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
605 jane@example.net
606 .Ed
607 .Sh SSH_KNOWN_HOSTS FILE FORMAT
608 The
609 .Pa /etc/ssh/ssh_known_hosts
610 and
611 .Pa ~/.ssh/known_hosts
612 files contain host public keys for all known hosts.
613 The global file should
614 be prepared by the administrator (optional), and the per-user file is
615 maintained automatically: whenever the user connects from an unknown host,
616 its key is added to the per-user file.
617 .Pp
618 Each line in these files contains the following fields: hostnames,
619 bits, exponent, modulus, comment.
620 The fields are separated by spaces.
621 .Pp
622 Hostnames is a comma-separated list of patterns
623 .Pf ( Ql *
624 and
625 .Ql \&?
626 act as
627 wildcards); each pattern in turn is matched against the canonical host
628 name (when authenticating a client) or against the user-supplied
629 name (when authenticating a server).
630 A pattern may also be preceded by
631 .Ql \&!
632 to indicate negation: if the host name matches a negated
633 pattern, it is not accepted (by that line) even if it matched another
634 pattern on the line.
635 A hostname or address may optionally be enclosed within
636 .Ql \&[
637 and
638 .Ql \&]
639 brackets then followed by
640 .Ql \&:
641 and a non-standard port number.
642 .Pp
643 Alternately, hostnames may be stored in a hashed form which hides host names
644 and addresses should the file's contents be disclosed.
645 Hashed hostnames start with a
646 .Ql |
647 character.
648 Only one hashed hostname may appear on a single line and none of the above
649 negation or wildcard operators may be applied.
650 .Pp
651 Bits, exponent, and modulus are taken directly from the RSA host key; they
652 can be obtained, for example, from
653 .Pa /etc/ssh/ssh_host_key.pub .
654 The optional comment field continues to the end of the line, and is not used.
655 .Pp
656 Lines starting with
657 .Ql #
658 and empty lines are ignored as comments.
659 .Pp
660 When performing host authentication, authentication is accepted if any
661 matching line has the proper key.
662 It is thus permissible (but not
663 recommended) to have several lines or different host keys for the same
664 names.
665 This will inevitably happen when short forms of host names
666 from different domains are put in the file.
667 It is possible
668 that the files contain conflicting information; authentication is
669 accepted if valid information can be found from either file.
670 .Pp
671 Note that the lines in these files are typically hundreds of characters
672 long, and you definitely don't want to type in the host keys by hand.
673 Rather, generate them by a script
674 or by taking
675 .Pa /etc/ssh/ssh_host_key.pub
676 and adding the host names at the front.
677 .Pp
678 An example ssh_known_hosts file:
679 .Bd -literal -offset 3n
680 # Comments allowed at start of line
681 closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
682 cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
683 # A hashed hostname
684 |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
685 AAAA1234.....=
686 .Ed
687 .Sh FILES
688 .Bl -tag -width Ds -compact
689 .It ~/.hushlogin
690 This file is used to suppress printing the last login time and
691 .Pa /etc/motd ,
692 if
693 .Cm PrintLastLog
694 and
695 .Cm PrintMotd ,
696 respectively,
697 are enabled.
698 It does not suppress printing of the banner specified by
699 .Cm Banner .
700 .Pp
701 .It ~/.rhosts
702 This file is used for host-based authentication (see
703 .Xr ssh 1
704 for more information).
705 On some machines this file may need to be
706 world-readable if the user's home directory is on an NFS partition,
707 because
708 .Nm
709 reads it as root.
710 Additionally, this file must be owned by the user,
711 and must not have write permissions for anyone else.
712 The recommended
713 permission for most machines is read/write for the user, and not
714 accessible by others.
715 .Pp
716 .It ~/.shosts
717 This file is used in exactly the same way as
718 .Pa .rhosts ,
719 but allows host-based authentication without permitting login with
720 rlogin/rsh.
721 .Pp
722 .It ~/.ssh/
723 This directory is the default location for all user-specific configuration
724 and authentication information.
725 There is no general requirement to keep the entire contents of this directory
726 secret, but the recommended permissions are read/write/execute for the user,
727 and not accessible by others.
728 .Pp
729 .It ~/.ssh/authorized_keys
730 Lists the public keys (RSA/DSA) that can be used for logging in as this user.
731 The format of this file is described above.
732 The content of the file is not highly sensitive, but the recommended
733 permissions are read/write for the user, and not accessible by others.
734 .Pp
735 If this file, the
736 .Pa ~/.ssh
737 directory, or the user's home directory are writable
738 by other users, then the file could be modified or replaced by unauthorized
739 users.
740 In this case,
741 .Nm
742 will not allow it to be used unless the
743 .Cm StrictModes
744 option has been set to
745 .Dq no .
746 .Pp
747 .It ~/.ssh/environment
748 This file is read into the environment at login (if it exists).
749 It can only contain empty lines, comment lines (that start with
750 .Ql # ) ,
751 and assignment lines of the form name=value.
752 The file should be writable
753 only by the user; it need not be readable by anyone else.
754 Environment processing is disabled by default and is
755 controlled via the
756 .Cm PermitUserEnvironment
757 option.
758 .Pp
759 .It ~/.ssh/known_hosts
760 Contains a list of host keys for all hosts the user has logged into
761 that are not already in the systemwide list of known host keys.
762 The format of this file is described above.
763 This file should be writable only by root/the owner and
764 can, but need not be, world-readable.
765 .Pp
766 .It ~/.ssh/rc
767 Contains initialization routines to be run before
768 the user's home directory becomes accessible.
769 This file should be writable only by the user, and need not be
770 readable by anyone else.
771 .Pp
772 .It /etc/hosts.allow
773 .It /etc/hosts.deny
774 Access controls that should be enforced by tcp-wrappers are defined here.
775 Further details are described in
776 .Xr hosts_access 5 .
777 .Pp
778 .It /etc/hosts.equiv
779 This file is for host-based authentication (see
780 .Xr ssh 1 ) .
781 It should only be writable by root.
782 .Pp
783 .It /etc/ssh/moduli
784 Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
785 The file format is described in
786 .Xr moduli 5 .
787 .Pp
788 .It /etc/motd
789 See
790 .Xr motd 5 .
791 .Pp
792 .It /etc/nologin
793 If this file exists,
794 .Nm
795 refuses to let anyone except root log in.
796 The contents of the file
797 are displayed to anyone trying to log in, and non-root connections are
798 refused.
799 The file should be world-readable.
800 .Pp
801 .It /etc/ssh/shosts.equiv
802 This file is used in exactly the same way as
803 .Pa hosts.equiv ,
804 but allows host-based authentication without permitting login with
805 rlogin/rsh.
806 .Pp
807 .It /etc/ssh/ssh_host_key
808 .It /etc/ssh/ssh_host_dsa_key
809 .It /etc/ssh/ssh_host_rsa_key
810 These three files contain the private parts of the host keys.
811 These files should only be owned by root, readable only by root, and not
812 accessible to others.
813 Note that
814 .Nm
815 does not start if these files are group/world-accessible.
816 .Pp
817 .It /etc/ssh/ssh_host_key.pub
818 .It /etc/ssh/ssh_host_dsa_key.pub
819 .It /etc/ssh/ssh_host_rsa_key.pub
820 These three files contain the public parts of the host keys.
821 These files should be world-readable but writable only by
822 root.
823 Their contents should match the respective private parts.
824 These files are not
825 really used for anything; they are provided for the convenience of
826 the user so their contents can be copied to known hosts files.
827 These files are created using
828 .Xr ssh-keygen 1 .
829 .Pp
830 .It /etc/ssh/ssh_known_hosts
831 Systemwide list of known host keys.
832 This file should be prepared by the
833 system administrator to contain the public host keys of all machines in the
834 organization.
835 The format of this file is described above.
836 This file should be writable only by root/the owner and
837 should be world-readable.
838 .Pp
839 .It /etc/ssh/sshd_config
840 Contains configuration data for
841 .Nm sshd .
842 The file format and configuration options are described in
843 .Xr sshd_config 5 .
844 .Pp
845 .It /etc/ssh/sshrc
846 Similar to
847 .Pa ~/.ssh/rc ,
848 it can be used to specify
849 machine-specific login-time initializations globally.
850 This file should be writable only by root, and should be world-readable.
851 .Pp
852 .It /var/empty
853 .Xr chroot 2
854 directory used by
855 .Nm
856 during privilege separation in the pre-authentication phase.
857 The directory should not contain any files and must be owned by root
858 and not group or world-writable.
859 .Pp
860 .It /var/run/sshd.pid
861 Contains the process ID of the
862 .Nm
863 listening for connections (if there are several daemons running
864 concurrently for different ports, this contains the process ID of the one
865 started last).
866 The content of this file is not sensitive; it can be world-readable.
867 .El
868 .Sh SEE ALSO
869 .Xr scp 1 ,
870 .Xr sftp 1 ,
871 .Xr ssh 1 ,
872 .Xr ssh-add 1 ,
873 .Xr ssh-agent 1 ,
874 .Xr ssh-keygen 1 ,
875 .Xr ssh-keyscan 1 ,
876 .Xr chroot 2 ,
877 .Xr hosts_access 5 ,
878 .Xr login.conf 5 ,
879 .Xr moduli 5 ,
880 .Xr sshd_config 5 ,
881 .Xr inetd 8 ,
882 .Xr sftp-server 8
883 .Sh AUTHORS
884 OpenSSH is a derivative of the original and free
885 ssh 1.2.12 release by Tatu Ylonen.
886 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
887 Theo de Raadt and Dug Song
888 removed many bugs, re-added newer features and
889 created OpenSSH.
890 Markus Friedl contributed the support for SSH
891 protocol versions 1.5 and 2.0.
892 Niels Provos and Markus Friedl contributed support
893 for privilege separation.
894 .Sh CAVEATS
895 System security is not improved unless
896 .Nm rshd ,
897 .Nm rlogind ,
898 and
899 .Nm rexecd
900 are disabled (thus completely disabling
901 .Xr rlogin
902 and
903 .Xr rsh
904 into the machine).