sshd.0 revision 225825
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
81218767Sdes             /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_ecdsa_key and
82218767Sdes             /etc/ssh/ssh_host_rsa_key for protocol version 2.  It is possible
83218767Sdes             to have multiple host key files for the different protocol
84218767Sdes             versions and host key 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
146218767Sdes     in sshd_config(5).  Protocol 2 supports DSA, ECDSA and RSA keys; protocol
147218767Sdes     1 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
170225825Sdes     cryptographic message authentication code (hmac-md5, hmac-sha1, umac-64,
171225825Sdes     hmac-ripemd160, hmac-sha2-256 or hmac-sha2-512).
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
264225825Sdes     AuthorizedKeysFile specifies the files containing public keys for public
265180740Sdes     key authentication; if none is specified, the default is
266225825Sdes     ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2.  Each line of the
267225825Sdes     file contains one key (empty lines and lines starting with a `#' are
268225825Sdes     ignored as comments).  Protocol 1 public keys consist of the following
269225825Sdes     space-separated fields: options, bits, exponent, modulus, comment.
270225825Sdes     Protocol 2 public key consist of: options, keytype, base64-encoded key,
271225825Sdes     comment.  The options field is optional; its presence is determined by
272225825Sdes     whether the line starts with a number or not (the options field never
273225825Sdes     starts with a number).  The bits, exponent, modulus, and comment fields
274225825Sdes     give the RSA key for protocol version 1; the comment field is not used
275225825Sdes     for anything (but may be convenient for the user to identify the key).
276225825Sdes     For protocol version 2 the keytype is ``ecdsa-sha2-nistp256'',
277225825Sdes     ``ecdsa-sha2-nistp384'', ``ecdsa-sha2-nistp521'', ``ssh-dss'' or
278225825Sdes     ``ssh-rsa''.
279180740Sdes
280214979Sdes     Note that lines in this file are usually several hundred bytes long
281214979Sdes     (because of the size of the public key encoding) up to a limit of 8
282214979Sdes     kilobytes, which permits DSA keys up to 8 kilobits and RSA keys up to 16
283180740Sdes     kilobits.  You don't want to type them in; instead, copy the
284218767Sdes     identity.pub, id_dsa.pub, id_ecdsa.pub, or the id_rsa.pub file and edit
285218767Sdes     it.
286180740Sdes
287180740Sdes     sshd enforces a minimum RSA key modulus size for protocol 1 and protocol
288180740Sdes     2 keys of 768 bits.
289180740Sdes
290214979Sdes     The options (if present) consist of comma-separated option
291214979Sdes     specifications.  No spaces are permitted, except within double quotes.
292214979Sdes     The following option specifications are supported (note that option
293214979Sdes     keywords are case-insensitive):
294180740Sdes
295204861Sdes     cert-authority
296204861Sdes             Specifies that the listed key is a certification authority (CA)
297214979Sdes             that is trusted to validate signed certificates for user
298214979Sdes             authentication.
299204861Sdes
300204861Sdes             Certificates may encode access restrictions similar to these key
301204861Sdes             options.  If both certificate restrictions and key options are
302204861Sdes             present, the most restrictive union of the two is applied.
303204861Sdes
304180740Sdes     command="command"
305180740Sdes             Specifies that the command is executed whenever this key is used
306180740Sdes             for authentication.  The command supplied by the user (if any) is
307180740Sdes             ignored.  The command is run on a pty if the client requests a
308214979Sdes             pty; otherwise it is run without a tty.  If an 8-bit clean
309214979Sdes             channel is required, one must not request a pty or should specify
310214979Sdes             no-pty.  A quote may be included in the command by quoting it
311214979Sdes             with a backslash.  This option might be useful to restrict
312214979Sdes             certain public keys to perform just a specific operation.  An
313214979Sdes             example might be a key that permits remote backups but nothing
314214979Sdes             else.  Note that the client may specify TCP and/or X11 forwarding
315214979Sdes             unless they are explicitly prohibited.  The command originally
316214979Sdes             supplied by the client is available in the SSH_ORIGINAL_COMMAND
317214979Sdes             environment variable.  Note that this option applies to shell,
318214979Sdes             command or subsystem execution.  Also note that this command may
319214979Sdes             be superseded by either a sshd_config(5) ForceCommand directive
320214979Sdes             or a command embedded in a certificate.
321180740Sdes
322180740Sdes     environment="NAME=value"
323180740Sdes             Specifies that the string is to be added to the environment when
324180740Sdes             logging in using this key.  Environment variables set this way
325180740Sdes             override other default environment values.  Multiple options of
326180740Sdes             this type are permitted.  Environment processing is disabled by
327180740Sdes             default and is controlled via the PermitUserEnvironment option.
328180740Sdes             This option is automatically disabled if UseLogin is enabled.
329180740Sdes
330180740Sdes     from="pattern-list"
331180750Sdes             Specifies that in addition to public key authentication, either
332180750Sdes             the canonical name of the remote host or its IP address must be
333180750Sdes             present in the comma-separated list of patterns.  See PATTERNS in
334180750Sdes             ssh_config(5) for more information on patterns.
335180740Sdes
336214979Sdes             In addition to the wildcard matching that may be applied to
337214979Sdes             hostnames or addresses, a from stanza may match IP addresses
338214979Sdes             using CIDR address/masklen notation.
339180740Sdes
340180750Sdes             The purpose of this option is to optionally increase security:
341180750Sdes             public key authentication by itself does not trust the network or
342180750Sdes             name servers or anything (but the key); however, if somebody
343180750Sdes             somehow steals the key, the key permits an intruder to log in
344180750Sdes             from anywhere in the world.  This additional option makes using a
345180750Sdes             stolen key more difficult (name servers and/or routers would have
346180750Sdes             to be compromised in addition to just the key).
347180750Sdes
348180740Sdes     no-agent-forwarding
349180740Sdes             Forbids authentication agent forwarding when this key is used for
350180740Sdes             authentication.
351180740Sdes
352180740Sdes     no-port-forwarding
353180740Sdes             Forbids TCP forwarding when this key is used for authentication.
354180740Sdes             Any port forward requests by the client will return an error.
355180740Sdes             This might be used, e.g. in connection with the command option.
356180740Sdes
357180740Sdes     no-pty  Prevents tty allocation (a request to allocate a pty will fail).
358180740Sdes
359180746Sdes     no-user-rc
360180746Sdes             Disables execution of ~/.ssh/rc.
361180746Sdes
362180740Sdes     no-X11-forwarding
363180740Sdes             Forbids X11 forwarding when this key is used for authentication.
364180740Sdes             Any X11 forward requests by the client will return an error.
365180740Sdes
366180740Sdes     permitopen="host:port"
367214979Sdes             Limit local ``ssh -L'' port forwarding such that it may only
368214979Sdes             connect to the specified host and port.  IPv6 addresses can be
369214979Sdes             specified by enclosing the address in square brackets.  Multiple
370214979Sdes             permitopen options may be applied separated by commas.  No
371214979Sdes             pattern matching is performed on the specified hostnames, they
372214979Sdes             must be literal domains or addresses.
373180740Sdes
374214979Sdes     principals="principals"
375214979Sdes             On a cert-authority line, specifies allowed principals for
376214979Sdes             certificate authentication as a comma-separated list.  At least
377214979Sdes             one name from the list must appear in the certificate's list of
378214979Sdes             principals for the certificate to be accepted.  This option is
379214979Sdes             ignored for keys that are not marked as trusted certificate
380214979Sdes             signers using the cert-authority option.
381214979Sdes
382180740Sdes     tunnel="n"
383180740Sdes             Force a tun(4) device on the server.  Without this option, the
384214979Sdes             next available device will be used if the client requests a
385214979Sdes             tunnel.
386180740Sdes
387180740Sdes     An example authorized_keys file:
388180740Sdes
389180740Sdes        # Comments allowed at start of line
390180740Sdes        ssh-rsa AAAAB3Nza...LiPk== user@example.net
391180740Sdes        from="*.sales.example.net,!pc.sales.example.net" ssh-rsa
392180740Sdes        AAAAB2...19Q== john@example.net
393180740Sdes        command="dump /home",no-pty,no-port-forwarding ssh-dss
394180740Sdes        AAAAC3...51R== example.net
395180740Sdes        permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss
396180740Sdes        AAAAB5...21S==
397180740Sdes        tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...==
398180740Sdes        jane@example.net
399180740Sdes
400180740SdesSSH_KNOWN_HOSTS FILE FORMAT
401180740Sdes     The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host
402180740Sdes     public keys for all known hosts.  The global file should be prepared by
403214979Sdes     the administrator (optional), and the per-user file is maintained
404214979Sdes     automatically: whenever the user connects from an unknown host, its key
405214979Sdes     is added to the per-user file.
406180740Sdes
407214979Sdes     Each line in these files contains the following fields: markers
408214979Sdes     (optional), hostnames, bits, exponent, modulus, comment.  The fields are
409214979Sdes     separated by spaces.
410180740Sdes
411204861Sdes     The marker is optional, but if it is present then it must be one of
412204861Sdes     ``@cert-authority'', to indicate that the line contains a certification
413204861Sdes     authority (CA) key, or ``@revoked'', to indicate that the key contained
414204861Sdes     on the line is revoked and must not ever be accepted.  Only one marker
415204861Sdes     should be used on a key line.
416204861Sdes
417214979Sdes     Hostnames is a comma-separated list of patterns (`*' and `?' act as
418214979Sdes     wildcards); each pattern in turn is matched against the canonical host
419214979Sdes     name (when authenticating a client) or against the user-supplied name
420214979Sdes     (when authenticating a server).  A pattern may also be preceded by `!' to
421214979Sdes     indicate negation: if the host name matches a negated pattern, it is not
422214979Sdes     accepted (by that line) even if it matched another pattern on the line.
423214979Sdes     A hostname or address may optionally be enclosed within `[' and `]'
424214979Sdes     brackets then followed by `:' and a non-standard port number.
425180740Sdes
426180740Sdes     Alternately, hostnames may be stored in a hashed form which hides host
427180740Sdes     names and addresses should the file's contents be disclosed.  Hashed
428214979Sdes     hostnames start with a `|' character.  Only one hashed hostname may
429214979Sdes     appear on a single line and none of the above negation or wildcard
430214979Sdes     operators may be applied.
431180740Sdes
432180740Sdes     Bits, exponent, and modulus are taken directly from the RSA host key;
433180740Sdes     they can be obtained, for example, from /etc/ssh/ssh_host_key.pub.  The
434180740Sdes     optional comment field continues to the end of the line, and is not used.
435180740Sdes
436180740Sdes     Lines starting with `#' and empty lines are ignored as comments.
437180740Sdes
438180740Sdes     When performing host authentication, authentication is accepted if any
439204861Sdes     matching line has the proper key; either one that matches exactly or, if
440204861Sdes     the server has presented a certificate for authentication, the key of the
441204861Sdes     certification authority that signed the certificate.  For a key to be
442204861Sdes     trusted as a certification authority, it must use the ``@cert-authority''
443204861Sdes     marker described above.
444180740Sdes
445204861Sdes     The known hosts file also provides a facility to mark keys as revoked,
446204861Sdes     for example when it is known that the associated private key has been
447204861Sdes     stolen.  Revoked keys are specified by including the ``@revoked'' marker
448214979Sdes     at the beginning of the key line, and are never accepted for
449214979Sdes     authentication or as certification authorities, but instead will produce
450214979Sdes     a warning from ssh(1) when they are encountered.
451204861Sdes
452214979Sdes     It is permissible (but not recommended) to have several lines or
453214979Sdes     different host keys for the same names.  This will inevitably happen when
454214979Sdes     short forms of host names from different domains are put in the file.  It
455214979Sdes     is possible that the files contain conflicting information;
456214979Sdes     authentication is accepted if valid information can be found from either
457214979Sdes     file.
458204861Sdes
459180740Sdes     Note that the lines in these files are typically hundreds of characters
460180740Sdes     long, and you definitely don't want to type in the host keys by hand.
461204861Sdes     Rather, generate them by a script, ssh-keyscan(1) or by taking
462204861Sdes     /etc/ssh/ssh_host_key.pub and adding the host names at the front.
463204861Sdes     ssh-keygen(1) also offers some basic automated editing for
464214979Sdes     ~/.ssh/known_hosts including removing hosts matching a host name and
465214979Sdes     converting all host names to their hashed representations.
466180740Sdes
467180740Sdes     An example ssh_known_hosts file:
468180740Sdes
469180740Sdes        # Comments allowed at start of line
470180740Sdes        closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net
471180740Sdes        cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....=
472180740Sdes        # A hashed hostname
473180740Sdes        |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa
474180740Sdes        AAAA1234.....=
475204861Sdes        # A revoked key
476204861Sdes        @revoked * ssh-rsa AAAAB5W...
477204861Sdes        # A CA key, accepted for any host in *.mydomain.com or *.mydomain.org
478204861Sdes        @cert-authority *.mydomain.org,*.mydomain.com ssh-rsa AAAAB5W...
479180740Sdes
480180740SdesFILES
481180740Sdes     ~/.hushlogin
482180740Sdes             This file is used to suppress printing the last login time and
483214979Sdes             /etc/motd, if PrintLastLog and PrintMotd, respectively, are
484214979Sdes             enabled.  It does not suppress printing of the banner specified
485214979Sdes             by Banner.
486180740Sdes
487180740Sdes     ~/.rhosts
488180740Sdes             This file is used for host-based authentication (see ssh(1) for
489180740Sdes             more information).  On some machines this file may need to be
490214979Sdes             world-readable if the user's home directory is on an NFS
491214979Sdes             partition, because sshd reads it as root.  Additionally, this
492214979Sdes             file must be owned by the user, and must not have write
493214979Sdes             permissions for anyone else.  The recommended permission for most
494214979Sdes             machines is read/write for the user, and not accessible by
495214979Sdes             others.
496180740Sdes
497180740Sdes     ~/.shosts
498180740Sdes             This file is used in exactly the same way as .rhosts, but allows
499180740Sdes             host-based authentication without permitting login with
500180740Sdes             rlogin/rsh.
501180740Sdes
502180746Sdes     ~/.ssh/
503214979Sdes             This directory is the default location for all user-specific
504214979Sdes             configuration and authentication information.  There is no
505214979Sdes             general requirement to keep the entire contents of this directory
506214979Sdes             secret, but the recommended permissions are read/write/execute
507214979Sdes             for the user, and not accessible by others.
508180746Sdes
509180740Sdes     ~/.ssh/authorized_keys
510218767Sdes             Lists the public keys (DSA/ECDSA/RSA) that can be used for
511218767Sdes             logging in as this user.  The format of this file is described
512218767Sdes             above.  The content of the file is not highly sensitive, but the
513218767Sdes             recommended permissions are read/write for the user, and not
514218767Sdes             accessible by others.
515180740Sdes
516180740Sdes             If this file, the ~/.ssh directory, or the user's home directory
517180740Sdes             are writable by other users, then the file could be modified or
518214979Sdes             replaced by unauthorized users.  In this case, sshd will not
519214979Sdes             allow it to be used unless the StrictModes option has been set to
520189006Sdes             ``no''.
521180740Sdes
522180740Sdes     ~/.ssh/environment
523180740Sdes             This file is read into the environment at login (if it exists).
524180740Sdes             It can only contain empty lines, comment lines (that start with
525180740Sdes             `#'), and assignment lines of the form name=value.  The file
526180740Sdes             should be writable only by the user; it need not be readable by
527180740Sdes             anyone else.  Environment processing is disabled by default and
528180740Sdes             is controlled via the PermitUserEnvironment option.
529180740Sdes
530180740Sdes     ~/.ssh/known_hosts
531180740Sdes             Contains a list of host keys for all hosts the user has logged
532180740Sdes             into that are not already in the systemwide list of known host
533180740Sdes             keys.  The format of this file is described above.  This file
534180740Sdes             should be writable only by root/the owner and can, but need not
535180740Sdes             be, world-readable.
536180740Sdes
537180740Sdes     ~/.ssh/rc
538180740Sdes             Contains initialization routines to be run before the user's home
539180740Sdes             directory becomes accessible.  This file should be writable only
540180740Sdes             by the user, and need not be readable by anyone else.
541180740Sdes
542180740Sdes     /etc/hosts.allow
543180740Sdes     /etc/hosts.deny
544214979Sdes             Access controls that should be enforced by tcp-wrappers are
545214979Sdes             defined here.  Further details are described in hosts_access(5).
546180740Sdes
547180740Sdes     /etc/hosts.equiv
548180740Sdes             This file is for host-based authentication (see ssh(1)).  It
549180740Sdes             should only be writable by root.
550180740Sdes
551180740Sdes     /etc/moduli
552180740Sdes             Contains Diffie-Hellman groups used for the "Diffie-Hellman Group
553180740Sdes             Exchange".  The file format is described in moduli(5).
554180740Sdes
555180740Sdes     /etc/motd
556180740Sdes             See motd(5).
557180740Sdes
558180740Sdes     /etc/nologin
559180740Sdes             If this file exists, sshd refuses to let anyone except root log
560180740Sdes             in.  The contents of the file are displayed to anyone trying to
561180740Sdes             log in, and non-root connections are refused.  The file should be
562180740Sdes             world-readable.
563180740Sdes
564180740Sdes     /etc/shosts.equiv
565214979Sdes             This file is used in exactly the same way as hosts.equiv, but
566214979Sdes             allows host-based authentication without permitting login with
567180740Sdes             rlogin/rsh.
568180740Sdes
569180740Sdes     /etc/ssh/ssh_host_key
570180740Sdes     /etc/ssh/ssh_host_dsa_key
571218767Sdes     /etc/ssh/ssh_host_ecdsa_key
572180740Sdes     /etc/ssh/ssh_host_rsa_key
573180740Sdes             These three files contain the private parts of the host keys.
574180740Sdes             These files should only be owned by root, readable only by root,
575180740Sdes             and not accessible to others.  Note that sshd does not start if
576180740Sdes             these files are group/world-accessible.
577180740Sdes
578180740Sdes     /etc/ssh/ssh_host_key.pub
579180740Sdes     /etc/ssh/ssh_host_dsa_key.pub
580218767Sdes     /etc/ssh/ssh_host_ecdsa_key.pub
581180740Sdes     /etc/ssh/ssh_host_rsa_key.pub
582180740Sdes             These three files contain the public parts of the host keys.
583180740Sdes             These files should be world-readable but writable only by root.
584180740Sdes             Their contents should match the respective private parts.  These
585180740Sdes             files are not really used for anything; they are provided for the
586180740Sdes             convenience of the user so their contents can be copied to known
587180740Sdes             hosts files.  These files are created using ssh-keygen(1).
588180740Sdes
589180744Sdes     /etc/ssh/ssh_known_hosts
590180744Sdes             Systemwide list of known host keys.  This file should be prepared
591180744Sdes             by the system administrator to contain the public host keys of
592214979Sdes             all machines in the organization.  The format of this file is
593214979Sdes             described above.  This file should be writable only by root/the
594180744Sdes             owner and should be world-readable.
595180744Sdes
596180740Sdes     /etc/ssh/sshd_config
597214979Sdes             Contains configuration data for sshd.  The file format and
598214979Sdes             configuration options are described in sshd_config(5).
599180740Sdes
600180740Sdes     /etc/ssh/sshrc
601180740Sdes             Similar to ~/.ssh/rc, it can be used to specify machine-specific
602180740Sdes             login-time initializations globally.  This file should be
603180740Sdes             writable only by root, and should be world-readable.
604180740Sdes
605180740Sdes     /var/empty
606180740Sdes             chroot(2) directory used by sshd during privilege separation in
607180740Sdes             the pre-authentication phase.  The directory should not contain
608180740Sdes             any files and must be owned by root and not group or world-
609180740Sdes             writable.
610180740Sdes
611180740Sdes     /var/run/sshd.pid
612180740Sdes             Contains the process ID of the sshd listening for connections (if
613180740Sdes             there are several daemons running concurrently for different
614180740Sdes             ports, this contains the process ID of the one started last).
615214979Sdes             The content of this file is not sensitive; it can be world-
616214979Sdes             readable.
617180740Sdes
618180740SdesSEE ALSO
619180740Sdes     scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1),
620180744Sdes     ssh-keyscan(1), chroot(2), hosts_access(5), login.conf(5), moduli(5),
621180744Sdes     sshd_config(5), inetd(8), sftp-server(8)
622180740Sdes
623180740SdesAUTHORS
624180740Sdes     OpenSSH is a derivative of the original and free ssh 1.2.12 release by
625180740Sdes     Tatu Ylonen.  Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
626214979Sdes     de Raadt and Dug Song removed many bugs, re-added newer features and
627214979Sdes     created OpenSSH.  Markus Friedl contributed the support for SSH protocol
628180740Sdes     versions 1.5 and 2.0.  Niels Provos and Markus Friedl contributed support
629180740Sdes     for privilege separation.
630180740Sdes
631180740SdesCAVEATS
632214979Sdes     System security is not improved unless rshd, rlogind, and rexecd are
633214979Sdes     disabled (thus completely disabling rlogin and rsh into the machine).
634180740Sdes
635225825SdesOpenBSD 5.0                     August 2, 2011                     OpenBSD 5.0
636