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