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