sshd.0 revision 214979
1180740SdesSSHD(8)                 OpenBSD System Manager's Manual                SSHD(8)
2180740Sdes
3180740SdesNAME
4180740Sdes     sshd - OpenSSH SSH daemon
5180740Sdes
6180740SdesSYNOPSIS
7204861Sdes     sshd [-46DdeiqTt] [-b bits] [-C connection_spec]
8204861Sdes          [-c host_certificate_file] [-f config_file] [-g login_grace_time]
9204861Sdes          [-h host_key_file] [-k key_gen_time] [-o option] [-p port] [-u len]
10180740Sdes
11180740SdesDESCRIPTION
12180740Sdes     sshd (OpenSSH Daemon) is the daemon program for ssh(1).  Together these
13214979Sdes     programs replace rlogin(1) and rsh(1), and provide secure encrypted
14214979Sdes     communications between two untrusted hosts over an insecure network.
15180740Sdes
16180740Sdes     sshd listens for connections from clients.  It is normally started at
17180740Sdes     boot from /etc/rc.  It forks a new daemon for each incoming connection.
18214979Sdes     The forked daemons handle key exchange, encryption, authentication,
19214979Sdes     command execution, and data exchange.
20180740Sdes
21180740Sdes     sshd can be configured using command-line options or a configuration file
22214979Sdes     (by default sshd_config(5)); command-line options override values
23214979Sdes     specified in the configuration file.  sshd rereads its configuration file
24214979Sdes     when it receives a hangup signal, SIGHUP, by executing itself with the
25214979Sdes     name and options it was started with, e.g. /usr/sbin/sshd.
26180740Sdes
27180740Sdes     The options are as follows:
28180740Sdes
29180740Sdes     -4      Forces sshd to use IPv4 addresses only.
30180740Sdes
31180740Sdes     -6      Forces sshd to use IPv6 addresses only.
32180740Sdes
33180740Sdes     -b bits
34180740Sdes             Specifies the number of bits in the ephemeral protocol version 1
35180750Sdes             server key (default 1024).
36180740Sdes
37180750Sdes     -C connection_spec
38180750Sdes             Specify the connection parameters to use for the -T extended test
39180750Sdes             mode.  If provided, any Match directives in the configuration
40180750Sdes             file that would apply to the specified user, host, and address
41214979Sdes             will be set before the configuration is written to standard
42214979Sdes             output.  The connection parameters are supplied as keyword=value
43180750Sdes             pairs.  The keywords are ``user'', ``host'', and ``addr''.  All
44214979Sdes             are required and may be supplied in any order, either with
45214979Sdes             multiple -C options or as a comma-separated list.
46180750Sdes
47204861Sdes     -c host_certificate_file
48204861Sdes             Specifies a path to a certificate file to identify sshd during
49204861Sdes             key exchange.  The certificate file must match a host key file
50214979Sdes             specified using the -h option or the HostKey configuration
51214979Sdes             directive.
52204861Sdes
53180740Sdes     -D      When this option is specified, sshd will not detach and does not
54180740Sdes             become a daemon.  This allows easy monitoring of sshd.
55180740Sdes
56204861Sdes     -d      Debug mode.  The server sends verbose debug output to standard
57214979Sdes             error, and does not put itself in the background.  The server
58214979Sdes             also will not fork and will only process one connection.  This
59214979Sdes             option is only intended for debugging for the server.  Multiple
60214979Sdes             -d options increase the debugging level.  Maximum is 3.
61180740Sdes
62180740Sdes     -e      When this option is specified, sshd will send the output to the
63180740Sdes             standard error instead of the system log.
64180740Sdes
65180744Sdes     -f config_file
66180740Sdes             Specifies the name of the configuration file.  The default is
67214979Sdes             /etc/ssh/sshd_config.  sshd refuses to start if there is no
68214979Sdes             configuration file.
69180740Sdes
70180740Sdes     -g login_grace_time
71214979Sdes             Gives the grace time for clients to authenticate themselves
72214979Sdes             (default 120 seconds).  If the client fails to authenticate the
73214979Sdes             user within this many seconds, the server disconnects and exits.
74214979Sdes             A value of zero indicates no limit.
75180740Sdes
76180740Sdes     -h host_key_file
77180740Sdes             Specifies a file from which a host key is read.  This option must
78180740Sdes             be given if sshd is not run as root (as the normal host key files
79180740Sdes             are normally not readable by anyone but root).  The default is
80180740Sdes             /etc/ssh/ssh_host_key for protocol version 1, and
81214979Sdes             /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key for
82214979Sdes             protocol version 2.  It is possible to have multiple host key
83214979Sdes             files for the different protocol versions and host key
84214979Sdes             algorithms.
85180740Sdes
86180740Sdes     -i      Specifies that sshd is being run from inetd(8).  sshd is normally
87180740Sdes             not run from inetd because it needs to generate the server key
88180740Sdes             before it can respond to the client, and this may take tens of
89214979Sdes             seconds.  Clients would have to wait too long if the key was
90214979Sdes             regenerated every time.  However, with small key sizes (e.g. 512)
91180740Sdes             using sshd from inetd may be feasible.
92180740Sdes
93180740Sdes     -k key_gen_time
94180740Sdes             Specifies how often the ephemeral protocol version 1 server key
95214979Sdes             is regenerated (default 3600 seconds, or one hour).  The
96214979Sdes             motivation for regenerating the key fairly often is that the key
97214979Sdes             is not stored anywhere, and after about an hour it becomes
98214979Sdes             impossible to recover the key for decrypting intercepted
99214979Sdes             communications even if the machine is cracked into or physically
100214979Sdes             seized.  A value of zero indicates that the key will never be
101214979Sdes             regenerated.
102180740Sdes
103180740Sdes     -o option
104214979Sdes             Can be used to give options in the format used in the
105214979Sdes             configuration file.  This is useful for specifying options for
106214979Sdes             which there is no separate command-line flag.  For full details
107214979Sdes             of the options, and their values, see sshd_config(5).
108180740Sdes
109180740Sdes     -p port
110180740Sdes             Specifies the port on which the server listens for connections
111214979Sdes             (default 22).  Multiple port options are permitted.  Ports
112214979Sdes             specified in the configuration file with the Port option are
113214979Sdes             ignored when a command-line port is specified.  Ports specified
114214979Sdes             using the ListenAddress option override command-line ports.
115180740Sdes
116214979Sdes     -q      Quiet mode.  Nothing is sent to the system log.  Normally the
117214979Sdes             beginning, authentication, and termination of each connection is
118180740Sdes             logged.
119180740Sdes
120180750Sdes     -T      Extended test mode.  Check the validity of the configuration
121180750Sdes             file, output the effective configuration to stdout and then exit.
122214979Sdes             Optionally, Match rules may be applied by specifying the
123214979Sdes             connection parameters using one or more -C options.
124180750Sdes
125180740Sdes     -t      Test mode.  Only check the validity of the configuration file and
126180740Sdes             sanity of the keys.  This is useful for updating sshd reliably as
127180740Sdes             configuration options may change.
128180740Sdes
129180740Sdes     -u len  This option is used to specify the size of the field in the utmp
130180740Sdes             structure that holds the remote host name.  If the resolved host
131180740Sdes             name is longer than len, the dotted decimal value will be used
132214979Sdes             instead.  This allows hosts with very long host names that
133214979Sdes             overflow this field to still be uniquely identified.  Specifying
134214979Sdes             -u0 indicates that only dotted decimal addresses should be put
135214979Sdes             into the utmp file.  -u0 may also be used to prevent sshd from
136214979Sdes             making DNS requests unless the authentication mechanism or
137214979Sdes             configuration requires it.  Authentication mechanisms that may
138214979Sdes             require DNS include RhostsRSAAuthentication,
139214979Sdes             HostbasedAuthentication, and using a from="pattern-list" option
140214979Sdes             in a key file.  Configuration options that require DNS include
141214979Sdes             using a USER@HOST pattern in AllowUsers or DenyUsers.
142180740Sdes
143180740SdesAUTHENTICATION
144204861Sdes     The OpenSSH SSH daemon supports SSH protocols 1 and 2.  The default is to
145204861Sdes     use protocol 2 only, though this can be changed via the Protocol option
146204861Sdes     in sshd_config(5).  Protocol 2 supports both RSA and DSA keys; protocol 1
147214979Sdes     only supports RSA keys.  For both protocols, each host has a host-
148214979Sdes     specific key, normally 2048 bits, used to identify the host.
149180740Sdes
150180740Sdes     Forward security for protocol 1 is provided through an additional server
151180740Sdes     key, normally 768 bits, generated when the server starts.  This key is
152180740Sdes     normally regenerated every hour if it has been used, and is never stored
153180740Sdes     on disk.  Whenever a client connects, the daemon responds with its public
154180740Sdes     host and server keys.  The client compares the RSA host key against its
155214979Sdes     own database to verify that it has not changed.  The client then
156214979Sdes     generates a 256-bit random number.  It encrypts this random number using
157214979Sdes     both the host key and the server key, and sends the encrypted number to
158214979Sdes     the server.  Both sides then use this random number as a session key
159214979Sdes     which is used to encrypt all further communications in the session.  The
160214979Sdes     rest of the session is encrypted using a conventional cipher, currently
161214979Sdes     Blowfish or 3DES, with 3DES being used by default.  The client selects
162214979Sdes     the encryption algorithm to use from those offered by the server.
163180740Sdes
164180740Sdes     For protocol 2, forward security is provided through a Diffie-Hellman key
165180740Sdes     agreement.  This key agreement results in a shared session key.  The rest
166180740Sdes     of the session is encrypted using a symmetric cipher, currently 128-bit
167180740Sdes     AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES.  The
168180740Sdes     client selects the encryption algorithm to use from those offered by the
169214979Sdes     server.  Additionally, session integrity is provided through a
170214979Sdes     cryptographic message authentication code (hmac-md5, hmac-sha1, umac-64
171214979Sdes     or hmac-ripemd160).
172180740Sdes
173180740Sdes     Finally, the server and the client enter an authentication dialog.  The
174214979Sdes     client tries to authenticate itself using host-based authentication,
175214979Sdes     public key authentication, challenge-response authentication, or password
176180740Sdes     authentication.
177180740Sdes
178180740Sdes     Regardless of the authentication type, the account is checked to ensure
179180740Sdes     that it is accessible.  An account is not accessible if it is locked,
180214979Sdes     listed in DenyUsers or its group is listed in DenyGroups .  The
181214979Sdes     definition of a locked account is system dependant. Some platforms have
182214979Sdes     their own account database (eg AIX) and some modify the passwd field (
183214979Sdes     `*LK*' on Solaris and UnixWare, `*' on HP-UX, containing `Nologin' on
184214979Sdes     Tru64, a leading `*LOCKED*' on FreeBSD and a leading `!' on most
185214979Sdes     Linuxes).  If there is a requirement to disable password authentication
186214979Sdes     for the account while allowing still public-key, then the passwd field
187214979Sdes     should be set to something other than these values (eg `NP' or `*NP*' ).
188180740Sdes
189180740Sdes     If the client successfully authenticates itself, a dialog for preparing
190180740Sdes     the session is entered.  At this time the client may request things like
191214979Sdes     allocating a pseudo-tty, forwarding X11 connections, forwarding TCP
192214979Sdes     connections, or forwarding the authentication agent connection over the
193214979Sdes     secure channel.
194180740Sdes
195180740Sdes     After this, the client either requests a shell or execution of a command.
196180740Sdes     The sides then enter session mode.  In this mode, either side may send
197180740Sdes     data at any time, and such data is forwarded to/from the shell or command
198180740Sdes     on the server side, and the user terminal in the client side.
199180740Sdes
200214979Sdes     When the user program terminates and all forwarded X11 and other
201214979Sdes     connections have been closed, the server sends command exit status to the
202180740Sdes     client, and both sides exit.
203180740Sdes
204180740SdesLOGIN PROCESS
205180740Sdes     When a user successfully logs in, sshd does the following:
206180740Sdes
207180740Sdes           1.   If the login is on a tty, and no command has been specified,
208180740Sdes                prints last login time and /etc/motd (unless prevented in the
209180740Sdes                configuration file or by ~/.hushlogin; see the FILES section).
210180740Sdes
211180740Sdes           2.   If the login is on a tty, records login time.
212180740Sdes
213180740Sdes           3.   Checks /etc/nologin; if it exists, prints contents and quits
214180740Sdes                (unless root).
215180740Sdes
216180740Sdes           4.   Changes to run with normal user privileges.
217180740Sdes
218180740Sdes           5.   Sets up basic environment.
219180740Sdes
220180740Sdes           6.   Reads the file ~/.ssh/environment, if it exists, and users are
221180740Sdes                allowed to change their environment.  See the
222180740Sdes                PermitUserEnvironment option in sshd_config(5).
223180740Sdes
224180740Sdes           7.   Changes to user's home directory.
225180740Sdes
226180740Sdes           8.   If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists,
227180740Sdes                runs it; otherwise runs xauth.  The ``rc'' files are given the
228180740Sdes                X11 authentication protocol and cookie in standard input.  See
229180740Sdes                SSHRC, below.
230180740Sdes
231180740Sdes           9.   Runs user's shell or command.
232180740Sdes
233180740SdesSSHRC
234180740Sdes     If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment
235214979Sdes     files but before starting the user's shell or command.  It must not
236214979Sdes     produce any output on stdout; stderr must be used instead.  If X11
237214979Sdes     forwarding is in use, it will receive the "proto cookie" pair in its
238214979Sdes     standard input (and DISPLAY in its environment).  The script must call
239214979Sdes     xauth(1) because sshd will not run xauth automatically to add X11
240214979Sdes     cookies.
241180740Sdes
242180740Sdes     The primary purpose of this file is to run any initialization routines
243180740Sdes     which may be needed before the user's home directory becomes accessible;
244180740Sdes     AFS is a particular example of such an environment.
245180740Sdes
246180740Sdes     This file will probably contain some initialization code followed by
247180740Sdes     something similar to:
248180740Sdes
249180740Sdes        if read proto cookie && [ -n "$DISPLAY" ]; then
250180740Sdes                if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
251180740Sdes                        # X11UseLocalhost=yes
252180740Sdes                        echo add unix:`echo $DISPLAY |
253180740Sdes                            cut -c11-` $proto $cookie
254180740Sdes                else
255180740Sdes                        # X11UseLocalhost=no
256180740Sdes                        echo add $DISPLAY $proto $cookie
257180740Sdes                fi | xauth -q -
258180740Sdes        fi
259180740Sdes
260180740Sdes     If this file does not exist, /etc/ssh/sshrc is run, and if that does not
261180740Sdes     exist either, xauth is used to add the cookie.
262180740Sdes
263180740SdesAUTHORIZED_KEYS FILE FORMAT
264180740Sdes     AuthorizedKeysFile specifies the file containing public keys for public
265180740Sdes     key authentication; if none is specified, the default is
266180740Sdes     ~/.ssh/authorized_keys.  Each line of the file contains one key (empty
267180740Sdes     lines and lines starting with a `#' are ignored as comments).  Protocol 1
268180740Sdes     public keys consist of the following space-separated fields: options,
269214979Sdes     bits, exponent, modulus, comment.  Protocol 2 public key consist of:
270214979Sdes     options, keytype, base64-encoded key, comment.  The options field is
271214979Sdes     optional; its presence is determined by whether the line starts with a
272214979Sdes     number or not (the options field never starts with a number).  The bits,
273214979Sdes     exponent, modulus, and comment fields give the RSA key for protocol
274214979Sdes     version 1; the comment field is not used for anything (but may be
275214979Sdes     convenient for the user to identify the key).  For protocol version 2 the
276214979Sdes     keytype is ``ssh-dss'' or ``ssh-rsa''.
277180740Sdes
278214979Sdes     Note that lines in this file are usually several hundred bytes long
279214979Sdes     (because of the size of the public key encoding) up to a limit of 8
280214979Sdes     kilobytes, which permits DSA keys up to 8 kilobits and RSA keys up to 16
281180740Sdes     kilobits.  You don't want to type them in; instead, copy the
282180740Sdes     identity.pub, id_dsa.pub, or the id_rsa.pub file and edit it.
283180740Sdes
284180740Sdes     sshd enforces a minimum RSA key modulus size for protocol 1 and protocol
285180740Sdes     2 keys of 768 bits.
286180740Sdes
287214979Sdes     The options (if present) consist of comma-separated option
288214979Sdes     specifications.  No spaces are permitted, except within double quotes.
289214979Sdes     The following option specifications are supported (note that option
290214979Sdes     keywords are case-insensitive):
291180740Sdes
292204861Sdes     cert-authority
293204861Sdes             Specifies that the listed key is a certification authority (CA)
294214979Sdes             that is trusted to validate signed certificates for user
295214979Sdes             authentication.
296204861Sdes
297204861Sdes             Certificates may encode access restrictions similar to these key
298204861Sdes             options.  If both certificate restrictions and key options are
299204861Sdes             present, the most restrictive union of the two is applied.
300204861Sdes
301180740Sdes     command="command"
302180740Sdes             Specifies that the command is executed whenever this key is used
303180740Sdes             for authentication.  The command supplied by the user (if any) is
304180740Sdes             ignored.  The command is run on a pty if the client requests a
305214979Sdes             pty; otherwise it is run without a tty.  If an 8-bit clean
306214979Sdes             channel is required, one must not request a pty or should specify
307214979Sdes             no-pty.  A quote may be included in the command by quoting it
308214979Sdes             with a backslash.  This option might be useful to restrict
309214979Sdes             certain public keys to perform just a specific operation.  An
310214979Sdes             example might be a key that permits remote backups but nothing
311214979Sdes             else.  Note that the client may specify TCP and/or X11 forwarding
312214979Sdes             unless they are explicitly prohibited.  The command originally
313214979Sdes             supplied by the client is available in the SSH_ORIGINAL_COMMAND
314214979Sdes             environment variable.  Note that this option applies to shell,
315214979Sdes             command or subsystem execution.  Also note that this command may
316214979Sdes             be superseded by either a sshd_config(5) ForceCommand directive
317214979Sdes             or a command embedded in a certificate.
318180740Sdes
319180740Sdes     environment="NAME=value"
320180740Sdes             Specifies that the string is to be added to the environment when
321180740Sdes             logging in using this key.  Environment variables set this way
322180740Sdes             override other default environment values.  Multiple options of
323180740Sdes             this type are permitted.  Environment processing is disabled by
324180740Sdes             default and is controlled via the PermitUserEnvironment option.
325180740Sdes             This option is automatically disabled if UseLogin is enabled.
326180740Sdes
327180740Sdes     from="pattern-list"
328180750Sdes             Specifies that in addition to public key authentication, either
329180750Sdes             the canonical name of the remote host or its IP address must be
330180750Sdes             present in the comma-separated list of patterns.  See PATTERNS in
331180750Sdes             ssh_config(5) for more information on patterns.
332180740Sdes
333214979Sdes             In addition to the wildcard matching that may be applied to
334214979Sdes             hostnames or addresses, a from stanza may match IP addresses
335214979Sdes             using CIDR address/masklen notation.
336180740Sdes
337180750Sdes             The purpose of this option is to optionally increase security:
338180750Sdes             public key authentication by itself does not trust the network or
339180750Sdes             name servers or anything (but the key); however, if somebody
340180750Sdes             somehow steals the key, the key permits an intruder to log in
341180750Sdes             from anywhere in the world.  This additional option makes using a
342180750Sdes             stolen key more difficult (name servers and/or routers would have
343180750Sdes             to be compromised in addition to just the key).
344180750Sdes
345180740Sdes     no-agent-forwarding
346180740Sdes             Forbids authentication agent forwarding when this key is used for
347180740Sdes             authentication.
348180740Sdes
349180740Sdes     no-port-forwarding
350180740Sdes             Forbids TCP forwarding when this key is used for authentication.
351180740Sdes             Any port forward requests by the client will return an error.
352180740Sdes             This might be used, e.g. in connection with the command option.
353180740Sdes
354180740Sdes     no-pty  Prevents tty allocation (a request to allocate a pty will fail).
355180740Sdes
356180746Sdes     no-user-rc
357180746Sdes             Disables execution of ~/.ssh/rc.
358180746Sdes
359180740Sdes     no-X11-forwarding
360180740Sdes             Forbids X11 forwarding when this key is used for authentication.
361180740Sdes             Any X11 forward requests by the client will return an error.
362180740Sdes
363180740Sdes     permitopen="host:port"
364214979Sdes             Limit local ``ssh -L'' port forwarding such that it may only
365214979Sdes             connect to the specified host and port.  IPv6 addresses can be
366214979Sdes             specified by enclosing the address in square brackets.  Multiple
367214979Sdes             permitopen options may be applied separated by commas.  No
368214979Sdes             pattern matching is performed on the specified hostnames, they
369214979Sdes             must be literal domains or addresses.
370180740Sdes
371214979Sdes     principals="principals"
372214979Sdes             On a cert-authority line, specifies allowed principals for
373214979Sdes             certificate authentication as a comma-separated list.  At least
374214979Sdes             one name from the list must appear in the certificate's list of
375214979Sdes             principals for the certificate to be accepted.  This option is
376214979Sdes             ignored for keys that are not marked as trusted certificate
377214979Sdes             signers using the cert-authority option.
378214979Sdes
379180740Sdes     tunnel="n"
380180740Sdes             Force a tun(4) device on the server.  Without this option, the
381214979Sdes             next available device will be used if the client requests a
382214979Sdes             tunnel.
383180740Sdes
384180740Sdes     An example authorized_keys file:
385180740Sdes
386180740Sdes        # Comments allowed at start of line
387180740Sdes        ssh-rsa AAAAB3Nza...LiPk== user@example.net
388180740Sdes        from="*.sales.example.net,!pc.sales.example.net" ssh-rsa
389180740Sdes        AAAAB2...19Q== john@example.net
390180740Sdes        command="dump /home",no-pty,no-port-forwarding ssh-dss
391180740Sdes        AAAAC3...51R== example.net
392180740Sdes        permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
393180740Sdes        AAAAB5...21S==
394180740Sdes        tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
395180740Sdes        jane@example.net
396180740Sdes
397180740SdesSSH_KNOWN_HOSTS FILE FORMAT
398180740Sdes     The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host
399180740Sdes     public keys for all known hosts.  The global file should be prepared by
400214979Sdes     the administrator (optional), and the per-user file is maintained
401214979Sdes     automatically: whenever the user connects from an unknown host, its key
402214979Sdes     is added to the per-user file.
403180740Sdes
404214979Sdes     Each line in these files contains the following fields: markers
405214979Sdes     (optional), hostnames, bits, exponent, modulus, comment.  The fields are
406214979Sdes     separated by spaces.
407180740Sdes
408204861Sdes     The marker is optional, but if it is present then it must be one of
409204861Sdes     ``@cert-authority'', to indicate that the line contains a certification
410204861Sdes     authority (CA) key, or ``@revoked'', to indicate that the key contained
411204861Sdes     on the line is revoked and must not ever be accepted.  Only one marker
412204861Sdes     should be used on a key line.
413204861Sdes
414214979Sdes     Hostnames is a comma-separated list of patterns (`*' and `?' act as
415214979Sdes     wildcards); each pattern in turn is matched against the canonical host
416214979Sdes     name (when authenticating a client) or against the user-supplied name
417214979Sdes     (when authenticating a server).  A pattern may also be preceded by `!' to
418214979Sdes     indicate negation: if the host name matches a negated pattern, it is not
419214979Sdes     accepted (by that line) even if it matched another pattern on the line.
420214979Sdes     A hostname or address may optionally be enclosed within `[' and `]'
421214979Sdes     brackets then followed by `:' and a non-standard port number.
422180740Sdes
423180740Sdes     Alternately, hostnames may be stored in a hashed form which hides host
424180740Sdes     names and addresses should the file's contents be disclosed.  Hashed
425214979Sdes     hostnames start with a `|' character.  Only one hashed hostname may
426214979Sdes     appear on a single line and none of the above negation or wildcard
427214979Sdes     operators may be applied.
428180740Sdes
429180740Sdes     Bits, exponent, and modulus are taken directly from the RSA host key;
430180740Sdes     they can be obtained, for example, from /etc/ssh/ssh_host_key.pub.  The
431180740Sdes     optional comment field continues to the end of the line, and is not used.
432180740Sdes
433180740Sdes     Lines starting with `#' and empty lines are ignored as comments.
434180740Sdes
435180740Sdes     When performing host authentication, authentication is accepted if any
436204861Sdes     matching line has the proper key; either one that matches exactly or, if
437204861Sdes     the server has presented a certificate for authentication, the key of the
438204861Sdes     certification authority that signed the certificate.  For a key to be
439204861Sdes     trusted as a certification authority, it must use the ``@cert-authority''
440204861Sdes     marker described above.
441180740Sdes
442204861Sdes     The known hosts file also provides a facility to mark keys as revoked,
443204861Sdes     for example when it is known that the associated private key has been
444204861Sdes     stolen.  Revoked keys are specified by including the ``@revoked'' marker
445214979Sdes     at the beginning of the key line, and are never accepted for
446214979Sdes     authentication or as certification authorities, but instead will produce
447214979Sdes     a warning from ssh(1) when they are encountered.
448204861Sdes
449214979Sdes     It is permissible (but not recommended) to have several lines or
450214979Sdes     different host keys for the same names.  This will inevitably happen when
451214979Sdes     short forms of host names from different domains are put in the file.  It
452214979Sdes     is possible that the files contain conflicting information;
453214979Sdes     authentication is accepted if valid information can be found from either
454214979Sdes     file.
455204861Sdes
456180740Sdes     Note that the lines in these files are typically hundreds of characters
457180740Sdes     long, and you definitely don't want to type in the host keys by hand.
458204861Sdes     Rather, generate them by a script, ssh-keyscan(1) or by taking
459204861Sdes     /etc/ssh/ssh_host_key.pub and adding the host names at the front.
460204861Sdes     ssh-keygen(1) also offers some basic automated editing for
461214979Sdes     ~/.ssh/known_hosts including removing hosts matching a host name and
462214979Sdes     converting all host names to their hashed representations.
463180740Sdes
464180740Sdes     An example ssh_known_hosts file:
465180740Sdes
466180740Sdes        # Comments allowed at start of line
467180740Sdes        closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
468180740Sdes        cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
469180740Sdes        # A hashed hostname
470180740Sdes        |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
471180740Sdes        AAAA1234.....=
472204861Sdes        # A revoked key
473204861Sdes        @revoked * ssh-rsa AAAAB5W...
474204861Sdes        # A CA key, accepted for any host in *.mydomain.com or *.mydomain.org
475204861Sdes        @cert-authority *.mydomain.org,*.mydomain.com ssh-rsa AAAAB5W...
476180740Sdes
477180740SdesFILES
478180740Sdes     ~/.hushlogin
479180740Sdes             This file is used to suppress printing the last login time and
480214979Sdes             /etc/motd, if PrintLastLog and PrintMotd, respectively, are
481214979Sdes             enabled.  It does not suppress printing of the banner specified
482214979Sdes             by Banner.
483180740Sdes
484180740Sdes     ~/.rhosts
485180740Sdes             This file is used for host-based authentication (see ssh(1) for
486180740Sdes             more information).  On some machines this file may need to be
487214979Sdes             world-readable if the user's home directory is on an NFS
488214979Sdes             partition, because sshd reads it as root.  Additionally, this
489214979Sdes             file must be owned by the user, and must not have write
490214979Sdes             permissions for anyone else.  The recommended permission for most
491214979Sdes             machines is read/write for the user, and not accessible by
492214979Sdes             others.
493180740Sdes
494180740Sdes     ~/.shosts
495180740Sdes             This file is used in exactly the same way as .rhosts, but allows
496180740Sdes             host-based authentication without permitting login with
497180740Sdes             rlogin/rsh.
498180740Sdes
499180746Sdes     ~/.ssh/
500214979Sdes             This directory is the default location for all user-specific
501214979Sdes             configuration and authentication information.  There is no
502214979Sdes             general requirement to keep the entire contents of this directory
503214979Sdes             secret, but the recommended permissions are read/write/execute
504214979Sdes             for the user, and not accessible by others.
505180746Sdes
506180740Sdes     ~/.ssh/authorized_keys
507180740Sdes             Lists the public keys (RSA/DSA) that can be used for logging in
508180740Sdes             as this user.  The format of this file is described above.  The
509180740Sdes             content of the file is not highly sensitive, but the recommended
510180740Sdes             permissions are read/write for the user, and not accessible by
511180740Sdes             others.
512180740Sdes
513180740Sdes             If this file, the ~/.ssh directory, or the user's home directory
514180740Sdes             are writable by other users, then the file could be modified or
515214979Sdes             replaced by unauthorized users.  In this case, sshd will not
516214979Sdes             allow it to be used unless the StrictModes option has been set to
517189006Sdes             ``no''.
518180740Sdes
519180740Sdes     ~/.ssh/environment
520180740Sdes             This file is read into the environment at login (if it exists).
521180740Sdes             It can only contain empty lines, comment lines (that start with
522180740Sdes             `#'), and assignment lines of the form name=value.  The file
523180740Sdes             should be writable only by the user; it need not be readable by
524180740Sdes             anyone else.  Environment processing is disabled by default and
525180740Sdes             is controlled via the PermitUserEnvironment option.
526180740Sdes
527180740Sdes     ~/.ssh/known_hosts
528180740Sdes             Contains a list of host keys for all hosts the user has logged
529180740Sdes             into that are not already in the systemwide list of known host
530180740Sdes             keys.  The format of this file is described above.  This file
531180740Sdes             should be writable only by root/the owner and can, but need not
532180740Sdes             be, world-readable.
533180740Sdes
534180740Sdes     ~/.ssh/rc
535180740Sdes             Contains initialization routines to be run before the user's home
536180740Sdes             directory becomes accessible.  This file should be writable only
537180740Sdes             by the user, and need not be readable by anyone else.
538180740Sdes
539180740Sdes     /etc/hosts.allow
540180740Sdes     /etc/hosts.deny
541214979Sdes             Access controls that should be enforced by tcp-wrappers are
542214979Sdes             defined here.  Further details are described in hosts_access(5).
543180740Sdes
544180740Sdes     /etc/hosts.equiv
545180740Sdes             This file is for host-based authentication (see ssh(1)).  It
546180740Sdes             should only be writable by root.
547180740Sdes
548180740Sdes     /etc/moduli
549180740Sdes             Contains Diffie-Hellman groups used for the "Diffie-Hellman Group
550180740Sdes             Exchange".  The file format is described in moduli(5).
551180740Sdes
552180740Sdes     /etc/motd
553180740Sdes             See motd(5).
554180740Sdes
555180740Sdes     /etc/nologin
556180740Sdes             If this file exists, sshd refuses to let anyone except root log
557180740Sdes             in.  The contents of the file are displayed to anyone trying to
558180740Sdes             log in, and non-root connections are refused.  The file should be
559180740Sdes             world-readable.
560180740Sdes
561180740Sdes     /etc/shosts.equiv
562214979Sdes             This file is used in exactly the same way as hosts.equiv, but
563214979Sdes             allows host-based authentication without permitting login with
564180740Sdes             rlogin/rsh.
565180740Sdes
566180740Sdes     /etc/ssh/ssh_host_key
567180740Sdes     /etc/ssh/ssh_host_dsa_key
568180740Sdes     /etc/ssh/ssh_host_rsa_key
569180740Sdes             These three files contain the private parts of the host keys.
570180740Sdes             These files should only be owned by root, readable only by root,
571180740Sdes             and not accessible to others.  Note that sshd does not start if
572180740Sdes             these files are group/world-accessible.
573180740Sdes
574180740Sdes     /etc/ssh/ssh_host_key.pub
575180740Sdes     /etc/ssh/ssh_host_dsa_key.pub
576180740Sdes     /etc/ssh/ssh_host_rsa_key.pub
577180740Sdes             These three files contain the public parts of the host keys.
578180740Sdes             These files should be world-readable but writable only by root.
579180740Sdes             Their contents should match the respective private parts.  These
580180740Sdes             files are not really used for anything; they are provided for the
581180740Sdes             convenience of the user so their contents can be copied to known
582180740Sdes             hosts files.  These files are created using ssh-keygen(1).
583180740Sdes
584180744Sdes     /etc/ssh/ssh_known_hosts
585180744Sdes             Systemwide list of known host keys.  This file should be prepared
586180744Sdes             by the system administrator to contain the public host keys of
587214979Sdes             all machines in the organization.  The format of this file is
588214979Sdes             described above.  This file should be writable only by root/the
589180744Sdes             owner and should be world-readable.
590180744Sdes
591180740Sdes     /etc/ssh/sshd_config
592214979Sdes             Contains configuration data for sshd.  The file format and
593214979Sdes             configuration options are described in sshd_config(5).
594180740Sdes
595180740Sdes     /etc/ssh/sshrc
596180740Sdes             Similar to ~/.ssh/rc, it can be used to specify machine-specific
597180740Sdes             login-time initializations globally.  This file should be
598180740Sdes             writable only by root, and should be world-readable.
599180740Sdes
600180740Sdes     /var/empty
601180740Sdes             chroot(2) directory used by sshd during privilege separation in
602180740Sdes             the pre-authentication phase.  The directory should not contain
603180740Sdes             any files and must be owned by root and not group or world-
604180740Sdes             writable.
605180740Sdes
606180740Sdes     /var/run/sshd.pid
607180740Sdes             Contains the process ID of the sshd listening for connections (if
608180740Sdes             there are several daemons running concurrently for different
609180740Sdes             ports, this contains the process ID of the one started last).
610214979Sdes             The content of this file is not sensitive; it can be world-
611214979Sdes             readable.
612180740Sdes
613180740SdesSEE ALSO
614180740Sdes     scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1),
615180744Sdes     ssh-keyscan(1), chroot(2), hosts_access(5), login.conf(5), moduli(5),
616180744Sdes     sshd_config(5), inetd(8), sftp-server(8)
617180740Sdes
618180740SdesAUTHORS
619180740Sdes     OpenSSH is a derivative of the original and free ssh 1.2.12 release by
620180740Sdes     Tatu Ylonen.  Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
621214979Sdes     de Raadt and Dug Song removed many bugs, re-added newer features and
622214979Sdes     created OpenSSH.  Markus Friedl contributed the support for SSH protocol
623180740Sdes     versions 1.5 and 2.0.  Niels Provos and Markus Friedl contributed support
624180740Sdes     for privilege separation.
625180740Sdes
626180740SdesCAVEATS
627214979Sdes     System security is not improved unless rshd, rlogind, and rexecd are
628214979Sdes     disabled (thus completely disabling rlogin and rsh into the machine).
629180740Sdes
630214979SdesOpenBSD 4.8                     August 4, 2010                     OpenBSD 4.8
631