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