]>
Commit | Line | Data |
---|---|---|
bf740959 | 1 | .\" -*- nroff -*- |
2 | .\" | |
bf740959 | 3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
bf740959 | 4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
5 | .\" All rights reserved | |
6 | .\" | |
bcbf86ec | 7 | .\" As far as I am concerned, the code I have written for this software |
8 | .\" can be used freely for any purpose. Any derived versions of this | |
9 | .\" software must be clearly marked as such, and if the derived work is | |
10 | .\" incompatible with the protocol description in the RFC file, it must be | |
11 | .\" called by a name other than "ssh" or "Secure Shell". | |
12 | .\" | |
f3c7c613 | 13 | .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved. |
14 | .\" Copyright (c) 1999 Aaron Campbell. All rights reserved. | |
15 | .\" Copyright (c) 1999 Theo de Raadt. All rights reserved. | |
bcbf86ec | 16 | .\" |
17 | .\" Redistribution and use in source and binary forms, with or without | |
18 | .\" modification, are permitted provided that the following conditions | |
19 | .\" are met: | |
20 | .\" 1. Redistributions of source code must retain the above copyright | |
21 | .\" notice, this list of conditions and the following disclaimer. | |
22 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
23 | .\" notice, this list of conditions and the following disclaimer in the | |
24 | .\" documentation and/or other materials provided with the distribution. | |
bf740959 | 25 | .\" |
bcbf86ec | 26 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
27 | .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
28 | .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
29 | .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
30 | .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
31 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
32 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
33 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
bf740959 | 36 | .\" |
0dba6d86 | 37 | .\" $OpenBSD: sshd.8,v 1.249 2009/10/08 20:42:13 jmc Exp $ |
e473dcd1 | 38 | .Dd $Mdocdate$ |
bf740959 | 39 | .Dt SSHD 8 |
40 | .Os | |
41 | .Sh NAME | |
42 | .Nm sshd | |
da89cf4d | 43 | .Nd OpenSSH SSH daemon |
bf740959 | 44 | .Sh SYNOPSIS |
45 | .Nm sshd | |
6691e41b | 46 | .Bk -words |
3b42e3ac | 47 | .Op Fl 46DdeiqTt |
bf740959 | 48 | .Op Fl b Ar bits |
1760c982 | 49 | .Op Fl C Ar connection_spec |
bf740959 | 50 | .Op Fl f Ar config_file |
51 | .Op Fl g Ar login_grace_time | |
52 | .Op Fl h Ar host_key_file | |
53 | .Op Fl k Ar key_gen_time | |
2717fa0f | 54 | .Op Fl o Ar option |
bf740959 | 55 | .Op Fl p Ar port |
c345cf9d | 56 | .Op Fl u Ar len |
6691e41b | 57 | .Ek |
f54651ce | 58 | .Sh DESCRIPTION |
bf740959 | 59 | .Nm |
ec63d7ce | 60 | (OpenSSH Daemon) is the daemon program for |
bf740959 | 61 | .Xr ssh 1 . |
82029813 | 62 | Together these programs replace |
63 | .Xr rlogin 1 | |
64 | and | |
65 | .Xr rsh 1 , | |
66 | and provide secure encrypted communications between two untrusted hosts | |
4fe2af09 | 67 | over an insecure network. |
bf740959 | 68 | .Pp |
69 | .Nm | |
ec63d7ce | 70 | listens for connections from clients. |
f54651ce | 71 | It is normally started at boot from |
bf740959 | 72 | .Pa /etc/rc . |
73 | It forks a new | |
4fe2af09 | 74 | daemon for each incoming connection. |
75 | The forked daemons handle | |
bf740959 | 76 | key exchange, encryption, authentication, command execution, |
77 | and data exchange. | |
bf740959 | 78 | .Pp |
79 | .Nm | |
433e60ac | 80 | can be configured using command-line options or a configuration file |
81 | (by default | |
ec63d7ce | 82 | .Xr sshd_config 5 ) ; |
83 | command-line options override values specified in the | |
bf740959 | 84 | configuration file. |
9d6b7add | 85 | .Nm |
86 | rereads its configuration file when it receives a hangup signal, | |
409edaba | 87 | .Dv SIGHUP , |
f09ffbdb | 88 | by executing itself with the name and options it was started with, e.g.\& |
409edaba | 89 | .Pa /usr/sbin/sshd . |
9d6b7add | 90 | .Pp |
bf740959 | 91 | The options are as follows: |
92 | .Bl -tag -width Ds | |
433e60ac | 93 | .It Fl 4 |
94 | Forces | |
95 | .Nm | |
96 | to use IPv4 addresses only. | |
97 | .It Fl 6 | |
98 | Forces | |
99 | .Nm | |
100 | to use IPv6 addresses only. | |
bf740959 | 101 | .It Fl b Ar bits |
da89cf4d | 102 | Specifies the number of bits in the ephemeral protocol version 1 |
39ceddb7 | 103 | server key (default 1024). |
3b42e3ac | 104 | .It Fl C Ar connection_spec |
105 | Specify the connection parameters to use for the | |
106 | .Fl T | |
107 | extended test mode. | |
108 | If provided, any | |
109 | .Cm Match | |
110 | directives in the configuration file | |
111 | that would apply to the specified user, host, and address will be set before | |
112 | the configuration is written to standard output. | |
113 | The connection parameters are supplied as keyword=value pairs. | |
114 | The keywords are | |
115 | .Dq user , | |
116 | .Dq host , | |
117 | and | |
118 | .Dq addr . | |
119 | All are required and may be supplied in any order, either with multiple | |
120 | .Fl C | |
121 | options or as a comma-separated list. | |
433e60ac | 122 | .It Fl D |
123 | When this option is specified, | |
124 | .Nm | |
125 | will not detach and does not become a daemon. | |
126 | This allows easy monitoring of | |
127 | .Nm sshd . | |
bf740959 | 128 | .It Fl d |
4fe2af09 | 129 | Debug mode. |
130 | The server sends verbose debug output to the system | |
131 | log, and does not put itself in the background. | |
132 | The server also will not fork and will only process one connection. | |
133 | This option is only intended for debugging for the server. | |
6691e41b | 134 | Multiple |
135 | .Fl d | |
136 | options increase the debugging level. | |
94ec8c6b | 137 | Maximum is 3. |
da89cf4d | 138 | .It Fl e |
139 | When this option is specified, | |
140 | .Nm | |
141 | will send the output to the standard error instead of the system log. | |
82029813 | 142 | .It Fl f Ar config_file |
4fe2af09 | 143 | Specifies the name of the configuration file. |
144 | The default is | |
2a8a6488 | 145 | .Pa /etc/ssh/sshd_config . |
bf740959 | 146 | .Nm |
147 | refuses to start if there is no configuration file. | |
148 | .It Fl g Ar login_grace_time | |
149 | Gives the grace time for clients to authenticate themselves (default | |
3445ca02 | 150 | 120 seconds). |
4fe2af09 | 151 | If the client fails to authenticate the user within |
152 | this many seconds, the server disconnects and exits. | |
153 | A value of zero indicates no limit. | |
bf740959 | 154 | .It Fl h Ar host_key_file |
0f84fe37 | 155 | Specifies a file from which a host key is read. |
bf740959 | 156 | This option must be given if |
157 | .Nm | |
158 | is not run as root (as the normal | |
0f84fe37 | 159 | host key files are normally not readable by anyone but root). |
160 | The default is | |
2a8a6488 | 161 | .Pa /etc/ssh/ssh_host_key |
0f84fe37 | 162 | for protocol version 1, and |
2a8a6488 | 163 | .Pa /etc/ssh/ssh_host_rsa_key |
0f84fe37 | 164 | and |
2a8a6488 | 165 | .Pa /etc/ssh/ssh_host_dsa_key |
0f84fe37 | 166 | for protocol version 2. |
8abcdba4 | 167 | It is possible to have multiple host key files for |
da89cf4d | 168 | the different protocol versions and host key algorithms. |
bf740959 | 169 | .It Fl i |
170 | Specifies that | |
171 | .Nm | |
6691e41b | 172 | is being run from |
173 | .Xr inetd 8 . | |
bf740959 | 174 | .Nm |
175 | is normally not run | |
176 | from inetd because it needs to generate the server key before it can | |
4fe2af09 | 177 | respond to the client, and this may take tens of seconds. |
178 | Clients would have to wait too long if the key was regenerated every time. | |
f09ffbdb | 179 | However, with small key sizes (e.g. 512) using |
bf740959 | 180 | .Nm |
181 | from inetd may | |
182 | be feasible. | |
183 | .It Fl k Ar key_gen_time | |
da89cf4d | 184 | Specifies how often the ephemeral protocol version 1 server key is |
185 | regenerated (default 3600 seconds, or one hour). | |
4fe2af09 | 186 | The motivation for regenerating the key fairly |
433e60ac | 187 | often is that the key is not stored anywhere, and after about an hour |
bf740959 | 188 | it becomes impossible to recover the key for decrypting intercepted |
189 | communications even if the machine is cracked into or physically | |
4fe2af09 | 190 | seized. |
191 | A value of zero indicates that the key will never be regenerated. | |
2717fa0f | 192 | .It Fl o Ar option |
193 | Can be used to give options in the format used in the configuration file. | |
194 | This is useful for specifying options for which there is no separate | |
195 | command-line flag. | |
433e60ac | 196 | For full details of the options, and their values, see |
197 | .Xr sshd_config 5 . | |
bf740959 | 198 | .It Fl p Ar port |
199 | Specifies the port on which the server listens for connections | |
200 | (default 22). | |
135113a3 | 201 | Multiple port options are permitted. |
6cd6c442 | 202 | Ports specified in the configuration file with the |
203 | .Cm Port | |
204 | option are ignored when a command-line port is specified. | |
205 | Ports specified using the | |
206 | .Cm ListenAddress | |
207 | option override command-line ports. | |
bf740959 | 208 | .It Fl q |
4fe2af09 | 209 | Quiet mode. |
210 | Nothing is sent to the system log. | |
211 | Normally the beginning, | |
bf740959 | 212 | authentication, and termination of each connection is logged. |
1760c982 | 213 | .It Fl T |
214 | Extended test mode. | |
215 | Check the validity of the configuration file, output the effective configuration | |
216 | to stdout and then exit. | |
217 | Optionally, | |
218 | .Cm Match | |
219 | rules may be applied by specifying the connection parameters using one or more | |
220 | .Fl C | |
221 | options. | |
3b42e3ac | 222 | .It Fl t |
223 | Test mode. | |
224 | Only check the validity of the configuration file and sanity of the keys. | |
225 | This is useful for updating | |
226 | .Nm | |
227 | reliably as configuration options may change. | |
c345cf9d | 228 | .It Fl u Ar len |
229 | This option is used to specify the size of the field | |
230 | in the | |
231 | .Li utmp | |
232 | structure that holds the remote host name. | |
233 | If the resolved host name is longer than | |
234 | .Ar len , | |
235 | the dotted decimal value will be used instead. | |
236 | This allows hosts with very long host names that | |
237 | overflow this field to still be uniquely identified. | |
238 | Specifying | |
239 | .Fl u0 | |
240 | indicates that only dotted decimal addresses | |
241 | should be put into the | |
242 | .Pa utmp | |
243 | file. | |
e675b851 | 244 | .Fl u0 |
6691e41b | 245 | may also be used to prevent |
e675b851 | 246 | .Nm |
247 | from making DNS requests unless the authentication | |
248 | mechanism or configuration requires it. | |
249 | Authentication mechanisms that may require DNS include | |
e675b851 | 250 | .Cm RhostsRSAAuthentication , |
170c69ba | 251 | .Cm HostbasedAuthentication , |
e675b851 | 252 | and using a |
253 | .Cm from="pattern-list" | |
254 | option in a key file. | |
f464aad8 | 255 | Configuration options that require DNS include using a |
256 | USER@HOST pattern in | |
257 | .Cm AllowUsers | |
258 | or | |
259 | .Cm DenyUsers . | |
bf740959 | 260 | .El |
f3906047 | 261 | .Sh AUTHENTICATION |
262 | The OpenSSH SSH daemon supports SSH protocols 1 and 2. | |
0dba6d86 | 263 | The default is to use protocol 2 only, |
f3906047 | 264 | though this can be changed via the |
265 | .Cm Protocol | |
266 | option in | |
267 | .Xr sshd_config 5 . | |
268 | Protocol 2 supports both RSA and DSA keys; | |
269 | protocol 1 only supports RSA keys. | |
270 | For both protocols, | |
271 | each host has a host-specific key, | |
272 | normally 2048 bits, | |
273 | used to identify the host. | |
ec63d7ce | 274 | .Pp |
f3906047 | 275 | Forward security for protocol 1 is provided through |
276 | an additional server key, | |
277 | normally 768 bits, | |
278 | generated when the server starts. | |
ec63d7ce | 279 | This key is normally regenerated every hour if it has been used, and |
280 | is never stored on disk. | |
ec63d7ce | 281 | Whenever a client connects, the daemon responds with its public |
282 | host and server keys. | |
283 | The client compares the | |
284 | RSA host key against its own database to verify that it has not changed. | |
285 | The client then generates a 256-bit random number. | |
286 | It encrypts this | |
287 | random number using both the host key and the server key, and sends | |
288 | the encrypted number to the server. | |
289 | Both sides then use this | |
290 | random number as a session key which is used to encrypt all further | |
291 | communications in the session. | |
292 | The rest of the session is encrypted | |
293 | using a conventional cipher, currently Blowfish or 3DES, with 3DES | |
294 | being used by default. | |
295 | The client selects the encryption algorithm | |
296 | to use from those offered by the server. | |
297 | .Pp | |
f3906047 | 298 | For protocol 2, |
299 | forward security is provided through a Diffie-Hellman key agreement. | |
300 | This key agreement results in a shared session key. | |
301 | The rest of the session is encrypted using a symmetric cipher, currently | |
302 | 128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES. | |
303 | The client selects the encryption algorithm | |
304 | to use from those offered by the server. | |
305 | Additionally, session integrity is provided | |
306 | through a cryptographic message authentication code | |
f444d0f8 | 307 | (hmac-md5, hmac-sha1, umac-64 or hmac-ripemd160). |
f3906047 | 308 | .Pp |
309 | Finally, the server and the client enter an authentication dialog. | |
ec63d7ce | 310 | The client tries to authenticate itself using |
f3906047 | 311 | host-based authentication, |
312 | public key authentication, | |
313 | challenge-response authentication, | |
314 | or password authentication. | |
ec63d7ce | 315 | .Pp |
316 | Regardless of the authentication type, the account is checked to | |
317 | ensure that it is accessible. An account is not accessible if it is | |
318 | locked, listed in | |
319 | .Cm DenyUsers | |
320 | or its group is listed in | |
321 | .Cm DenyGroups | |
322 | \&. The definition of a locked account is system dependant. Some platforms | |
323 | have their own account database (eg AIX) and some modify the passwd field ( | |
324 | .Ql \&*LK\&* | |
325 | on Solaris and UnixWare, | |
326 | .Ql \&* | |
327 | on HP-UX, containing | |
328 | .Ql Nologin | |
329 | on Tru64, | |
330 | a leading | |
331 | .Ql \&*LOCKED\&* | |
332 | on FreeBSD and a leading | |
145707ab | 333 | .Ql \&! |
334 | on most Linuxes). | |
335 | If there is a requirement to disable password authentication | |
ec63d7ce | 336 | for the account while allowing still public-key, then the passwd field |
337 | should be set to something other than these values (eg | |
338 | .Ql NP | |
339 | or | |
340 | .Ql \&*NP\&* | |
341 | ). | |
342 | .Pp | |
ec63d7ce | 343 | If the client successfully authenticates itself, a dialog for |
344 | preparing the session is entered. | |
345 | At this time the client may request | |
346 | things like allocating a pseudo-tty, forwarding X11 connections, | |
347 | forwarding TCP connections, or forwarding the authentication agent | |
348 | connection over the secure channel. | |
349 | .Pp | |
4eb67845 | 350 | After this, the client either requests a shell or execution of a command. |
ec63d7ce | 351 | The sides then enter session mode. |
352 | In this mode, either side may send | |
353 | data at any time, and such data is forwarded to/from the shell or | |
354 | command on the server side, and the user terminal in the client side. | |
355 | .Pp | |
356 | When the user program terminates and all forwarded X11 and other | |
357 | connections have been closed, the server sends command exit status to | |
358 | the client, and both sides exit. | |
bf740959 | 359 | .Sh LOGIN PROCESS |
360 | When a user successfully logs in, | |
361 | .Nm | |
362 | does the following: | |
363 | .Bl -enum -offset indent | |
364 | .It | |
365 | If the login is on a tty, and no command has been specified, | |
f54651ce | 366 | prints last login time and |
bf740959 | 367 | .Pa /etc/motd |
368 | (unless prevented in the configuration file or by | |
140e3e97 | 369 | .Pa ~/.hushlogin ; |
bf740959 | 370 | see the |
f54651ce | 371 | .Sx FILES |
bf740959 | 372 | section). |
373 | .It | |
374 | If the login is on a tty, records login time. | |
375 | .It | |
376 | Checks | |
377 | .Pa /etc/nologin ; | |
378 | if it exists, prints contents and quits | |
379 | (unless root). | |
380 | .It | |
381 | Changes to run with normal user privileges. | |
382 | .It | |
383 | Sets up basic environment. | |
384 | .It | |
433e60ac | 385 | Reads the file |
140e3e97 | 386 | .Pa ~/.ssh/environment , |
433e60ac | 387 | if it exists, and users are allowed to change their environment. |
35453849 | 388 | See the |
6a342527 | 389 | .Cm PermitUserEnvironment |
35453849 | 390 | option in |
6a342527 | 391 | .Xr sshd_config 5 . |
bf740959 | 392 | .It |
393 | Changes to user's home directory. | |
394 | .It | |
395 | If | |
140e3e97 | 396 | .Pa ~/.ssh/rc |
bf740959 | 397 | exists, runs it; else if |
af98ced9 | 398 | .Pa /etc/ssh/sshrc |
bf740959 | 399 | exists, runs |
4fe2af09 | 400 | it; otherwise runs xauth. |
401 | The | |
bf740959 | 402 | .Dq rc |
403 | files are given the X11 | |
404 | authentication protocol and cookie in standard input. | |
f3d2d92e | 405 | See |
406 | .Sx SSHRC , | |
407 | below. | |
bf740959 | 408 | .It |
409 | Runs user's shell or command. | |
410 | .El | |
f3d2d92e | 411 | .Sh SSHRC |
412 | If the file | |
413 | .Pa ~/.ssh/rc | |
414 | exists, | |
415 | .Xr sh 1 | |
416 | runs it after reading the | |
417 | environment files but before starting the user's shell or command. | |
418 | It must not produce any output on stdout; stderr must be used | |
419 | instead. | |
420 | If X11 forwarding is in use, it will receive the "proto cookie" pair in | |
421 | its standard input (and | |
422 | .Ev DISPLAY | |
423 | in its environment). | |
424 | The script must call | |
425 | .Xr xauth 1 | |
426 | because | |
427 | .Nm | |
428 | will not run xauth automatically to add X11 cookies. | |
429 | .Pp | |
430 | The primary purpose of this file is to run any initialization routines | |
431 | which may be needed before the user's home directory becomes | |
432 | accessible; AFS is a particular example of such an environment. | |
433 | .Pp | |
434 | This file will probably contain some initialization code followed by | |
435 | something similar to: | |
436 | .Bd -literal -offset 3n | |
437 | if read proto cookie && [ -n "$DISPLAY" ]; then | |
438 | if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then | |
439 | # X11UseLocalhost=yes | |
440 | echo add unix:`echo $DISPLAY | | |
441 | cut -c11-` $proto $cookie | |
442 | else | |
443 | # X11UseLocalhost=no | |
444 | echo add $DISPLAY $proto $cookie | |
445 | fi | xauth -q - | |
446 | fi | |
447 | .Ed | |
448 | .Pp | |
449 | If this file does not exist, | |
450 | .Pa /etc/ssh/sshrc | |
451 | is run, and if that | |
452 | does not exist either, xauth is used to add the cookie. | |
bf740959 | 453 | .Sh AUTHORIZED_KEYS FILE FORMAT |
96a7b0cc | 454 | .Cm AuthorizedKeysFile |
010c04e5 | 455 | specifies the file containing public keys for |
456 | public key authentication; | |
457 | if none is specified, the default is | |
458 | .Pa ~/.ssh/authorized_keys . | |
4fe2af09 | 459 | Each line of the file contains one |
bf740959 | 460 | key (empty lines and lines starting with a |
461 | .Ql # | |
462 | are ignored as | |
4fe2af09 | 463 | comments). |
010c04e5 | 464 | Protocol 1 public keys consist of the following space-separated fields: |
465 | options, bits, exponent, modulus, comment. | |
466 | Protocol 2 public key consist of: | |
467 | options, keytype, base64-encoded key, comment. | |
468 | The options field is optional; | |
469 | its presence is determined by whether the line starts | |
755c4339 | 470 | with a number or not (the options field never starts with a number). |
010c04e5 | 471 | The bits, exponent, modulus, and comment fields give the RSA key for |
8abcdba4 | 472 | protocol version 1; the |
bf740959 | 473 | comment field is not used for anything (but may be convenient for the |
474 | user to identify the key). | |
8abcdba4 | 475 | For protocol version 2 the keytype is |
476 | .Dq ssh-dss | |
477 | or | |
478 | .Dq ssh-rsa . | |
bf740959 | 479 | .Pp |
480 | Note that lines in this file are usually several hundred bytes long | |
ea067773 | 481 | (because of the size of the public key encoding) up to a limit of |
482 | 8 kilobytes, which permits DSA keys up to 8 kilobits and RSA | |
483 | keys up to 16 kilobits. | |
4fe2af09 | 484 | You don't want to type them in; instead, copy the |
c0ecc314 | 485 | .Pa identity.pub , |
010c04e5 | 486 | .Pa id_dsa.pub , |
c0ecc314 | 487 | or the |
488 | .Pa id_rsa.pub | |
bf740959 | 489 | file and edit it. |
490 | .Pp | |
3bc822df | 491 | .Nm |
492 | enforces a minimum RSA key modulus size for protocol 1 | |
493 | and protocol 2 keys of 768 bits. | |
494 | .Pp | |
c345cf9d | 495 | The options (if present) consist of comma-separated option |
4fe2af09 | 496 | specifications. |
497 | No spaces are permitted, except within double quotes. | |
54bf768d | 498 | The following option specifications are supported (note |
499 | that option keywords are case-insensitive): | |
bf740959 | 500 | .Bl -tag -width Ds |
bf740959 | 501 | .It Cm command="command" |
502 | Specifies that the command is executed whenever this key is used for | |
4fe2af09 | 503 | authentication. |
504 | The command supplied by the user (if any) is ignored. | |
9658ecbc | 505 | The command is run on a pty if the client requests a pty; |
4fe2af09 | 506 | otherwise it is run without a tty. |
6691e41b | 507 | If an 8-bit clean channel is required, |
91789042 | 508 | one must not request a pty or should specify |
61e96248 | 509 | .Cm no-pty . |
4fe2af09 | 510 | A quote may be included in the command by quoting it with a backslash. |
511 | This option might be useful | |
755c4339 | 512 | to restrict certain public keys to perform just a specific operation. |
4fe2af09 | 513 | An example might be a key that permits remote backups but nothing else. |
e5d4cfad | 514 | Note that the client may specify TCP and/or X11 |
d0c832f3 | 515 | forwarding unless they are explicitly prohibited. |
e7259e8d | 516 | The command originally supplied by the client is available in the |
517 | .Ev SSH_ORIGINAL_COMMAND | |
518 | environment variable. | |
4cdbc654 | 519 | Note that this option applies to shell, command or subsystem execution. |
bf740959 | 520 | .It Cm environment="NAME=value" |
521 | Specifies that the string is to be added to the environment when | |
4fe2af09 | 522 | logging in using this key. |
523 | Environment variables set this way | |
524 | override other default environment values. | |
525 | Multiple options of this type are permitted. | |
35453849 | 526 | Environment processing is disabled by default and is |
527 | controlled via the | |
528 | .Cm PermitUserEnvironment | |
529 | option. | |
2548961d | 530 | This option is automatically disabled if |
531 | .Cm UseLogin | |
532 | is enabled. | |
9ed4bd80 | 533 | .It Cm from="pattern-list" |
b3b048d6 | 534 | Specifies that in addition to public key authentication, either the canonical |
9754b94b | 535 | name of the remote host or its IP address must be present in the |
b3b048d6 | 536 | comma-separated list of patterns. |
4cb23985 | 537 | See |
538 | .Sx PATTERNS | |
539 | in | |
540 | .Xr ssh_config 5 | |
541 | for more information on patterns. | |
b3b048d6 | 542 | .Pp |
543 | In addition to the wildcard matching that may be applied to hostnames or | |
544 | addresses, a | |
545 | .Cm from | |
b31ae930 | 546 | stanza may match IP addresses using CIDR address/masklen notation. |
b3b048d6 | 547 | .Pp |
548 | The purpose of this option is to optionally increase security: public key | |
549 | authentication by itself does not trust the network or name servers or | |
550 | anything (but the key); however, if somebody somehow steals the key, the key | |
551 | permits an intruder to log in from anywhere in the world. | |
552 | This additional option makes using a stolen key more difficult (name | |
553 | servers and/or routers would have to be compromised in addition to | |
554 | just the key). | |
9ed4bd80 | 555 | .It Cm no-agent-forwarding |
556 | Forbids authentication agent forwarding when this key is used for | |
557 | authentication. | |
bf740959 | 558 | .It Cm no-port-forwarding |
e5d4cfad | 559 | Forbids TCP forwarding when this key is used for authentication. |
4fe2af09 | 560 | Any port forward requests by the client will return an error. |
f09ffbdb | 561 | This might be used, e.g. in connection with the |
bf740959 | 562 | .Cm command |
563 | option. | |
9ed4bd80 | 564 | .It Cm no-pty |
565 | Prevents tty allocation (a request to allocate a pty will fail). | |
8c03e768 | 566 | .It Cm no-user-rc |
adb7acbc | 567 | Disables execution of |
8c03e768 | 568 | .Pa ~/.ssh/rc . |
bf740959 | 569 | .It Cm no-X11-forwarding |
570 | Forbids X11 forwarding when this key is used for authentication. | |
571 | Any X11 forward requests by the client will return an error. | |
dc504afd | 572 | .It Cm permitopen="host:port" |
3730bb22 | 573 | Limit local |
dc504afd | 574 | .Li ``ssh -L'' |
b2ae83b8 | 575 | port forwarding such that it may only connect to the specified host and |
ed787d14 | 576 | port. |
577 | IPv6 addresses can be specified with an alternative syntax: | |
433e60ac | 578 | .Ar host Ns / Ns Ar port . |
ed787d14 | 579 | Multiple |
dc504afd | 580 | .Cm permitopen |
3cbc677d | 581 | options may be applied separated by commas. |
582 | No pattern matching is performed on the specified hostnames, | |
583 | they must be literal domains or addresses. | |
d20f3c9e | 584 | .It Cm tunnel="n" |
585 | Force a | |
586 | .Xr tun 4 | |
587 | device on the server. | |
588 | Without this option, the next available device will be used if | |
589 | the client requests a tunnel. | |
bf740959 | 590 | .El |
bf740959 | 591 | .Pp |
1e0fcfc6 | 592 | An example authorized_keys file: |
481e991f | 593 | .Bd -literal -offset 3n |
1e0fcfc6 | 594 | # Comments allowed at start of line |
595 | ssh-rsa AAAAB3Nza...LiPk== user@example.net | |
481e991f | 596 | from="*.sales.example.net,!pc.sales.example.net" ssh-rsa |
597 | AAAAB2...19Q== john@example.net | |
598 | command="dump /home",no-pty,no-port-forwarding ssh-dss | |
599 | AAAAC3...51R== example.net | |
600 | permitopen="192.0.2.1:80",permitopen="192.0.2.2:25" ssh-dss | |
601 | AAAAB5...21S== | |
602 | tunnel="0",command="sh /etc/netstart tun0" ssh-rsa AAAA...== | |
603 | jane@example.net | |
1e0fcfc6 | 604 | .Ed |
bf740959 | 605 | .Sh SSH_KNOWN_HOSTS FILE FORMAT |
f54651ce | 606 | The |
6691e41b | 607 | .Pa /etc/ssh/ssh_known_hosts |
f54651ce | 608 | and |
140e3e97 | 609 | .Pa ~/.ssh/known_hosts |
4fe2af09 | 610 | files contain host public keys for all known hosts. |
611 | The global file should | |
612 | be prepared by the administrator (optional), and the per-user file is | |
2881e0e9 | 613 | maintained automatically: whenever the user connects from an unknown host, |
4fe2af09 | 614 | its key is added to the per-user file. |
bf740959 | 615 | .Pp |
616 | Each line in these files contains the following fields: hostnames, | |
4fe2af09 | 617 | bits, exponent, modulus, comment. |
618 | The fields are separated by spaces. | |
bf740959 | 619 | .Pp |
09dc8896 | 620 | Hostnames is a comma-separated list of patterns |
2881e0e9 | 621 | .Pf ( Ql * |
3cbc677d | 622 | and |
623 | .Ql \&? | |
9a26a6e2 | 624 | act as |
bf740959 | 625 | wildcards); each pattern in turn is matched against the canonical host |
626 | name (when authenticating a client) or against the user-supplied | |
4fe2af09 | 627 | name (when authenticating a server). |
628 | A pattern may also be preceded by | |
9a26a6e2 | 629 | .Ql \&! |
bf740959 | 630 | to indicate negation: if the host name matches a negated |
631 | pattern, it is not accepted (by that line) even if it matched another | |
632 | pattern on the line. | |
d4530052 | 633 | A hostname or address may optionally be enclosed within |
634 | .Ql \&[ | |
635 | and | |
636 | .Ql \&] | |
637 | brackets then followed by | |
638 | .Ql \&: | |
a0bca6ed | 639 | and a non-standard port number. |
bf740959 | 640 | .Pp |
5c63c2ab | 641 | Alternately, hostnames may be stored in a hashed form which hides host names |
c79ae9fd | 642 | and addresses should the file's contents be disclosed. |
643 | Hashed hostnames start with a | |
644 | .Ql | | |
5c63c2ab | 645 | character. |
646 | Only one hashed hostname may appear on a single line and none of the above | |
647 | negation or wildcard operators may be applied. | |
648 | .Pp | |
1d1ffb87 | 649 | Bits, exponent, and modulus are taken directly from the RSA host key; they |
2881e0e9 | 650 | can be obtained, for example, from |
2a8a6488 | 651 | .Pa /etc/ssh/ssh_host_key.pub . |
bf740959 | 652 | The optional comment field continues to the end of the line, and is not used. |
653 | .Pp | |
654 | Lines starting with | |
655 | .Ql # | |
656 | and empty lines are ignored as comments. | |
657 | .Pp | |
658 | When performing host authentication, authentication is accepted if any | |
4fe2af09 | 659 | matching line has the proper key. |
660 | It is thus permissible (but not | |
bf740959 | 661 | recommended) to have several lines or different host keys for the same |
4fe2af09 | 662 | names. |
663 | This will inevitably happen when short forms of host names | |
664 | from different domains are put in the file. | |
665 | It is possible | |
bf740959 | 666 | that the files contain conflicting information; authentication is |
667 | accepted if valid information can be found from either file. | |
668 | .Pp | |
669 | Note that the lines in these files are typically hundreds of characters | |
670 | long, and you definitely don't want to type in the host keys by hand. | |
671 | Rather, generate them by a script | |
f54651ce | 672 | or by taking |
2a8a6488 | 673 | .Pa /etc/ssh/ssh_host_key.pub |
bf740959 | 674 | and adding the host names at the front. |
9d4b0313 | 675 | .Pp |
676 | An example ssh_known_hosts file: | |
677 | .Bd -literal -offset 3n | |
678 | # Comments allowed at start of line | |
679 | closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net | |
680 | cvs.example.net,192.0.2.10 ssh-rsa AAAA1234.....= | |
5c63c2ab | 681 | # A hashed hostname |
682 | |1|JfKTdBh7rNbXkVAQCRp4OQoPfmI=|USECr3SWf1JUPsms5AqfD5QfxkM= ssh-rsa | |
683 | AAAA1234.....= | |
684 | .Ed | |
bf740959 | 685 | .Sh FILES |
10fa86ae | 686 | .Bl -tag -width Ds -compact |
687 | .It ~/.hushlogin | |
a333272d | 688 | This file is used to suppress printing the last login time and |
689 | .Pa /etc/motd , | |
690 | if | |
691 | .Cm PrintLastLog | |
692 | and | |
693 | .Cm PrintMotd , | |
694 | respectively, | |
695 | are enabled. | |
696 | It does not suppress printing of the banner specified by | |
697 | .Cm Banner . | |
10fa86ae | 698 | .Pp |
699 | .It ~/.rhosts | |
00e7c607 | 700 | This file is used for host-based authentication (see |
701 | .Xr ssh 1 | |
702 | for more information). | |
703 | On some machines this file may need to be | |
704 | world-readable if the user's home directory is on an NFS partition, | |
705 | because | |
706 | .Nm | |
707 | reads it as root. | |
708 | Additionally, this file must be owned by the user, | |
709 | and must not have write permissions for anyone else. | |
710 | The recommended | |
711 | permission for most machines is read/write for the user, and not | |
bf740959 | 712 | accessible by others. |
713 | .Pp | |
10fa86ae | 714 | .It ~/.shosts |
00e7c607 | 715 | This file is used in exactly the same way as |
716 | .Pa .rhosts , | |
717 | but allows host-based authentication without permitting login with | |
718 | rlogin/rsh. | |
bf740959 | 719 | .Pp |
7c36e880 | 720 | .It ~/.ssh/ |
721 | This directory is the default location for all user-specific configuration | |
722 | and authentication information. | |
723 | There is no general requirement to keep the entire contents of this directory | |
724 | secret, but the recommended permissions are read/write/execute for the user, | |
725 | and not accessible by others. | |
726 | .Pp | |
10fa86ae | 727 | .It ~/.ssh/authorized_keys |
00e7c607 | 728 | Lists the public keys (RSA/DSA) that can be used for logging in as this user. |
10fa86ae | 729 | The format of this file is described above. |
5f047fbc | 730 | The content of the file is not highly sensitive, but the recommended |
00e7c607 | 731 | permissions are read/write for the user, and not accessible by others. |
bf740959 | 732 | .Pp |
5f047fbc | 733 | If this file, the |
734 | .Pa ~/.ssh | |
735 | directory, or the user's home directory are writable | |
736 | by other users, then the file could be modified or replaced by unauthorized | |
737 | users. | |
738 | In this case, | |
739 | .Nm | |
740 | will not allow it to be used unless the | |
741 | .Cm StrictModes | |
742 | option has been set to | |
743 | .Dq no . | |
5f047fbc | 744 | .Pp |
10fa86ae | 745 | .It ~/.ssh/environment |
4fe2af09 | 746 | This file is read into the environment at login (if it exists). |
747 | It can only contain empty lines, comment lines (that start with | |
bf740959 | 748 | .Ql # ) , |
4fe2af09 | 749 | and assignment lines of the form name=value. |
750 | The file should be writable | |
bf740959 | 751 | only by the user; it need not be readable by anyone else. |
35453849 | 752 | Environment processing is disabled by default and is |
753 | controlled via the | |
754 | .Cm PermitUserEnvironment | |
755 | option. | |
10fa86ae | 756 | .Pp |
757 | .It ~/.ssh/known_hosts | |
00e7c607 | 758 | Contains a list of host keys for all hosts the user has logged into |
759 | that are not already in the systemwide list of known host keys. | |
760 | The format of this file is described above. | |
761 | This file should be writable only by root/the owner and | |
10fa86ae | 762 | can, but need not be, world-readable. |
763 | .Pp | |
764 | .It ~/.ssh/rc | |
f3d2d92e | 765 | Contains initialization routines to be run before |
766 | the user's home directory becomes accessible. | |
bf740959 | 767 | This file should be writable only by the user, and need not be |
768 | readable by anyone else. | |
10fa86ae | 769 | .Pp |
770 | .It /etc/hosts.allow | |
771 | .It /etc/hosts.deny | |
772 | Access controls that should be enforced by tcp-wrappers are defined here. | |
773 | Further details are described in | |
774 | .Xr hosts_access 5 . | |
775 | .Pp | |
776 | .It /etc/hosts.equiv | |
e56bbe08 | 777 | This file is for host-based authentication (see |
778 | .Xr ssh 1 ) . | |
779 | It should only be writable by root. | |
10fa86ae | 780 | .Pp |
781 | .It /etc/moduli | |
782 | Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange". | |
783 | The file format is described in | |
784 | .Xr moduli 5 . | |
785 | .Pp | |
786 | .It /etc/motd | |
787 | See | |
788 | .Xr motd 5 . | |
789 | .Pp | |
790 | .It /etc/nologin | |
791 | If this file exists, | |
792 | .Nm | |
793 | refuses to let anyone except root log in. | |
794 | The contents of the file | |
795 | are displayed to anyone trying to log in, and non-root connections are | |
796 | refused. | |
797 | The file should be world-readable. | |
798 | .Pp | |
799 | .It /etc/shosts.equiv | |
e56bbe08 | 800 | This file is used in exactly the same way as |
801 | .Pa hosts.equiv , | |
802 | but allows host-based authentication without permitting login with | |
803 | rlogin/rsh. | |
10fa86ae | 804 | .Pp |
805 | .It /etc/ssh/ssh_host_key | |
806 | .It /etc/ssh/ssh_host_dsa_key | |
807 | .It /etc/ssh/ssh_host_rsa_key | |
808 | These three files contain the private parts of the host keys. | |
809 | These files should only be owned by root, readable only by root, and not | |
810 | accessible to others. | |
811 | Note that | |
812 | .Nm | |
3783659a | 813 | does not start if these files are group/world-accessible. |
10fa86ae | 814 | .Pp |
815 | .It /etc/ssh/ssh_host_key.pub | |
816 | .It /etc/ssh/ssh_host_dsa_key.pub | |
817 | .It /etc/ssh/ssh_host_rsa_key.pub | |
818 | These three files contain the public parts of the host keys. | |
819 | These files should be world-readable but writable only by | |
820 | root. | |
821 | Their contents should match the respective private parts. | |
822 | These files are not | |
823 | really used for anything; they are provided for the convenience of | |
824 | the user so their contents can be copied to known hosts files. | |
825 | These files are created using | |
826 | .Xr ssh-keygen 1 . | |
827 | .Pp | |
82029813 | 828 | .It /etc/ssh/ssh_known_hosts |
829 | Systemwide list of known host keys. | |
830 | This file should be prepared by the | |
831 | system administrator to contain the public host keys of all machines in the | |
832 | organization. | |
833 | The format of this file is described above. | |
834 | This file should be writable only by root/the owner and | |
835 | should be world-readable. | |
836 | .Pp | |
10fa86ae | 837 | .It /etc/ssh/sshd_config |
838 | Contains configuration data for | |
839 | .Nm sshd . | |
840 | The file format and configuration options are described in | |
841 | .Xr sshd_config 5 . | |
842 | .Pp | |
843 | .It /etc/ssh/sshrc | |
f3d2d92e | 844 | Similar to |
845 | .Pa ~/.ssh/rc , | |
846 | it can be used to specify | |
4fe2af09 | 847 | machine-specific login-time initializations globally. |
848 | This file should be writable only by root, and should be world-readable. | |
10fa86ae | 849 | .Pp |
850 | .It /var/empty | |
851 | .Xr chroot 2 | |
852 | directory used by | |
853 | .Nm | |
854 | during privilege separation in the pre-authentication phase. | |
855 | The directory should not contain any files and must be owned by root | |
856 | and not group or world-writable. | |
857 | .Pp | |
858 | .It /var/run/sshd.pid | |
859 | Contains the process ID of the | |
860 | .Nm | |
861 | listening for connections (if there are several daemons running | |
862 | concurrently for different ports, this contains the process ID of the one | |
863 | started last). | |
864 | The content of this file is not sensitive; it can be world-readable. | |
089fbbd2 | 865 | .El |
bf740959 | 866 | .Sh SEE ALSO |
bf740959 | 867 | .Xr scp 1 , |
61e96248 | 868 | .Xr sftp 1 , |
bf740959 | 869 | .Xr ssh 1 , |
870 | .Xr ssh-add 1 , | |
871 | .Xr ssh-agent 1 , | |
872 | .Xr ssh-keygen 1 , | |
82029813 | 873 | .Xr ssh-keyscan 1 , |
433e60ac | 874 | .Xr chroot 2 , |
875 | .Xr hosts_access 5 , | |
248bad82 | 876 | .Xr login.conf 5 , |
877 | .Xr moduli 5 , | |
588df31a | 878 | .Xr sshd_config 5 , |
433e60ac | 879 | .Xr inetd 8 , |
a5a2da3b | 880 | .Xr sftp-server 8 |
be193d89 | 881 | .Sh AUTHORS |
882 | OpenSSH is a derivative of the original and free | |
883 | ssh 1.2.12 release by Tatu Ylonen. | |
884 | Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, | |
885 | Theo de Raadt and Dug Song | |
886 | removed many bugs, re-added newer features and | |
887 | created OpenSSH. | |
888 | Markus Friedl contributed the support for SSH | |
889 | protocol versions 1.5 and 2.0. | |
890 | Niels Provos and Markus Friedl contributed support | |
891 | for privilege separation. | |
4eb67845 | 892 | .Sh CAVEATS |
893 | System security is not improved unless | |
894 | .Nm rshd , | |
895 | .Nm rlogind , | |
896 | and | |
897 | .Nm rexecd | |
898 | are disabled (thus completely disabling | |
899 | .Xr rlogin | |
900 | and | |
901 | .Xr rsh | |
902 | into the machine). |