diff options
author | Colin Watson <cjwatson@debian.org> | 2011-02-05 10:51:08 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2011-02-05 10:51:08 +0000 |
commit | afde81fe5d3d6d3e9721ec56981e0214ea850bc6 (patch) | |
tree | 88a894b9003f577e40c7b04f71866a8257b8f6ee /sshd.0 | |
parent | 8c0fe794fcc0f47ff728101568da865ab387dc6d (diff) | |
parent | 478ff799463ca926a8dfbabf058f4e84aaffc65a (diff) |
Import 5.8p1 tarball
Diffstat (limited to 'sshd.0')
-rw-r--r-- | sshd.0 | 634 |
1 files changed, 634 insertions, 0 deletions
@@ -0,0 +1,634 @@ | |||
1 | SSHD(8) OpenBSD System Manager's Manual SSHD(8) | ||
2 | |||
3 | NAME | ||
4 | sshd - OpenSSH SSH daemon | ||
5 | |||
6 | SYNOPSIS | ||
7 | sshd [-46DdeiqTt] [-b bits] [-C connection_spec] | ||
8 | [-c host_certificate_file] [-f config_file] [-g login_grace_time] | ||
9 | [-h host_key_file] [-k key_gen_time] [-o option] [-p port] [-u len] | ||
10 | |||
11 | DESCRIPTION | ||
12 | sshd (OpenSSH Daemon) is the daemon program for ssh(1). Together these | ||
13 | programs replace rlogin(1) and rsh(1), and provide secure encrypted | ||
14 | communications between two untrusted hosts over an insecure network. | ||
15 | |||
16 | sshd listens for connections from clients. It is normally started at | ||
17 | boot from /etc/rc. It forks a new daemon for each incoming connection. | ||
18 | The forked daemons handle key exchange, encryption, authentication, | ||
19 | command execution, and data exchange. | ||
20 | |||
21 | sshd can be configured using command-line options or a configuration file | ||
22 | (by default sshd_config(5)); command-line options override values | ||
23 | specified in the configuration file. sshd rereads its configuration file | ||
24 | when it receives a hangup signal, SIGHUP, by executing itself with the | ||
25 | name and options it was started with, e.g. /usr/sbin/sshd. | ||
26 | |||
27 | The options are as follows: | ||
28 | |||
29 | -4 Forces sshd to use IPv4 addresses only. | ||
30 | |||
31 | -6 Forces sshd to use IPv6 addresses only. | ||
32 | |||
33 | -b bits | ||
34 | Specifies the number of bits in the ephemeral protocol version 1 | ||
35 | server key (default 1024). | ||
36 | |||
37 | -C connection_spec | ||
38 | Specify the connection parameters to use for the -T extended test | ||
39 | mode. If provided, any Match directives in the configuration | ||
40 | file that would apply to the specified user, host, and address | ||
41 | will be set before the configuration is written to standard | ||
42 | output. The connection parameters are supplied as keyword=value | ||
43 | pairs. The keywords are ``user'', ``host'', and ``addr''. All | ||
44 | are required and may be supplied in any order, either with | ||
45 | multiple -C options or as a comma-separated list. | ||
46 | |||
47 | -c host_certificate_file | ||
48 | Specifies a path to a certificate file to identify sshd during | ||
49 | key exchange. The certificate file must match a host key file | ||
50 | specified using the -h option or the HostKey configuration | ||
51 | directive. | ||
52 | |||
53 | -D When this option is specified, sshd will not detach and does not | ||
54 | become a daemon. This allows easy monitoring of sshd. | ||
55 | |||
56 | -d Debug mode. The server sends verbose debug output to standard | ||
57 | error, and does not put itself in the background. The server | ||
58 | also will not fork and will only process one connection. This | ||
59 | option is only intended for debugging for the server. Multiple | ||
60 | -d options increase the debugging level. Maximum is 3. | ||
61 | |||
62 | -e When this option is specified, sshd will send the output to the | ||
63 | standard error instead of the system log. | ||
64 | |||
65 | -f config_file | ||
66 | Specifies the name of the configuration file. The default is | ||
67 | /etc/ssh/sshd_config. sshd refuses to start if there is no | ||
68 | configuration file. | ||
69 | |||
70 | -g login_grace_time | ||
71 | Gives the grace time for clients to authenticate themselves | ||
72 | (default 120 seconds). If the client fails to authenticate the | ||
73 | user within this many seconds, the server disconnects and exits. | ||
74 | A value of zero indicates no limit. | ||
75 | |||
76 | -h host_key_file | ||
77 | Specifies a file from which a host key is read. This option must | ||
78 | be given if sshd is not run as root (as the normal host key files | ||
79 | are normally not readable by anyone but root). The default is | ||
80 | /etc/ssh/ssh_host_key for protocol version 1, and | ||
81 | /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_ecdsa_key and | ||
82 | /etc/ssh/ssh_host_rsa_key for protocol version 2. It is possible | ||
83 | to have multiple host key files for the different protocol | ||
84 | versions and host key algorithms. | ||
85 | |||
86 | -i Specifies that sshd is being run from inetd(8). sshd is normally | ||
87 | not run from inetd because it needs to generate the server key | ||
88 | before it can respond to the client, and this may take tens of | ||
89 | seconds. Clients would have to wait too long if the key was | ||
90 | regenerated every time. However, with small key sizes (e.g. 512) | ||
91 | using sshd from inetd may be feasible. | ||
92 | |||
93 | -k key_gen_time | ||
94 | Specifies how often the ephemeral protocol version 1 server key | ||
95 | is regenerated (default 3600 seconds, or one hour). The | ||
96 | motivation for regenerating the key fairly often is that the key | ||
97 | is not stored anywhere, and after about an hour it becomes | ||
98 | impossible to recover the key for decrypting intercepted | ||
99 | communications even if the machine is cracked into or physically | ||
100 | seized. A value of zero indicates that the key will never be | ||
101 | regenerated. | ||
102 | |||
103 | -o option | ||
104 | Can be used to give options in the format used in the | ||
105 | configuration file. This is useful for specifying options for | ||
106 | which there is no separate command-line flag. For full details | ||
107 | of the options, and their values, see sshd_config(5). | ||
108 | |||
109 | -p port | ||
110 | Specifies the port on which the server listens for connections | ||
111 | (default 22). Multiple port options are permitted. Ports | ||
112 | specified in the configuration file with the Port option are | ||
113 | ignored when a command-line port is specified. Ports specified | ||
114 | using the ListenAddress option override command-line ports. | ||
115 | |||
116 | -q Quiet mode. Nothing is sent to the system log. Normally the | ||
117 | beginning, authentication, and termination of each connection is | ||
118 | logged. | ||
119 | |||
120 | -T Extended test mode. Check the validity of the configuration | ||
121 | file, output the effective configuration to stdout and then exit. | ||
122 | Optionally, Match rules may be applied by specifying the | ||
123 | connection parameters using one or more -C options. | ||
124 | |||
125 | -t Test mode. Only check the validity of the configuration file and | ||
126 | sanity of the keys. This is useful for updating sshd reliably as | ||
127 | configuration options may change. | ||
128 | |||
129 | -u len This option is used to specify the size of the field in the utmp | ||
130 | structure that holds the remote host name. If the resolved host | ||
131 | name is longer than len, the dotted decimal value will be used | ||
132 | instead. This allows hosts with very long host names that | ||
133 | overflow this field to still be uniquely identified. Specifying | ||
134 | -u0 indicates that only dotted decimal addresses should be put | ||
135 | into the utmp file. -u0 may also be used to prevent sshd from | ||
136 | making DNS requests unless the authentication mechanism or | ||
137 | configuration requires it. Authentication mechanisms that may | ||
138 | require DNS include RhostsRSAAuthentication, | ||
139 | HostbasedAuthentication, and using a from="pattern-list" option | ||
140 | in a key file. Configuration options that require DNS include | ||
141 | using a USER@HOST pattern in AllowUsers or DenyUsers. | ||
142 | |||
143 | AUTHENTICATION | ||
144 | The OpenSSH SSH daemon supports SSH protocols 1 and 2. The default is to | ||
145 | use protocol 2 only, though this can be changed via the Protocol option | ||
146 | in sshd_config(5). Protocol 2 supports DSA, ECDSA and RSA keys; protocol | ||
147 | 1 only supports RSA keys. For both protocols, each host has a host- | ||
148 | specific key, normally 2048 bits, used to identify the host. | ||
149 | |||
150 | Forward security for protocol 1 is provided through an additional server | ||
151 | key, normally 768 bits, generated when the server starts. This key is | ||
152 | normally regenerated every hour if it has been used, and is never stored | ||
153 | on disk. Whenever a client connects, the daemon responds with its public | ||
154 | host and server keys. The client compares the RSA host key against its | ||
155 | own database to verify that it has not changed. The client then | ||
156 | generates a 256-bit random number. It encrypts this random number using | ||
157 | both the host key and the server key, and sends the encrypted number to | ||
158 | the server. Both sides then use this random number as a session key | ||
159 | which is used to encrypt all further communications in the session. The | ||
160 | rest of the session is encrypted using a conventional cipher, currently | ||
161 | Blowfish or 3DES, with 3DES being used by default. The client selects | ||
162 | the encryption algorithm to use from those offered by the server. | ||
163 | |||
164 | For protocol 2, forward security is provided through a Diffie-Hellman key | ||
165 | agreement. This key agreement results in a shared session key. The rest | ||
166 | of the session is encrypted using a symmetric cipher, currently 128-bit | ||
167 | AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES. The | ||
168 | client selects the encryption algorithm to use from those offered by the | ||
169 | server. Additionally, session integrity is provided through a | ||
170 | cryptographic message authentication code (hmac-md5, hmac-sha1, umac-64 | ||
171 | or hmac-ripemd160). | ||
172 | |||
173 | Finally, the server and the client enter an authentication dialog. The | ||
174 | client tries to authenticate itself using host-based authentication, | ||
175 | public key authentication, challenge-response authentication, or password | ||
176 | authentication. | ||
177 | |||
178 | Regardless of the authentication type, the account is checked to ensure | ||
179 | that it is accessible. An account is not accessible if it is locked, | ||
180 | listed in DenyUsers or its group is listed in DenyGroups . The | ||
181 | definition of a locked account is system dependant. Some platforms have | ||
182 | their own account database (eg AIX) and some modify the passwd field ( | ||
183 | `*LK*' on Solaris and UnixWare, `*' on HP-UX, containing `Nologin' on | ||
184 | Tru64, a leading `*LOCKED*' on FreeBSD and a leading `!' on most | ||
185 | Linuxes). If there is a requirement to disable password authentication | ||
186 | for the account while allowing still public-key, then the passwd field | ||
187 | should be set to something other than these values (eg `NP' or `*NP*' ). | ||
188 | |||
189 | If the client successfully authenticates itself, a dialog for preparing | ||
190 | the session is entered. At this time the client may request things like | ||
191 | allocating a pseudo-tty, forwarding X11 connections, forwarding TCP | ||
192 | connections, or forwarding the authentication agent connection over the | ||
193 | secure channel. | ||
194 | |||
195 | After this, the client either requests a shell or execution of a command. | ||
196 | The sides then enter session mode. In this mode, either side may send | ||
197 | data at any time, and such data is forwarded to/from the shell or command | ||
198 | on the server side, and the user terminal in the client side. | ||
199 | |||
200 | When the user program terminates and all forwarded X11 and other | ||
201 | connections have been closed, the server sends command exit status to the | ||
202 | client, and both sides exit. | ||
203 | |||
204 | LOGIN PROCESS | ||
205 | When a user successfully logs in, sshd does the following: | ||
206 | |||
207 | 1. If the login is on a tty, and no command has been specified, | ||
208 | prints last login time and /etc/motd (unless prevented in the | ||
209 | configuration file or by ~/.hushlogin; see the FILES section). | ||
210 | |||
211 | 2. If the login is on a tty, records login time. | ||
212 | |||
213 | 3. Checks /etc/nologin; if it exists, prints contents and quits | ||
214 | (unless root). | ||
215 | |||
216 | 4. Changes to run with normal user privileges. | ||
217 | |||
218 | 5. Sets up basic environment. | ||
219 | |||
220 | 6. Reads the file ~/.ssh/environment, if it exists, and users are | ||
221 | allowed to change their environment. See the | ||
222 | PermitUserEnvironment option in sshd_config(5). | ||
223 | |||
224 | 7. Changes to user's home directory. | ||
225 | |||
226 | 8. If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists, | ||
227 | runs it; otherwise runs xauth. The ``rc'' files are given the | ||
228 | X11 authentication protocol and cookie in standard input. See | ||
229 | SSHRC, below. | ||
230 | |||
231 | 9. Runs user's shell or command. | ||
232 | |||
233 | SSHRC | ||
234 | If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment | ||
235 | files but before starting the user's shell or command. It must not | ||
236 | produce any output on stdout; stderr must be used instead. If X11 | ||
237 | forwarding is in use, it will receive the "proto cookie" pair in its | ||
238 | standard input (and DISPLAY in its environment). The script must call | ||
239 | xauth(1) because sshd will not run xauth automatically to add X11 | ||
240 | cookies. | ||
241 | |||
242 | The primary purpose of this file is to run any initialization routines | ||
243 | which may be needed before the user's home directory becomes accessible; | ||
244 | AFS is a particular example of such an environment. | ||
245 | |||
246 | This file will probably contain some initialization code followed by | ||
247 | something similar to: | ||
248 | |||
249 | if read proto cookie && [ -n "$DISPLAY" ]; then | ||
250 | if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then | ||
251 | # X11UseLocalhost=yes | ||
252 | echo add unix:`echo $DISPLAY | | ||
253 | cut -c11-` $proto $cookie | ||
254 | else | ||
255 | # X11UseLocalhost=no | ||
256 | echo add $DISPLAY $proto $cookie | ||
257 | fi | xauth -q - | ||
258 | fi | ||
259 | |||
260 | If this file does not exist, /etc/ssh/sshrc is run, and if that does not | ||
261 | exist either, xauth is used to add the cookie. | ||
262 | |||
263 | AUTHORIZED_KEYS FILE FORMAT | ||
264 | AuthorizedKeysFile specifies the file containing public keys for public | ||
265 | key authentication; if none is specified, the default is | ||
266 | ~/.ssh/authorized_keys. Each line of the file contains one key (empty | ||
267 | lines and lines starting with a `#' are ignored as comments). Protocol 1 | ||
268 | public keys consist of the following space-separated fields: options, | ||
269 | bits, exponent, modulus, comment. Protocol 2 public key consist of: | ||
270 | options, keytype, base64-encoded key, comment. The options field is | ||
271 | optional; its presence is determined by whether the line starts with a | ||
272 | number or not (the options field never starts with a number). The bits, | ||
273 | exponent, modulus, and comment fields give the RSA key for protocol | ||
274 | version 1; the comment field is not used for anything (but may be | ||
275 | convenient for the user to identify the key). For protocol version 2 the | ||
276 | keytype is ``ecdsa-sha2-nistp256'', ``ecdsa-sha2-nistp384'', | ||
277 | ``ecdsa-sha2-nistp521'', ``ssh-dss'' or ``ssh-rsa''. | ||
278 | |||
279 | Note that lines in this file are usually several hundred bytes long | ||
280 | (because of the size of the public key encoding) up to a limit of 8 | ||
281 | kilobytes, which permits DSA keys up to 8 kilobits and RSA keys up to 16 | ||
282 | kilobits. You don't want to type them in; instead, copy the | ||
283 | identity.pub, id_dsa.pub, id_ecdsa.pub, or the id_rsa.pub file and edit | ||
284 | it. | ||
285 | |||
286 | sshd enforces a minimum RSA key modulus size for protocol 1 and protocol | ||
287 | 2 keys of 768 bits. | ||
288 | |||
289 | The options (if present) consist of comma-separated option | ||
290 | specifications. No spaces are permitted, except within double quotes. | ||
291 | The following option specifications are supported (note that option | ||
292 | keywords are case-insensitive): | ||
293 | |||
294 | cert-authority | ||
295 | Specifies that the listed key is a certification authority (CA) | ||
296 | that is trusted to validate signed certificates for user | ||
297 | authentication. | ||
298 | |||
299 | Certificates may encode access restrictions similar to these key | ||
300 | options. If both certificate restrictions and key options are | ||
301 | present, the most restrictive union of the two is applied. | ||
302 | |||
303 | command="command" | ||
304 | Specifies that the command is executed whenever this key is used | ||
305 | for authentication. The command supplied by the user (if any) is | ||
306 | ignored. The command is run on a pty if the client requests a | ||
307 | pty; otherwise it is run without a tty. If an 8-bit clean | ||
308 | channel is required, one must not request a pty or should specify | ||
309 | no-pty. A quote may be included in the command by quoting it | ||
310 | with a backslash. This option might be useful to restrict | ||
311 | certain public keys to perform just a specific operation. An | ||
312 | example might be a key that permits remote backups but nothing | ||
313 | else. Note that the client may specify TCP and/or X11 forwarding | ||
314 | unless they are explicitly prohibited. The command originally | ||
315 | supplied by the client is available in the SSH_ORIGINAL_COMMAND | ||
316 | environment variable. Note that this option applies to shell, | ||
317 | command or subsystem execution. Also note that this command may | ||
318 | be superseded by either a sshd_config(5) ForceCommand directive | ||
319 | or a command embedded in a certificate. | ||
320 | |||
321 | environment="NAME=value" | ||
322 | Specifies that the string is to be added to the environment when | ||
323 | logging in using this key. Environment variables set this way | ||
324 | override other default environment values. Multiple options of | ||
325 | this type are permitted. Environment processing is disabled by | ||
326 | default and is controlled via the PermitUserEnvironment option. | ||
327 | This option is automatically disabled if UseLogin is enabled. | ||
328 | |||
329 | from="pattern-list" | ||
330 | Specifies that in addition to public key authentication, either | ||
331 | the canonical name of the remote host or its IP address must be | ||
332 | present in the comma-separated list of patterns. See PATTERNS in | ||
333 | ssh_config(5) for more information on patterns. | ||
334 | |||
335 | In addition to the wildcard matching that may be applied to | ||
336 | hostnames or addresses, a from stanza may match IP addresses | ||
337 | using CIDR address/masklen notation. | ||
338 | |||
339 | The purpose of this option is to optionally increase security: | ||
340 | public key authentication by itself does not trust the network or | ||
341 | name servers or anything (but the key); however, if somebody | ||
342 | somehow steals the key, the key permits an intruder to log in | ||
343 | from anywhere in the world. This additional option makes using a | ||
344 | stolen key more difficult (name servers and/or routers would have | ||
345 | to be compromised in addition to just the key). | ||
346 | |||
347 | no-agent-forwarding | ||
348 | Forbids authentication agent forwarding when this key is used for | ||
349 | authentication. | ||
350 | |||
351 | no-port-forwarding | ||
352 | Forbids TCP forwarding when this key is used for authentication. | ||
353 | Any port forward requests by the client will return an error. | ||
354 | This might be used, e.g. in connection with the command option. | ||
355 | |||
356 | no-pty Prevents tty allocation (a request to allocate a pty will fail). | ||
357 | |||
358 | no-user-rc | ||
359 | Disables execution of ~/.ssh/rc. | ||
360 | |||
361 | no-X11-forwarding | ||
362 | Forbids X11 forwarding when this key is used for authentication. | ||
363 | Any X11 forward requests by the client will return an error. | ||
364 | |||
365 | permitopen="host:port" | ||
366 | Limit local ``ssh -L'' port forwarding such that it may only | ||
367 | connect to the specified host and port. IPv6 addresses can be | ||
368 | specified by enclosing the address in square brackets. Multiple | ||
369 | permitopen options may be applied separated by commas. No | ||
370 | pattern matching is performed on the specified hostnames, they | ||
371 | must be literal domains or addresses. | ||
372 | |||
373 | principals="principals" | ||
374 | On a cert-authority line, specifies allowed principals for | ||
375 | certificate authentication as a comma-separated list. At least | ||
376 | one name from the list must appear in the certificate's list of | ||
377 | principals for the certificate to be accepted. This option is | ||
378 | ignored for keys that are not marked as trusted certificate | ||
379 | signers using the cert-authority option. | ||
380 | |||
381 | tunnel="n" | ||
382 | Force a tun(4) device on the server. Without this option, the | ||
383 | next available device will be used if the client requests a | ||
384 | tunnel. | ||
385 | |||
386 | An example authorized_keys file: | ||
387 | |||
388 | # Comments allowed at start of line | ||
389 | ssh-rsa AAAAB3Nza...LiPk== user@example.net | ||
390 | from="*.sales.example.net,!pc.sales.example.net" ssh-rsa | ||
391 | AAAAB2...19Q== john@example.net | ||
392 | command="dump /home",no-pty,no-port-forwarding ssh-dss | ||
393 | AAAAC3...51R== example.net | ||
394 | permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss | ||
395 | AAAAB5...21S== | ||
396 | tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== | ||
397 | jane@example.net | ||
398 | |||
399 | SSH_KNOWN_HOSTS FILE FORMAT | ||
400 | The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host | ||
401 | public keys for all known hosts. The global file should be prepared by | ||
402 | the administrator (optional), and the per-user file is maintained | ||
403 | automatically: whenever the user connects from an unknown host, its key | ||
404 | is added to the per-user file. | ||
405 | |||
406 | Each line in these files contains the following fields: markers | ||
407 | (optional), hostnames, bits, exponent, modulus, comment. The fields are | ||
408 | separated by spaces. | ||
409 | |||
410 | The marker is optional, but if it is present then it must be one of | ||
411 | ``@cert-authority'', to indicate that the line contains a certification | ||
412 | authority (CA) key, or ``@revoked'', to indicate that the key contained | ||
413 | on the line is revoked and must not ever be accepted. Only one marker | ||
414 | should be used on a key line. | ||
415 | |||
416 | Hostnames is a comma-separated list of patterns (`*' and `?' act as | ||
417 | wildcards); each pattern in turn is matched against the canonical host | ||
418 | name (when authenticating a client) or against the user-supplied name | ||
419 | (when authenticating a server). A pattern may also be preceded by `!' to | ||
420 | indicate negation: if the host name matches a negated pattern, it is not | ||
421 | accepted (by that line) even if it matched another pattern on the line. | ||
422 | A hostname or address may optionally be enclosed within `[' and `]' | ||
423 | brackets then followed by `:' and a non-standard port number. | ||
424 | |||
425 | Alternately, hostnames may be stored in a hashed form which hides host | ||
426 | names and addresses should the file's contents be disclosed. Hashed | ||
427 | hostnames start with a `|' character. Only one hashed hostname may | ||
428 | appear on a single line and none of the above negation or wildcard | ||
429 | operators may be applied. | ||
430 | |||
431 | Bits, exponent, and modulus are taken directly from the RSA host key; | ||
432 | they can be obtained, for example, from /etc/ssh/ssh_host_key.pub. The | ||
433 | optional comment field continues to the end of the line, and is not used. | ||
434 | |||
435 | Lines starting with `#' and empty lines are ignored as comments. | ||
436 | |||
437 | When performing host authentication, authentication is accepted if any | ||
438 | matching line has the proper key; either one that matches exactly or, if | ||
439 | the server has presented a certificate for authentication, the key of the | ||
440 | certification authority that signed the certificate. For a key to be | ||
441 | trusted as a certification authority, it must use the ``@cert-authority'' | ||
442 | marker described above. | ||
443 | |||
444 | The known hosts file also provides a facility to mark keys as revoked, | ||
445 | for example when it is known that the associated private key has been | ||
446 | stolen. Revoked keys are specified by including the ``@revoked'' marker | ||
447 | at the beginning of the key line, and are never accepted for | ||
448 | authentication or as certification authorities, but instead will produce | ||
449 | a warning from ssh(1) when they are encountered. | ||
450 | |||
451 | It is permissible (but not recommended) to have several lines or | ||
452 | different host keys for the same names. This will inevitably happen when | ||
453 | short forms of host names from different domains are put in the file. It | ||
454 | is possible that the files contain conflicting information; | ||
455 | authentication is accepted if valid information can be found from either | ||
456 | file. | ||
457 | |||
458 | Note that the lines in these files are typically hundreds of characters | ||
459 | long, and you definitely don't want to type in the host keys by hand. | ||
460 | Rather, generate them by a script, ssh-keyscan(1) or by taking | ||
461 | /etc/ssh/ssh_host_key.pub and adding the host names at the front. | ||
462 | ssh-keygen(1) also offers some basic automated editing for | ||
463 | ~/.ssh/known_hosts including removing hosts matching a host name and | ||
464 | converting all host names to their hashed representations. | ||
465 | |||
466 | An example ssh_known_hosts file: | ||
467 | |||
468 | # Comments allowed at start of line | ||
469 | closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net | ||
470 | cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....= | ||
471 | # A hashed hostname | ||
472 | |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa | ||
473 | AAAA1234.....= | ||
474 | # A revoked key | ||
475 | @revoked * ssh-rsa AAAAB5W... | ||
476 | # A CA key, accepted for any host in *.mydomain.com or *.mydomain.org | ||
477 | @cert-authority *.mydomain.org,*.mydomain.com ssh-rsa AAAAB5W... | ||
478 | |||
479 | FILES | ||
480 | ~/.hushlogin | ||
481 | This file is used to suppress printing the last login time and | ||
482 | /etc/motd, if PrintLastLog and PrintMotd, respectively, are | ||
483 | enabled. It does not suppress printing of the banner specified | ||
484 | by Banner. | ||
485 | |||
486 | ~/.rhosts | ||
487 | This file is used for host-based authentication (see ssh(1) for | ||
488 | more information). On some machines this file may need to be | ||
489 | world-readable if the user's home directory is on an NFS | ||
490 | partition, because sshd reads it as root. Additionally, this | ||
491 | file must be owned by the user, and must not have write | ||
492 | permissions for anyone else. The recommended permission for most | ||
493 | machines is read/write for the user, and not accessible by | ||
494 | others. | ||
495 | |||
496 | ~/.shosts | ||
497 | This file is used in exactly the same way as .rhosts, but allows | ||
498 | host-based authentication without permitting login with | ||
499 | rlogin/rsh. | ||
500 | |||
501 | ~/.ssh/ | ||
502 | This directory is the default location for all user-specific | ||
503 | configuration and authentication information. There is no | ||
504 | general requirement to keep the entire contents of this directory | ||
505 | secret, but the recommended permissions are read/write/execute | ||
506 | for the user, and not accessible by others. | ||
507 | |||
508 | ~/.ssh/authorized_keys | ||
509 | Lists the public keys (DSA/ECDSA/RSA) that can be used for | ||
510 | logging in as this user. The format of this file is described | ||
511 | above. The content of the file is not highly sensitive, but the | ||
512 | recommended permissions are read/write for the user, and not | ||
513 | accessible by others. | ||
514 | |||
515 | If this file, the ~/.ssh directory, or the user's home directory | ||
516 | are writable by other users, then the file could be modified or | ||
517 | replaced by unauthorized users. In this case, sshd will not | ||
518 | allow it to be used unless the StrictModes option has been set to | ||
519 | ``no''. | ||
520 | |||
521 | ~/.ssh/environment | ||
522 | This file is read into the environment at login (if it exists). | ||
523 | It can only contain empty lines, comment lines (that start with | ||
524 | `#'), and assignment lines of the form name=value. The file | ||
525 | should be writable only by the user; it need not be readable by | ||
526 | anyone else. Environment processing is disabled by default and | ||
527 | is controlled via the PermitUserEnvironment option. | ||
528 | |||
529 | ~/.ssh/known_hosts | ||
530 | Contains a list of host keys for all hosts the user has logged | ||
531 | into that are not already in the systemwide list of known host | ||
532 | keys. The format of this file is described above. This file | ||
533 | should be writable only by root/the owner and can, but need not | ||
534 | be, world-readable. | ||
535 | |||
536 | ~/.ssh/rc | ||
537 | Contains initialization routines to be run before the user's home | ||
538 | directory becomes accessible. This file should be writable only | ||
539 | by the user, and need not be readable by anyone else. | ||
540 | |||
541 | /etc/hosts.allow | ||
542 | /etc/hosts.deny | ||
543 | Access controls that should be enforced by tcp-wrappers are | ||
544 | defined here. Further details are described in hosts_access(5). | ||
545 | |||
546 | /etc/hosts.equiv | ||
547 | This file is for host-based authentication (see ssh(1)). It | ||
548 | should only be writable by root. | ||
549 | |||
550 | /etc/moduli | ||
551 | Contains Diffie-Hellman groups used for the "Diffie-Hellman Group | ||
552 | Exchange". The file format is described in moduli(5). | ||
553 | |||
554 | /etc/motd | ||
555 | See motd(5). | ||
556 | |||
557 | /etc/nologin | ||
558 | If this file exists, sshd refuses to let anyone except root log | ||
559 | in. The contents of the file are displayed to anyone trying to | ||
560 | log in, and non-root connections are refused. The file should be | ||
561 | world-readable. | ||
562 | |||
563 | /etc/shosts.equiv | ||
564 | This file is used in exactly the same way as hosts.equiv, but | ||
565 | allows host-based authentication without permitting login with | ||
566 | rlogin/rsh. | ||
567 | |||
568 | /etc/ssh/ssh_host_key | ||
569 | /etc/ssh/ssh_host_dsa_key | ||
570 | /etc/ssh/ssh_host_ecdsa_key | ||
571 | /etc/ssh/ssh_host_rsa_key | ||
572 | These three files contain the private parts of the host keys. | ||
573 | These files should only be owned by root, readable only by root, | ||
574 | and not accessible to others. Note that sshd does not start if | ||
575 | these files are group/world-accessible. | ||
576 | |||
577 | /etc/ssh/ssh_host_key.pub | ||
578 | /etc/ssh/ssh_host_dsa_key.pub | ||
579 | /etc/ssh/ssh_host_ecdsa_key.pub | ||
580 | /etc/ssh/ssh_host_rsa_key.pub | ||
581 | These three files contain the public parts of the host keys. | ||
582 | These files should be world-readable but writable only by root. | ||
583 | Their contents should match the respective private parts. These | ||
584 | files are not really used for anything; they are provided for the | ||
585 | convenience of the user so their contents can be copied to known | ||
586 | hosts files. These files are created using ssh-keygen(1). | ||
587 | |||
588 | /etc/ssh/ssh_known_hosts | ||
589 | Systemwide list of known host keys. This file should be prepared | ||
590 | by the system administrator to contain the public host keys of | ||
591 | all machines in the organization. The format of this file is | ||
592 | described above. This file should be writable only by root/the | ||
593 | owner and should be world-readable. | ||
594 | |||
595 | /etc/ssh/sshd_config | ||
596 | Contains configuration data for sshd. The file format and | ||
597 | configuration options are described in sshd_config(5). | ||
598 | |||
599 | /etc/ssh/sshrc | ||
600 | Similar to ~/.ssh/rc, it can be used to specify machine-specific | ||
601 | login-time initializations globally. This file should be | ||
602 | writable only by root, and should be world-readable. | ||
603 | |||
604 | /var/empty | ||
605 | chroot(2) directory used by sshd during privilege separation in | ||
606 | the pre-authentication phase. The directory should not contain | ||
607 | any files and must be owned by root and not group or world- | ||
608 | writable. | ||
609 | |||
610 | /var/run/sshd.pid | ||
611 | Contains the process ID of the sshd listening for connections (if | ||
612 | there are several daemons running concurrently for different | ||
613 | ports, this contains the process ID of the one started last). | ||
614 | The content of this file is not sensitive; it can be world- | ||
615 | readable. | ||
616 | |||
617 | SEE ALSO | ||
618 | scp(1), sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), | ||
619 | ssh-keyscan(1), chroot(2), hosts_access(5), login.conf(5), moduli(5), | ||
620 | sshd_config(5), inetd(8), sftp-server(8) | ||
621 | |||
622 | AUTHORS | ||
623 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by | ||
624 | Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo | ||
625 | de Raadt and Dug Song removed many bugs, re-added newer features and | ||
626 | created OpenSSH. Markus Friedl contributed the support for SSH protocol | ||
627 | versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support | ||
628 | for privilege separation. | ||
629 | |||
630 | CAVEATS | ||
631 | System security is not improved unless rshd, rlogind, and rexecd are | ||
632 | disabled (thus completely disabling rlogin and rsh into the machine). | ||
633 | |||
634 | OpenBSD 4.9 October 28, 2010 OpenBSD 4.9 | ||