diff options
Diffstat (limited to 'ssh.1')
-rw-r--r-- | ssh.1 | 1189 |
1 files changed, 679 insertions, 510 deletions
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 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. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: ssh.1,v 1.209 2005/07/06 09:33:05 dtucker Exp $ | 37 | .\" $OpenBSD: ssh.1,v 1.253 2006/01/30 13:37:49 jmc Exp $ |
38 | .Dd September 25, 1999 | 38 | .Dd September 25, 1999 |
39 | .Dt SSH 1 | 39 | .Dt SSH 1 |
40 | .Os | 40 | .Os |
@@ -43,21 +43,29 @@ | |||
43 | .Nd OpenSSH SSH client (remote login program) | 43 | .Nd OpenSSH SSH client (remote login program) |
44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
45 | .Nm ssh | 45 | .Nm ssh |
46 | .Bk -words | ||
47 | .Op Fl 1246AaCfgkMNnqsTtVvXxY | 46 | .Op Fl 1246AaCfgkMNnqsTtVvXxY |
48 | .Op Fl b Ar bind_address | 47 | .Op Fl b Ar bind_address |
49 | .Op Fl c Ar cipher_spec | 48 | .Op Fl c Ar cipher_spec |
50 | .Op Fl D Ar port | 49 | .Oo Fl D\ \& |
50 | .Sm off | ||
51 | .Oo Ar bind_address : Oc | ||
52 | .Ar port | ||
53 | .Sm on | ||
54 | .Oc | ||
51 | .Op Fl e Ar escape_char | 55 | .Op Fl e Ar escape_char |
52 | .Op Fl F Ar configfile | 56 | .Op Fl F Ar configfile |
57 | .Bk -words | ||
53 | .Op Fl i Ar identity_file | 58 | .Op Fl i Ar identity_file |
59 | .Ek | ||
54 | .Oo Fl L\ \& | 60 | .Oo Fl L\ \& |
55 | .Sm off | 61 | .Sm off |
56 | .Oo Ar bind_address : Oc | 62 | .Oo Ar bind_address : Oc |
57 | .Ar port : host : hostport | 63 | .Ar port : host : hostport |
58 | .Sm on | 64 | .Sm on |
59 | .Oc | 65 | .Oc |
66 | .Bk -words | ||
60 | .Op Fl l Ar login_name | 67 | .Op Fl l Ar login_name |
68 | .Ek | ||
61 | .Op Fl m Ar mac_spec | 69 | .Op Fl m Ar mac_spec |
62 | .Op Fl O Ar ctl_cmd | 70 | .Op Fl O Ar ctl_cmd |
63 | .Op Fl o Ar option | 71 | .Op Fl o Ar option |
@@ -69,6 +77,8 @@ | |||
69 | .Sm on | 77 | .Sm on |
70 | .Oc | 78 | .Oc |
71 | .Op Fl S Ar ctl_path | 79 | .Op Fl S Ar ctl_path |
80 | .Bk -words | ||
81 | .Op Fl w Ar tunnel : Ns Ar tunnel | ||
72 | .Oo Ar user Ns @ Oc Ns Ar hostname | 82 | .Oo Ar user Ns @ Oc Ns Ar hostname |
73 | .Op Ar command | 83 | .Op Ar command |
74 | .Ek | 84 | .Ek |
@@ -79,7 +89,7 @@ executing commands on a remote machine. | |||
79 | It is intended to replace rlogin and rsh, | 89 | It is intended to replace rlogin and rsh, |
80 | and provide secure encrypted communications between | 90 | and provide secure encrypted communications between |
81 | two untrusted hosts over an insecure network. | 91 | two untrusted hosts over an insecure network. |
82 | X11 connections and arbitrary TCP/IP ports | 92 | X11 connections and arbitrary TCP ports |
83 | can also be forwarded over the secure channel. | 93 | can also be forwarded over the secure channel. |
84 | .Pp | 94 | .Pp |
85 | .Nm | 95 | .Nm |
@@ -90,306 +100,12 @@ connects and logs into the specified | |||
90 | name). | 100 | name). |
91 | The user must prove | 101 | The user must prove |
92 | his/her identity to the remote machine using one of several methods | 102 | his/her identity to the remote machine using one of several methods |
93 | depending on the protocol version used. | 103 | depending on the protocol version used (see below). |
94 | .Pp | 104 | .Pp |
95 | If | 105 | If |
96 | .Ar command | 106 | .Ar command |
97 | is specified, | 107 | is specified, |
98 | .Ar command | 108 | it is executed on the remote host instead of a login shell. |
99 | is executed on the remote host instead of a login shell. | ||
100 | .Ss SSH protocol version 1 | ||
101 | The first authentication method is the | ||
102 | .Em rhosts | ||
103 | or | ||
104 | .Em hosts.equiv | ||
105 | method combined with RSA-based host authentication. | ||
106 | If the machine the user logs in from is listed in | ||
107 | .Pa /etc/hosts.equiv | ||
108 | or | ||
109 | .Pa /etc/shosts.equiv | ||
110 | on the remote machine, and the user names are | ||
111 | the same on both sides, or if the files | ||
112 | .Pa ~/.rhosts | ||
113 | or | ||
114 | .Pa ~/.shosts | ||
115 | exist in the user's home directory on the | ||
116 | remote machine and contain a line containing the name of the client | ||
117 | machine and the name of the user on that machine, the user is | ||
118 | considered for log in. | ||
119 | Additionally, if the server can verify the client's | ||
120 | host key (see | ||
121 | .Pa /etc/ssh/ssh_known_hosts | ||
122 | and | ||
123 | .Pa ~/.ssh/known_hosts | ||
124 | in the | ||
125 | .Sx FILES | ||
126 | section), only then is login permitted. | ||
127 | This authentication method closes security holes due to IP | ||
128 | spoofing, DNS spoofing and routing spoofing. | ||
129 | [Note to the administrator: | ||
130 | .Pa /etc/hosts.equiv , | ||
131 | .Pa ~/.rhosts , | ||
132 | and the rlogin/rsh protocol in general, are inherently insecure and should be | ||
133 | disabled if security is desired.] | ||
134 | .Pp | ||
135 | As a second authentication method, | ||
136 | .Nm | ||
137 | supports RSA based authentication. | ||
138 | The scheme is based on public-key cryptography: there are cryptosystems | ||
139 | where encryption and decryption are done using separate keys, and it | ||
140 | is not possible to derive the decryption key from the encryption key. | ||
141 | RSA is one such system. | ||
142 | The idea is that each user creates a public/private | ||
143 | key pair for authentication purposes. | ||
144 | The server knows the public key, and only the user knows the private key. | ||
145 | .Pp | ||
146 | The file | ||
147 | .Pa ~/.ssh/authorized_keys | ||
148 | lists the public keys that are permitted for logging in. | ||
149 | When the user logs in, the | ||
150 | .Nm | ||
151 | program tells the server which key pair it would like to use for | ||
152 | authentication. | ||
153 | The server checks if this key is permitted, and if so, | ||
154 | sends the user (actually the | ||
155 | .Nm | ||
156 | program running on behalf of the user) a challenge, a random number, | ||
157 | encrypted by the user's public key. | ||
158 | The challenge can only be decrypted using the proper private key. | ||
159 | The user's client then decrypts the challenge using the private key, | ||
160 | proving that he/she knows the private key | ||
161 | but without disclosing it to the server. | ||
162 | .Pp | ||
163 | .Nm | ||
164 | implements the RSA authentication protocol automatically. | ||
165 | The user creates his/her RSA key pair by running | ||
166 | .Xr ssh-keygen 1 . | ||
167 | This stores the private key in | ||
168 | .Pa ~/.ssh/identity | ||
169 | and stores the public key in | ||
170 | .Pa ~/.ssh/identity.pub | ||
171 | in the user's home directory. | ||
172 | The user should then copy the | ||
173 | .Pa identity.pub | ||
174 | to | ||
175 | .Pa ~/.ssh/authorized_keys | ||
176 | in his/her home directory on the remote machine (the | ||
177 | .Pa authorized_keys | ||
178 | file corresponds to the conventional | ||
179 | .Pa ~/.rhosts | ||
180 | file, and has one key | ||
181 | per line, though the lines can be very long). | ||
182 | After this, the user can log in without giving the password. | ||
183 | .Pp | ||
184 | The most convenient way to use RSA authentication may be with an | ||
185 | authentication agent. | ||
186 | See | ||
187 | .Xr ssh-agent 1 | ||
188 | for more information. | ||
189 | .Pp | ||
190 | If other authentication methods fail, | ||
191 | .Nm | ||
192 | prompts the user for a password. | ||
193 | The password is sent to the remote | ||
194 | host for checking; however, since all communications are encrypted, | ||
195 | the password cannot be seen by someone listening on the network. | ||
196 | .Ss SSH protocol version 2 | ||
197 | When a user connects using protocol version 2, | ||
198 | similar authentication methods are available. | ||
199 | Using the default values for | ||
200 | .Cm PreferredAuthentications , | ||
201 | the client will try to authenticate first using the hostbased method; | ||
202 | if this method fails, public key authentication is attempted, | ||
203 | and finally if this method fails, keyboard-interactive and | ||
204 | password authentication are tried. | ||
205 | .Pp | ||
206 | The public key method is similar to RSA authentication described | ||
207 | in the previous section and allows the RSA or DSA algorithm to be used: | ||
208 | The client uses his private key, | ||
209 | .Pa ~/.ssh/id_dsa | ||
210 | or | ||
211 | .Pa ~/.ssh/id_rsa , | ||
212 | to sign the session identifier and sends the result to the server. | ||
213 | The server checks whether the matching public key is listed in | ||
214 | .Pa ~/.ssh/authorized_keys | ||
215 | and grants access if both the key is found and the signature is correct. | ||
216 | The session identifier is derived from a shared Diffie-Hellman value | ||
217 | and is only known to the client and the server. | ||
218 | .Pp | ||
219 | If public key authentication fails or is not available, a password | ||
220 | can be sent encrypted to the remote host to prove the user's identity. | ||
221 | .Pp | ||
222 | Additionally, | ||
223 | .Nm | ||
224 | supports hostbased or challenge response authentication. | ||
225 | .Pp | ||
226 | Protocol 2 provides additional mechanisms for confidentiality | ||
227 | (the traffic is encrypted using AES, 3DES, Blowfish, CAST128 or Arcfour) | ||
228 | and integrity (hmac-md5, hmac-sha1, hmac-ripemd160). | ||
229 | Note that protocol 1 lacks a strong mechanism for ensuring the | ||
230 | integrity of the connection. | ||
231 | .Ss Login session and remote execution | ||
232 | When the user's identity has been accepted by the server, the server | ||
233 | either executes the given command, or logs into the machine and gives | ||
234 | the user a normal shell on the remote machine. | ||
235 | All communication with | ||
236 | the remote command or shell will be automatically encrypted. | ||
237 | .Pp | ||
238 | If a pseudo-terminal has been allocated (normal login session), the | ||
239 | user may use the escape characters noted below. | ||
240 | .Pp | ||
241 | If no pseudo-tty has been allocated, | ||
242 | the session is transparent and can be used to reliably transfer binary data. | ||
243 | On most systems, setting the escape character to | ||
244 | .Dq none | ||
245 | will also make the session transparent even if a tty is used. | ||
246 | .Pp | ||
247 | The session terminates when the command or shell on the remote | ||
248 | machine exits and all X11 and TCP/IP connections have been closed. | ||
249 | The exit status of the remote program is returned as the exit status of | ||
250 | .Nm ssh . | ||
251 | .Ss Escape Characters | ||
252 | When a pseudo-terminal has been requested, | ||
253 | .Nm | ||
254 | supports a number of functions through the use of an escape character. | ||
255 | .Pp | ||
256 | A single tilde character can be sent as | ||
257 | .Ic ~~ | ||
258 | or by following the tilde by a character other than those described below. | ||
259 | The escape character must always follow a newline to be interpreted as | ||
260 | special. | ||
261 | The escape character can be changed in configuration files using the | ||
262 | .Cm EscapeChar | ||
263 | configuration directive or on the command line by the | ||
264 | .Fl e | ||
265 | option. | ||
266 | .Pp | ||
267 | The supported escapes (assuming the default | ||
268 | .Ql ~ ) | ||
269 | are: | ||
270 | .Bl -tag -width Ds | ||
271 | .It Cm ~. | ||
272 | Disconnect. | ||
273 | .It Cm ~^Z | ||
274 | Background | ||
275 | .Nm ssh . | ||
276 | .It Cm ~# | ||
277 | List forwarded connections. | ||
278 | .It Cm ~& | ||
279 | Background | ||
280 | .Nm | ||
281 | at logout when waiting for forwarded connection / X11 sessions to terminate. | ||
282 | .It Cm ~? | ||
283 | Display a list of escape characters. | ||
284 | .It Cm ~B | ||
285 | Send a BREAK to the remote system | ||
286 | (only useful for SSH protocol version 2 and if the peer supports it). | ||
287 | .It Cm ~C | ||
288 | Open command line. | ||
289 | Currently this allows the addition of port forwardings using the | ||
290 | .Fl L | ||
291 | and | ||
292 | .Fl R | ||
293 | options (see below). | ||
294 | It also allows the cancellation of existing remote port-forwardings | ||
295 | using | ||
296 | .Fl KR Ar hostport . | ||
297 | Basic help is available, using the | ||
298 | .Fl h | ||
299 | option. | ||
300 | .It Cm ~R | ||
301 | Request rekeying of the connection | ||
302 | (only useful for SSH protocol version 2 and if the peer supports it). | ||
303 | .El | ||
304 | .Ss X11 and TCP forwarding | ||
305 | If the | ||
306 | .Cm ForwardX11 | ||
307 | variable is set to | ||
308 | .Dq yes | ||
309 | (or see the description of the | ||
310 | .Fl X | ||
311 | and | ||
312 | .Fl x | ||
313 | options described later) | ||
314 | and the user is using X11 (the | ||
315 | .Ev DISPLAY | ||
316 | environment variable is set), the connection to the X11 display is | ||
317 | automatically forwarded to the remote side in such a way that any X11 | ||
318 | programs started from the shell (or command) will go through the | ||
319 | encrypted channel, and the connection to the real X server will be made | ||
320 | from the local machine. | ||
321 | The user should not manually set | ||
322 | .Ev DISPLAY . | ||
323 | Forwarding of X11 connections can be | ||
324 | configured on the command line or in configuration files. | ||
325 | .Pp | ||
326 | The | ||
327 | .Ev DISPLAY | ||
328 | value set by | ||
329 | .Nm | ||
330 | will point to the server machine, but with a display number greater than zero. | ||
331 | This is normal, and happens because | ||
332 | .Nm | ||
333 | creates a | ||
334 | .Dq proxy | ||
335 | X server on the server machine for forwarding the | ||
336 | connections over the encrypted channel. | ||
337 | .Pp | ||
338 | .Nm | ||
339 | will also automatically set up Xauthority data on the server machine. | ||
340 | For this purpose, it will generate a random authorization cookie, | ||
341 | store it in Xauthority on the server, and verify that any forwarded | ||
342 | connections carry this cookie and replace it by the real cookie when | ||
343 | the connection is opened. | ||
344 | The real authentication cookie is never | ||
345 | sent to the server machine (and no cookies are sent in the plain). | ||
346 | .Pp | ||
347 | If the | ||
348 | .Cm ForwardAgent | ||
349 | variable is set to | ||
350 | .Dq yes | ||
351 | (or see the description of the | ||
352 | .Fl A | ||
353 | and | ||
354 | .Fl a | ||
355 | options described later) and | ||
356 | the user is using an authentication agent, the connection to the agent | ||
357 | is automatically forwarded to the remote side. | ||
358 | .Pp | ||
359 | Forwarding of arbitrary TCP/IP connections over the secure channel can | ||
360 | be specified either on the command line or in a configuration file. | ||
361 | One possible application of TCP/IP forwarding is a secure connection to an | ||
362 | electronic purse; another is going through firewalls. | ||
363 | .Ss Server authentication | ||
364 | .Nm | ||
365 | automatically maintains and checks a database containing | ||
366 | identifications for all hosts it has ever been used with. | ||
367 | Host keys are stored in | ||
368 | .Pa ~/.ssh/known_hosts | ||
369 | in the user's home directory. | ||
370 | Additionally, the file | ||
371 | .Pa /etc/ssh/ssh_known_hosts | ||
372 | is automatically checked for known hosts. | ||
373 | Any new hosts are automatically added to the user's file. | ||
374 | If a host's identification ever changes, | ||
375 | .Nm | ||
376 | warns about this and disables password authentication to prevent a | ||
377 | trojan horse from getting the user's password. | ||
378 | Another purpose of this mechanism is to prevent man-in-the-middle attacks | ||
379 | which could otherwise be used to circumvent the encryption. | ||
380 | The | ||
381 | .Cm StrictHostKeyChecking | ||
382 | option can be used to prevent logins to machines whose | ||
383 | host key is not known or has changed. | ||
384 | .Pp | ||
385 | .Nm | ||
386 | can be configured to verify host identification using fingerprint resource | ||
387 | records (SSHFP) published in DNS. | ||
388 | The | ||
389 | .Cm VerifyHostKeyDNS | ||
390 | option can be used to control how DNS lookups are performed. | ||
391 | SSHFP resource records can be generated using | ||
392 | .Xr ssh-keygen 1 . | ||
393 | .Pp | 109 | .Pp |
394 | The options are as follows: | 110 | The options are as follows: |
395 | .Bl -tag -width Ds | 111 | .Bl -tag -width Ds |
@@ -430,7 +146,7 @@ of the connection. | |||
430 | Only useful on systems with more than one address. | 146 | Only useful on systems with more than one address. |
431 | .It Fl C | 147 | .It Fl C |
432 | Requests compression of all data (including stdin, stdout, stderr, and | 148 | Requests compression of all data (including stdin, stdout, stderr, and |
433 | data for forwarded X11 and TCP/IP connections). | 149 | data for forwarded X11 and TCP connections). |
434 | The compression algorithm is the same used by | 150 | The compression algorithm is the same used by |
435 | .Xr gzip 1 , | 151 | .Xr gzip 1 , |
436 | and the | 152 | and the |
@@ -448,9 +164,9 @@ option. | |||
448 | Selects the cipher specification for encrypting the session. | 164 | Selects the cipher specification for encrypting the session. |
449 | .Pp | 165 | .Pp |
450 | Protocol version 1 allows specification of a single cipher. | 166 | Protocol version 1 allows specification of a single cipher. |
451 | The suported values are | 167 | The supported values are |
452 | .Dq 3des , | 168 | .Dq 3des , |
453 | .Dq blowfish | 169 | .Dq blowfish , |
454 | and | 170 | and |
455 | .Dq des . | 171 | .Dq des . |
456 | .Ar 3des | 172 | .Ar 3des |
@@ -470,37 +186,44 @@ Its use is strongly discouraged due to cryptographic weaknesses. | |||
470 | The default is | 186 | The default is |
471 | .Dq 3des . | 187 | .Dq 3des . |
472 | .Pp | 188 | .Pp |
473 | For protocol version 2 | 189 | For protocol version 2, |
474 | .Ar cipher_spec | 190 | .Ar cipher_spec |
475 | is a comma-separated list of ciphers | 191 | is a comma-separated list of ciphers |
476 | listed in order of preference. | 192 | listed in order of preference. |
477 | The supported ciphers are | 193 | The supported ciphers are: |
478 | .Dq 3des-cbc , | 194 | 3des-cbc, |
479 | .Dq aes128-cbc , | 195 | aes128-cbc, |
480 | .Dq aes192-cbc , | 196 | aes192-cbc, |
481 | .Dq aes256-cbc , | 197 | aes256-cbc, |
482 | .Dq aes128-ctr , | 198 | aes128-ctr, |
483 | .Dq aes192-ctr , | 199 | aes192-ctr, |
484 | .Dq aes256-ctr , | 200 | aes256-ctr, |
485 | .Dq arcfour128 , | 201 | arcfour128, |
486 | .Dq arcfour256 , | 202 | arcfour256, |
487 | .Dq arcfour , | 203 | arcfour, |
488 | .Dq blowfish-cbc , | 204 | blowfish-cbc, |
489 | and | 205 | and |
490 | .Dq cast128-cbc . | 206 | cast128-cbc. |
491 | The default is | 207 | The default is: |
492 | .Bd -literal | 208 | .Bd -literal -offset indent |
493 | ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, | 209 | aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128, |
494 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, | 210 | arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr, |
495 | aes192-ctr,aes256-ctr'' | 211 | aes192-ctr,aes256-ctr |
496 | .Ed | 212 | .Ed |
497 | .It Fl D Ar port | 213 | .It Fl D Xo |
214 | .Sm off | ||
215 | .Oo Ar bind_address : Oc | ||
216 | .Ar port | ||
217 | .Sm on | ||
218 | .Xc | ||
498 | Specifies a local | 219 | Specifies a local |
499 | .Dq dynamic | 220 | .Dq dynamic |
500 | application-level port forwarding. | 221 | application-level port forwarding. |
501 | This works by allocating a socket to listen to | 222 | This works by allocating a socket to listen to |
502 | .Ar port | 223 | .Ar port |
503 | on the local side, and whenever a connection is made to this port, the | 224 | on the local side, optionally bound to the specified |
225 | .Ar bind_address . | ||
226 | Whenever a connection is made to this port, the | ||
504 | connection is forwarded over the secure channel, and the application | 227 | connection is forwarded over the secure channel, and the application |
505 | protocol is then used to determine where to connect to from the | 228 | protocol is then used to determine where to connect to from the |
506 | remote machine. | 229 | remote machine. |
@@ -509,7 +232,31 @@ Currently the SOCKS4 and SOCKS5 protocols are supported, and | |||
509 | will act as a SOCKS server. | 232 | will act as a SOCKS server. |
510 | Only root can forward privileged ports. | 233 | Only root can forward privileged ports. |
511 | Dynamic port forwardings can also be specified in the configuration file. | 234 | Dynamic port forwardings can also be specified in the configuration file. |
512 | .It Fl e Ar ch | ^ch | none | 235 | .Pp |
236 | IPv6 addresses can be specified with an alternative syntax: | ||
237 | .Sm off | ||
238 | .Xo | ||
239 | .Op Ar bind_address No / | ||
240 | .Ar port | ||
241 | .Xc | ||
242 | .Sm on | ||
243 | or by enclosing the address in square brackets. | ||
244 | Only the superuser can forward privileged ports. | ||
245 | By default, the local port is bound in accordance with the | ||
246 | .Cm GatewayPorts | ||
247 | setting. | ||
248 | However, an explicit | ||
249 | .Ar bind_address | ||
250 | may be used to bind the connection to a specific address. | ||
251 | The | ||
252 | .Ar bind_address | ||
253 | of | ||
254 | .Dq localhost | ||
255 | indicates that the listening port be bound for local use only, while an | ||
256 | empty address or | ||
257 | .Sq * | ||
258 | indicates that the port should be available from all interfaces. | ||
259 | .It Fl e Ar escape_char | ||
513 | Sets the escape character for sessions with a pty (default: | 260 | Sets the escape character for sessions with a pty (default: |
514 | .Ql ~ ) . | 261 | .Ql ~ ) . |
515 | The escape character is only recognized at the beginning of a line. | 262 | The escape character is only recognized at the beginning of a line. |
@@ -545,11 +292,12 @@ something like | |||
545 | .It Fl g | 292 | .It Fl g |
546 | Allows remote hosts to connect to local forwarded ports. | 293 | Allows remote hosts to connect to local forwarded ports. |
547 | .It Fl I Ar smartcard_device | 294 | .It Fl I Ar smartcard_device |
548 | Specifies which smartcard device to use. | 295 | Specify the device |
549 | The argument is the device | ||
550 | .Nm | 296 | .Nm |
551 | should use to communicate with a smartcard used for storing the user's | 297 | should use to communicate with a smartcard used for storing the user's |
552 | private RSA key. | 298 | private RSA key. |
299 | This option is only available if support for smartcard devices | ||
300 | is compiled in (default is no support). | ||
553 | .It Fl i Ar identity_file | 301 | .It Fl i Ar identity_file |
554 | Selects a file from which the identity (private key) for | 302 | Selects a file from which the identity (private key) for |
555 | RSA or DSA authentication is read. | 303 | RSA or DSA authentication is read. |
@@ -621,6 +369,13 @@ Places the | |||
621 | client into | 369 | client into |
622 | .Dq master | 370 | .Dq master |
623 | mode for connection sharing. | 371 | mode for connection sharing. |
372 | Multiple | ||
373 | .Fl M | ||
374 | options places | ||
375 | .Nm | ||
376 | into | ||
377 | .Dq master | ||
378 | mode with confirmation required before slave connections are accepted. | ||
624 | Refer to the description of | 379 | Refer to the description of |
625 | .Cm ControlMaster | 380 | .Cm ControlMaster |
626 | in | 381 | in |
@@ -709,17 +464,20 @@ For full details of the options listed below, and their possible values, see | |||
709 | .It IdentityFile | 464 | .It IdentityFile |
710 | .It IdentitiesOnly | 465 | .It IdentitiesOnly |
711 | .It KbdInteractiveDevices | 466 | .It KbdInteractiveDevices |
467 | .It LocalCommand | ||
712 | .It LocalForward | 468 | .It LocalForward |
713 | .It LogLevel | 469 | .It LogLevel |
714 | .It MACs | 470 | .It MACs |
715 | .It NoHostAuthenticationForLocalhost | 471 | .It NoHostAuthenticationForLocalhost |
716 | .It NumberOfPasswordPrompts | 472 | .It NumberOfPasswordPrompts |
717 | .It PasswordAuthentication | 473 | .It PasswordAuthentication |
474 | .It PermitLocalCommand | ||
718 | .It Port | 475 | .It Port |
719 | .It PreferredAuthentications | 476 | .It PreferredAuthentications |
720 | .It Protocol | 477 | .It Protocol |
721 | .It ProxyCommand | 478 | .It ProxyCommand |
722 | .It PubkeyAuthentication | 479 | .It PubkeyAuthentication |
480 | .It RekeyLimit | ||
723 | .It RemoteForward | 481 | .It RemoteForward |
724 | .It RhostsRSAAuthentication | 482 | .It RhostsRSAAuthentication |
725 | .It RSAAuthentication | 483 | .It RSAAuthentication |
@@ -729,6 +487,8 @@ For full details of the options listed below, and their possible values, see | |||
729 | .It SmartcardDevice | 487 | .It SmartcardDevice |
730 | .It StrictHostKeyChecking | 488 | .It StrictHostKeyChecking |
731 | .It TCPKeepAlive | 489 | .It TCPKeepAlive |
490 | .It Tunnel | ||
491 | .It TunnelDevice | ||
732 | .It UsePrivilegedPort | 492 | .It UsePrivilegedPort |
733 | .It User | 493 | .It User |
734 | .It UserKnownHostsFile | 494 | .It UserKnownHostsFile |
@@ -832,6 +592,24 @@ Multiple | |||
832 | .Fl v | 592 | .Fl v |
833 | options increase the verbosity. | 593 | options increase the verbosity. |
834 | The maximum is 3. | 594 | The maximum is 3. |
595 | .It Fl w Ar tunnel : Ns Ar tunnel | ||
596 | Requests a | ||
597 | .Xr tun 4 | ||
598 | device on the client | ||
599 | (first | ||
600 | .Ar tunnel | ||
601 | arg) | ||
602 | and server | ||
603 | (second | ||
604 | .Ar tunnel | ||
605 | arg). | ||
606 | The devices may be specified by numerical ID or the keyword | ||
607 | .Dq any , | ||
608 | which uses the next available tunnel device. | ||
609 | See also the | ||
610 | .Cm Tunnel | ||
611 | directive in | ||
612 | .Xr ssh_config 5 . | ||
835 | .It Fl X | 613 | .It Fl X |
836 | Enables X11 forwarding. | 614 | Enables X11 forwarding. |
837 | This can also be specified on a per-host basis in a configuration file. | 615 | This can also be specified on a per-host basis in a configuration file. |
@@ -859,16 +637,474 @@ Enables trusted X11 forwarding. | |||
859 | Trusted X11 forwardings are not subjected to the X11 SECURITY extension | 637 | Trusted X11 forwardings are not subjected to the X11 SECURITY extension |
860 | controls. | 638 | controls. |
861 | .El | 639 | .El |
862 | .Sh CONFIGURATION FILES | 640 | .Pp |
863 | .Nm | 641 | .Nm |
864 | may additionally obtain configuration data from | 642 | may additionally obtain configuration data from |
865 | a per-user configuration file and a system-wide configuration file. | 643 | a per-user configuration file and a system-wide configuration file. |
866 | The file format and configuration options are described in | 644 | The file format and configuration options are described in |
867 | .Xr ssh_config 5 . | 645 | .Xr ssh_config 5 . |
646 | .Pp | ||
647 | .Nm | ||
648 | exits with the exit status of the remote command or with 255 | ||
649 | if an error occurred. | ||
650 | .Sh AUTHENTICATION | ||
651 | The OpenSSH SSH client supports SSH protocols 1 and 2. | ||
652 | Protocol 2 is the default, with | ||
653 | .Nm | ||
654 | falling back to protocol 1 if it detects protocol 2 is unsupported. | ||
655 | These settings may be altered using the | ||
656 | .Cm Protocol | ||
657 | option in | ||
658 | .Xr ssh_config 5 , | ||
659 | or enforced using the | ||
660 | .Fl 1 | ||
661 | and | ||
662 | .Fl 2 | ||
663 | options (see above). | ||
664 | Both protocols support similar authentication methods, | ||
665 | but protocol 2 is preferred since | ||
666 | it provides additional mechanisms for confidentiality | ||
667 | (the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour) | ||
668 | and integrity (hmac-md5, hmac-sha1, hmac-ripemd160). | ||
669 | Protocol 1 lacks a strong mechanism for ensuring the | ||
670 | integrity of the connection. | ||
671 | .Pp | ||
672 | The methods available for authentication are: | ||
673 | host-based authentication, | ||
674 | public key authentication, | ||
675 | challenge-response authentication, | ||
676 | and password authentication. | ||
677 | Authentication methods are tried in the order specified above, | ||
678 | though protocol 2 has a configuration option to change the default order: | ||
679 | .Cm PreferredAuthentications . | ||
680 | .Pp | ||
681 | Host-based authentication works as follows: | ||
682 | If the machine the user logs in from is listed in | ||
683 | .Pa /etc/hosts.equiv | ||
684 | or | ||
685 | .Pa /etc/shosts.equiv | ||
686 | on the remote machine, and the user names are | ||
687 | the same on both sides, or if the files | ||
688 | .Pa ~/.rhosts | ||
689 | or | ||
690 | .Pa ~/.shosts | ||
691 | exist in the user's home directory on the | ||
692 | remote machine and contain a line containing the name of the client | ||
693 | machine and the name of the user on that machine, the user is | ||
694 | considered for login. | ||
695 | Additionally, the server | ||
696 | .Em must | ||
697 | be able to verify the client's | ||
698 | host key (see the description of | ||
699 | .Pa /etc/ssh/ssh_known_hosts | ||
700 | and | ||
701 | .Pa ~/.ssh/known_hosts , | ||
702 | below) | ||
703 | for login to be permitted. | ||
704 | This authentication method closes security holes due to IP | ||
705 | spoofing, DNS spoofing, and routing spoofing. | ||
706 | [Note to the administrator: | ||
707 | .Pa /etc/hosts.equiv , | ||
708 | .Pa ~/.rhosts , | ||
709 | and the rlogin/rsh protocol in general, are inherently insecure and should be | ||
710 | disabled if security is desired.] | ||
711 | .Pp | ||
712 | Public key authentication works as follows: | ||
713 | The scheme is based on public-key cryptography, | ||
714 | using cryptosystems | ||
715 | where encryption and decryption are done using separate keys, | ||
716 | and it is unfeasible to derive the decryption key from the encryption key. | ||
717 | The idea is that each user creates a public/private | ||
718 | key pair for authentication purposes. | ||
719 | The server knows the public key, and only the user knows the private key. | ||
720 | .Nm | ||
721 | implements public key authentication protocol automatically, | ||
722 | using either the RSA or DSA algorithms. | ||
723 | Protocol 1 is restricted to using only RSA keys, | ||
724 | but protocol 2 may use either. | ||
725 | The | ||
726 | .Sx HISTORY | ||
727 | section of | ||
728 | .Xr ssl 8 | ||
729 | contains a brief discussion of the two algorithms. | ||
730 | .Pp | ||
731 | The file | ||
732 | .Pa ~/.ssh/authorized_keys | ||
733 | lists the public keys that are permitted for logging in. | ||
734 | When the user logs in, the | ||
735 | .Nm | ||
736 | program tells the server which key pair it would like to use for | ||
737 | authentication. | ||
738 | The client proves that it has access to the private key | ||
739 | and the server checks that the corresponding public key | ||
740 | is authorized to accept the account. | ||
741 | .Pp | ||
742 | The user creates his/her key pair by running | ||
743 | .Xr ssh-keygen 1 . | ||
744 | This stores the private key in | ||
745 | .Pa ~/.ssh/identity | ||
746 | (protocol 1), | ||
747 | .Pa ~/.ssh/id_dsa | ||
748 | (protocol 2 DSA), | ||
749 | or | ||
750 | .Pa ~/.ssh/id_rsa | ||
751 | (protocol 2 RSA) | ||
752 | and stores the public key in | ||
753 | .Pa ~/.ssh/identity.pub | ||
754 | (protocol 1), | ||
755 | .Pa ~/.ssh/id_dsa.pub | ||
756 | (protocol 2 DSA), | ||
757 | or | ||
758 | .Pa ~/.ssh/id_rsa.pub | ||
759 | (protocol 2 RSA) | ||
760 | in the user's home directory. | ||
761 | The user should then copy the public key | ||
762 | to | ||
763 | .Pa ~/.ssh/authorized_keys | ||
764 | in his/her home directory on the remote machine. | ||
765 | The | ||
766 | .Pa authorized_keys | ||
767 | file corresponds to the conventional | ||
768 | .Pa ~/.rhosts | ||
769 | file, and has one key | ||
770 | per line, though the lines can be very long. | ||
771 | After this, the user can log in without giving the password. | ||
772 | .Pp | ||
773 | The most convenient way to use public key authentication may be with an | ||
774 | authentication agent. | ||
775 | See | ||
776 | .Xr ssh-agent 1 | ||
777 | for more information. | ||
778 | .Pp | ||
779 | Challenge-response authentication works as follows: | ||
780 | The server sends an arbitrary | ||
781 | .Qq challenge | ||
782 | text, and prompts for a response. | ||
783 | Protocol 2 allows multiple challenges and responses; | ||
784 | protocol 1 is restricted to just one challenge/response. | ||
785 | Examples of challenge-response authentication include | ||
786 | BSD Authentication (see | ||
787 | .Xr login.conf 5 ) | ||
788 | and PAM (some non-OpenBSD systems). | ||
789 | .Pp | ||
790 | Finally, if other authentication methods fail, | ||
791 | .Nm | ||
792 | prompts the user for a password. | ||
793 | The password is sent to the remote | ||
794 | host for checking; however, since all communications are encrypted, | ||
795 | the password cannot be seen by someone listening on the network. | ||
796 | .Pp | ||
797 | .Nm | ||
798 | automatically maintains and checks a database containing | ||
799 | identification for all hosts it has ever been used with. | ||
800 | Host keys are stored in | ||
801 | .Pa ~/.ssh/known_hosts | ||
802 | in the user's home directory. | ||
803 | Additionally, the file | ||
804 | .Pa /etc/ssh/ssh_known_hosts | ||
805 | is automatically checked for known hosts. | ||
806 | Any new hosts are automatically added to the user's file. | ||
807 | If a host's identification ever changes, | ||
808 | .Nm | ||
809 | warns about this and disables password authentication to prevent | ||
810 | server spoofing or man-in-the-middle attacks, | ||
811 | which could otherwise be used to circumvent the encryption. | ||
812 | The | ||
813 | .Cm StrictHostKeyChecking | ||
814 | option can be used to control logins to machines whose | ||
815 | host key is not known or has changed. | ||
816 | .Pp | ||
817 | When the user's identity has been accepted by the server, the server | ||
818 | either executes the given command, or logs into the machine and gives | ||
819 | the user a normal shell on the remote machine. | ||
820 | All communication with | ||
821 | the remote command or shell will be automatically encrypted. | ||
822 | .Pp | ||
823 | If a pseudo-terminal has been allocated (normal login session), the | ||
824 | user may use the escape characters noted below. | ||
825 | .Pp | ||
826 | If no pseudo-tty has been allocated, | ||
827 | the session is transparent and can be used to reliably transfer binary data. | ||
828 | On most systems, setting the escape character to | ||
829 | .Dq none | ||
830 | will also make the session transparent even if a tty is used. | ||
831 | .Pp | ||
832 | The session terminates when the command or shell on the remote | ||
833 | machine exits and all X11 and TCP connections have been closed. | ||
834 | .Sh ESCAPE CHARACTERS | ||
835 | When a pseudo-terminal has been requested, | ||
836 | .Nm | ||
837 | supports a number of functions through the use of an escape character. | ||
838 | .Pp | ||
839 | A single tilde character can be sent as | ||
840 | .Ic ~~ | ||
841 | or by following the tilde by a character other than those described below. | ||
842 | The escape character must always follow a newline to be interpreted as | ||
843 | special. | ||
844 | The escape character can be changed in configuration files using the | ||
845 | .Cm EscapeChar | ||
846 | configuration directive or on the command line by the | ||
847 | .Fl e | ||
848 | option. | ||
849 | .Pp | ||
850 | The supported escapes (assuming the default | ||
851 | .Ql ~ ) | ||
852 | are: | ||
853 | .Bl -tag -width Ds | ||
854 | .It Cm ~. | ||
855 | Disconnect. | ||
856 | .It Cm ~^Z | ||
857 | Background | ||
858 | .Nm . | ||
859 | .It Cm ~# | ||
860 | List forwarded connections. | ||
861 | .It Cm ~& | ||
862 | Background | ||
863 | .Nm | ||
864 | at logout when waiting for forwarded connection / X11 sessions to terminate. | ||
865 | .It Cm ~? | ||
866 | Display a list of escape characters. | ||
867 | .It Cm ~B | ||
868 | Send a BREAK to the remote system | ||
869 | (only useful for SSH protocol version 2 and if the peer supports it). | ||
870 | .It Cm ~C | ||
871 | Open command line. | ||
872 | Currently this allows the addition of port forwardings using the | ||
873 | .Fl L | ||
874 | and | ||
875 | .Fl R | ||
876 | options (see above). | ||
877 | It also allows the cancellation of existing remote port-forwardings | ||
878 | using | ||
879 | .Fl KR Ar hostport . | ||
880 | .Ic !\& Ns Ar command | ||
881 | allows the user to execute a local command if the | ||
882 | .Ic PermitLocalCommand | ||
883 | option is enabled in | ||
884 | .Xr ssh_config 5 . | ||
885 | Basic help is available, using the | ||
886 | .Fl h | ||
887 | option. | ||
888 | .It Cm ~R | ||
889 | Request rekeying of the connection | ||
890 | (only useful for SSH protocol version 2 and if the peer supports it). | ||
891 | .El | ||
892 | .Sh TCP FORWARDING | ||
893 | Forwarding of arbitrary TCP connections over the secure channel can | ||
894 | be specified either on the command line or in a configuration file. | ||
895 | One possible application of TCP forwarding is a secure connection to a | ||
896 | mail server; another is going through firewalls. | ||
897 | .Pp | ||
898 | In the example below, we look at encrypting communication between | ||
899 | an IRC client and server, even though the IRC server does not directly | ||
900 | support encrypted communications. | ||
901 | This works as follows: | ||
902 | the user connects to the remote host using | ||
903 | .Nm , | ||
904 | specifying a port to be used to forward connections | ||
905 | to the remote server. | ||
906 | After that it is possible to start the service which is to be encrypted | ||
907 | on the client machine, | ||
908 | connecting to the same local port, | ||
909 | and | ||
910 | .Nm | ||
911 | will encrypt and forward the connection. | ||
912 | .Pp | ||
913 | The following example tunnels an IRC session from client machine | ||
914 | .Dq 127.0.0.1 | ||
915 | (localhost) | ||
916 | to remote server | ||
917 | .Dq server.example.com : | ||
918 | .Bd -literal -offset 4n | ||
919 | $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10 | ||
920 | $ irc -c '#users' -p 1234 pinky 127.0.0.1 | ||
921 | .Ed | ||
922 | .Pp | ||
923 | This tunnels a connection to IRC server | ||
924 | .Dq server.example.com , | ||
925 | joining channel | ||
926 | .Dq #users , | ||
927 | nickname | ||
928 | .Dq pinky , | ||
929 | using port 1234. | ||
930 | It doesn't matter which port is used, | ||
931 | as long as it's greater than 1023 | ||
932 | (remember, only root can open sockets on privileged ports) | ||
933 | and doesn't conflict with any ports already in use. | ||
934 | The connection is forwarded to port 6667 on the remote server, | ||
935 | since that's the standard port for IRC services. | ||
936 | .Pp | ||
937 | The | ||
938 | .Fl f | ||
939 | option backgrounds | ||
940 | .Nm | ||
941 | and the remote command | ||
942 | .Dq sleep 10 | ||
943 | is specified to allow an amount of time | ||
944 | (10 seconds, in the example) | ||
945 | to start the service which is to be tunnelled. | ||
946 | If no connections are made within the time specified, | ||
947 | .Nm | ||
948 | will exit. | ||
949 | .Sh X11 FORWARDING | ||
950 | If the | ||
951 | .Cm ForwardX11 | ||
952 | variable is set to | ||
953 | .Dq yes | ||
954 | (or see the description of the | ||
955 | .Fl X , | ||
956 | .Fl x , | ||
957 | and | ||
958 | .Fl Y | ||
959 | options above) | ||
960 | and the user is using X11 (the | ||
961 | .Ev DISPLAY | ||
962 | environment variable is set), the connection to the X11 display is | ||
963 | automatically forwarded to the remote side in such a way that any X11 | ||
964 | programs started from the shell (or command) will go through the | ||
965 | encrypted channel, and the connection to the real X server will be made | ||
966 | from the local machine. | ||
967 | The user should not manually set | ||
968 | .Ev DISPLAY . | ||
969 | Forwarding of X11 connections can be | ||
970 | configured on the command line or in configuration files. | ||
971 | .Pp | ||
972 | The | ||
973 | .Ev DISPLAY | ||
974 | value set by | ||
975 | .Nm | ||
976 | will point to the server machine, but with a display number greater than zero. | ||
977 | This is normal, and happens because | ||
978 | .Nm | ||
979 | creates a | ||
980 | .Dq proxy | ||
981 | X server on the server machine for forwarding the | ||
982 | connections over the encrypted channel. | ||
983 | .Pp | ||
984 | .Nm | ||
985 | will also automatically set up Xauthority data on the server machine. | ||
986 | For this purpose, it will generate a random authorization cookie, | ||
987 | store it in Xauthority on the server, and verify that any forwarded | ||
988 | connections carry this cookie and replace it by the real cookie when | ||
989 | the connection is opened. | ||
990 | The real authentication cookie is never | ||
991 | sent to the server machine (and no cookies are sent in the plain). | ||
992 | .Pp | ||
993 | If the | ||
994 | .Cm ForwardAgent | ||
995 | variable is set to | ||
996 | .Dq yes | ||
997 | (or see the description of the | ||
998 | .Fl A | ||
999 | and | ||
1000 | .Fl a | ||
1001 | options above) and | ||
1002 | the user is using an authentication agent, the connection to the agent | ||
1003 | is automatically forwarded to the remote side. | ||
1004 | .Sh VERIFYING HOST KEYS | ||
1005 | When connecting to a server for the first time, | ||
1006 | a fingerprint of the server's public key is presented to the user | ||
1007 | (unless the option | ||
1008 | .Cm StrictHostKeyChecking | ||
1009 | has been disabled). | ||
1010 | Fingerprints can be determined using | ||
1011 | .Xr ssh-keygen 1 : | ||
1012 | .Pp | ||
1013 | .Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key | ||
1014 | .Pp | ||
1015 | If the fingerprint is already known, | ||
1016 | it can be matched and verified, | ||
1017 | and the key can be accepted. | ||
1018 | If the fingerprint is unknown, | ||
1019 | an alternative method of verification is available: | ||
1020 | SSH fingerprints verified by DNS. | ||
1021 | An additional resource record (RR), | ||
1022 | SSHFP, | ||
1023 | is added to a zonefile | ||
1024 | and the connecting client is able to match the fingerprint | ||
1025 | with that of the key presented. | ||
1026 | .Pp | ||
1027 | In this example, we are connecting a client to a server, | ||
1028 | .Dq host.example.com . | ||
1029 | The SSHFP resource records should first be added to the zonefile for | ||
1030 | host.example.com: | ||
1031 | .Bd -literal -offset indent | ||
1032 | $ ssh-keygen -f /etc/ssh/ssh_host_rsa_key.pub -r host.example.com. | ||
1033 | $ ssh-keygen -f /etc/ssh/ssh_host_dsa_key.pub -r host.example.com. | ||
1034 | .Ed | ||
1035 | .Pp | ||
1036 | The output lines will have to be added to the zonefile. | ||
1037 | To check that the zone is answering fingerprint queries: | ||
1038 | .Pp | ||
1039 | .Dl $ dig -t SSHFP host.example.com | ||
1040 | .Pp | ||
1041 | Finally the client connects: | ||
1042 | .Bd -literal -offset indent | ||
1043 | $ ssh -o "VerifyHostKeyDNS ask" host.example.com | ||
1044 | [...] | ||
1045 | Matching host key fingerprint found in DNS. | ||
1046 | Are you sure you want to continue connecting (yes/no)? | ||
1047 | .Ed | ||
1048 | .Pp | ||
1049 | See the | ||
1050 | .Cm VerifyHostKeyDNS | ||
1051 | option in | ||
1052 | .Xr ssh_config 5 | ||
1053 | for more information. | ||
1054 | .Sh SSH-BASED VIRTUAL PRIVATE NETWORKS | ||
1055 | .Nm | ||
1056 | contains support for Virtual Private Network (VPN) tunnelling | ||
1057 | using the | ||
1058 | .Xr tun 4 | ||
1059 | network pseudo-device, | ||
1060 | allowing two networks to be joined securely. | ||
1061 | The | ||
1062 | .Xr sshd_config 5 | ||
1063 | configuration option | ||
1064 | .Cm PermitTunnel | ||
1065 | controls whether the server supports this, | ||
1066 | and at what level (layer 2 or 3 traffic). | ||
1067 | .Pp | ||
1068 | The following example would connect client network 10.0.50.0/24 | ||
1069 | with remote network 10.0.99.0/24, provided that the SSH server | ||
1070 | running on the gateway to the remote network, | ||
1071 | at 192.168.1.15, allows it: | ||
1072 | .Bd -literal -offset indent | ||
1073 | # ssh -f -w 0:1 192.168.1.15 true | ||
1074 | # ifconfig tun0 10.0.50.1 10.0.99.1 netmask 255.255.255.252 | ||
1075 | .Ed | ||
1076 | .Pp | ||
1077 | Client access may be more finely tuned via the | ||
1078 | .Pa /root/.ssh/authorized_keys | ||
1079 | file (see below) and the | ||
1080 | .Cm PermitRootLogin | ||
1081 | server option. | ||
1082 | The following entry would permit connections on the first | ||
1083 | .Xr tun 4 | ||
1084 | device from user | ||
1085 | .Dq jane | ||
1086 | and on the second device from user | ||
1087 | .Dq john , | ||
1088 | if | ||
1089 | .Cm PermitRootLogin | ||
1090 | is set to | ||
1091 | .Dq forced-commands-only : | ||
1092 | .Bd -literal -offset 2n | ||
1093 | tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane | ||
1094 | tunnel="2",command="sh /etc/netstart tun1" ssh-rsa ... john | ||
1095 | .Ed | ||
1096 | .Pp | ||
1097 | Since a SSH-based setup entails a fair amount of overhead, | ||
1098 | it may be more suited to temporary setups, | ||
1099 | such as for wireless VPNs. | ||
1100 | More permanent VPNs are better provided by tools such as | ||
1101 | .Xr ipsecctl 8 | ||
1102 | and | ||
1103 | .Xr isakmpd 8 . | ||
868 | .Sh ENVIRONMENT | 1104 | .Sh ENVIRONMENT |
869 | .Nm | 1105 | .Nm |
870 | will normally set the following environment variables: | 1106 | will normally set the following environment variables: |
871 | .Bl -tag -width LOGNAME | 1107 | .Bl -tag -width "SSH_ORIGINAL_COMMAND" |
872 | .It Ev DISPLAY | 1108 | .It Ev DISPLAY |
873 | The | 1109 | The |
874 | .Ev DISPLAY | 1110 | .Ev DISPLAY |
@@ -876,9 +1112,12 @@ variable indicates the location of the X11 server. | |||
876 | It is automatically set by | 1112 | It is automatically set by |
877 | .Nm | 1113 | .Nm |
878 | to point to a value of the form | 1114 | to point to a value of the form |
879 | .Dq hostname:n | 1115 | .Dq hostname:n , |
880 | where hostname indicates | 1116 | where |
881 | the host where the shell runs, and n is an integer \*(Ge 1. | 1117 | .Dq hostname |
1118 | indicates the host where the shell runs, and | ||
1119 | .Sq n | ||
1120 | is an integer \*(Ge 1. | ||
882 | .Nm | 1121 | .Nm |
883 | uses this special value to forward X11 connections over the secure | 1122 | uses this special value to forward X11 connections over the secure |
884 | channel. | 1123 | channel. |
@@ -899,7 +1138,7 @@ Set to the path of the user's mailbox. | |||
899 | Set to the default | 1138 | Set to the default |
900 | .Ev PATH , | 1139 | .Ev PATH , |
901 | as specified when compiling | 1140 | as specified when compiling |
902 | .Nm ssh . | 1141 | .Nm . |
903 | .It Ev SSH_ASKPASS | 1142 | .It Ev SSH_ASKPASS |
904 | If | 1143 | If |
905 | .Nm | 1144 | .Nm |
@@ -924,15 +1163,16 @@ may be necessary to redirect the input from | |||
924 | .Pa /dev/null | 1163 | .Pa /dev/null |
925 | to make this work.) | 1164 | to make this work.) |
926 | .It Ev SSH_AUTH_SOCK | 1165 | .It Ev SSH_AUTH_SOCK |
927 | Identifies the path of a unix-domain socket used to communicate with the | 1166 | Identifies the path of a |
928 | agent. | 1167 | .Ux Ns -domain |
1168 | socket used to communicate with the agent. | ||
929 | .It Ev SSH_CONNECTION | 1169 | .It Ev SSH_CONNECTION |
930 | Identifies the client and server ends of the connection. | 1170 | Identifies the client and server ends of the connection. |
931 | The variable contains | 1171 | The variable contains |
932 | four space-separated values: client ip-address, client port number, | 1172 | four space-separated values: client IP address, client port number, |
933 | server ip-address and server port number. | 1173 | server IP address, and server port number. |
934 | .It Ev SSH_ORIGINAL_COMMAND | 1174 | .It Ev SSH_ORIGINAL_COMMAND |
935 | The variable contains the original command line if a forced command | 1175 | This variable contains the original command line if a forced command |
936 | is executed. | 1176 | is executed. |
937 | It can be used to extract the original arguments. | 1177 | It can be used to extract the original arguments. |
938 | .It Ev SSH_TTY | 1178 | .It Ev SSH_TTY |
@@ -941,7 +1181,7 @@ with the current shell or command. | |||
941 | If the current session has no tty, | 1181 | If the current session has no tty, |
942 | this variable is not set. | 1182 | this variable is not set. |
943 | .It Ev TZ | 1183 | .It Ev TZ |
944 | The timezone variable is set to indicate the present timezone if it | 1184 | This variable is set to indicate the present time zone if it |
945 | was set when the daemon was started (i.e., the daemon passes the value | 1185 | was set when the daemon was started (i.e., the daemon passes the value |
946 | on to new connections). | 1186 | on to new connections). |
947 | .It Ev USER | 1187 | .It Ev USER |
@@ -954,224 +1194,153 @@ reads | |||
954 | .Pa ~/.ssh/environment , | 1194 | .Pa ~/.ssh/environment , |
955 | and adds lines of the format | 1195 | and adds lines of the format |
956 | .Dq VARNAME=value | 1196 | .Dq VARNAME=value |
957 | to the environment if the file exists and if users are allowed to | 1197 | to the environment if the file exists and users are allowed to |
958 | change their environment. | 1198 | change their environment. |
959 | For more information, see the | 1199 | For more information, see the |
960 | .Cm PermitUserEnvironment | 1200 | .Cm PermitUserEnvironment |
961 | option in | 1201 | option in |
962 | .Xr sshd_config 5 . | 1202 | .Xr sshd_config 5 . |
963 | .Sh FILES | 1203 | .Sh FILES |
964 | .Bl -tag -width Ds | 1204 | .Bl -tag -width Ds -compact |
965 | .It Pa ~/.ssh/known_hosts | 1205 | .It ~/.rhosts |
966 | Records host keys for all hosts the user has logged into that are not | 1206 | This file is used for host-based authentication (see above). |
967 | in | 1207 | On some machines this file may need to be |
968 | .Pa /etc/ssh/ssh_known_hosts . | 1208 | world-readable if the user's home directory is on an NFS partition, |
969 | See | 1209 | because |
970 | .Xr sshd 8 . | 1210 | .Xr sshd 8 |
971 | .It Pa ~/.ssh/identity, ~/.ssh/id_dsa, ~/.ssh/id_rsa | 1211 | reads it as root. |
972 | Contains the authentication identity of the user. | 1212 | Additionally, this file must be owned by the user, |
973 | They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively. | 1213 | and must not have write permissions for anyone else. |
1214 | The recommended | ||
1215 | permission for most machines is read/write for the user, and not | ||
1216 | accessible by others. | ||
1217 | .Pp | ||
1218 | .It ~/.shosts | ||
1219 | This file is used in exactly the same way as | ||
1220 | .Pa .rhosts , | ||
1221 | but allows host-based authentication without permitting login with | ||
1222 | rlogin/rsh. | ||
1223 | .Pp | ||
1224 | .It ~/.ssh/authorized_keys | ||
1225 | Lists the public keys (RSA/DSA) that can be used for logging in as this user. | ||
1226 | The format of this file is described in the | ||
1227 | .Xr sshd 8 | ||
1228 | manual page. | ||
1229 | This file is not highly sensitive, but the recommended | ||
1230 | permissions are read/write for the user, and not accessible by others. | ||
1231 | .Pp | ||
1232 | .It ~/.ssh/config | ||
1233 | This is the per-user configuration file. | ||
1234 | The file format and configuration options are described in | ||
1235 | .Xr ssh_config 5 . | ||
1236 | Because of the potential for abuse, this file must have strict permissions: | ||
1237 | read/write for the user, and not accessible by others. | ||
1238 | It may be group-writable provided that the group in question contains only | ||
1239 | the user. | ||
1240 | .Pp | ||
1241 | .It ~/.ssh/environment | ||
1242 | Contains additional definitions for environment variables; see | ||
1243 | .Sx ENVIRONMENT , | ||
1244 | above. | ||
1245 | .Pp | ||
1246 | .It ~/.ssh/identity | ||
1247 | .It ~/.ssh/id_dsa | ||
1248 | .It ~/.ssh/id_rsa | ||
1249 | Contains the private key for authentication. | ||
974 | These files | 1250 | These files |
975 | contain sensitive data and should be readable by the user but not | 1251 | contain sensitive data and should be readable by the user but not |
976 | accessible by others (read/write/execute). | 1252 | accessible by others (read/write/execute). |
977 | Note that | ||
978 | .Nm | 1253 | .Nm |
979 | ignores a private key file if it is accessible by others. | 1254 | will simply ignore a private key file if it is accessible by others. |
980 | It is possible to specify a passphrase when | 1255 | It is possible to specify a passphrase when |
981 | generating the key; the passphrase will be used to encrypt the | 1256 | generating the key which will be used to encrypt the |
982 | sensitive part of this file using 3DES. | 1257 | sensitive part of this file using 3DES. |
983 | .It Pa ~/.ssh/identity.pub, ~/.ssh/id_dsa.pub, ~/.ssh/id_rsa.pub | 1258 | .Pp |
984 | Contains the public key for authentication (public part of the | 1259 | .It ~/.ssh/identity.pub |
985 | identity file in human-readable form). | 1260 | .It ~/.ssh/id_dsa.pub |
986 | The contents of the | 1261 | .It ~/.ssh/id_rsa.pub |
987 | .Pa ~/.ssh/identity.pub | 1262 | Contains the public key for authentication. |
988 | file should be added to the file | ||
989 | .Pa ~/.ssh/authorized_keys | ||
990 | on all machines | ||
991 | where the user wishes to log in using protocol version 1 RSA authentication. | ||
992 | The contents of the | ||
993 | .Pa ~/.ssh/id_dsa.pub | ||
994 | and | ||
995 | .Pa ~/.ssh/id_rsa.pub | ||
996 | file should be added to | ||
997 | .Pa ~/.ssh/authorized_keys | ||
998 | on all machines | ||
999 | where the user wishes to log in using protocol version 2 DSA/RSA authentication. | ||
1000 | These files are not | 1263 | These files are not |
1001 | sensitive and can (but need not) be readable by anyone. | 1264 | sensitive and can (but need not) be readable by anyone. |
1002 | These files are | ||
1003 | never used automatically and are not necessary; they are only provided for | ||
1004 | the convenience of the user. | ||
1005 | .It Pa ~/.ssh/config | ||
1006 | This is the per-user configuration file. | ||
1007 | The file format and configuration options are described in | ||
1008 | .Xr ssh_config 5 . | ||
1009 | Because of the potential for abuse, this file must have strict permissions: | ||
1010 | read/write for the user, and not accessible by others. | ||
1011 | It may be group-writable provided that the group in question contains only | ||
1012 | the user. | ||
1013 | .It Pa ~/.ssh/authorized_keys | ||
1014 | Lists the public keys (RSA/DSA) that can be used for logging in as this user. | ||
1015 | The format of this file is described in the | ||
1016 | .Xr sshd 8 | ||
1017 | manual page. | ||
1018 | In the simplest form the format is the same as the | ||
1019 | .Pa .pub | ||
1020 | identity files. | ||
1021 | This file is not highly sensitive, but the recommended | ||
1022 | permissions are read/write for the user, and not accessible by others. | ||
1023 | .It Pa /etc/ssh/ssh_known_hosts | ||
1024 | Systemwide list of known host keys. | ||
1025 | This file should be prepared by the | ||
1026 | system administrator to contain the public host keys of all machines in the | ||
1027 | organization. | ||
1028 | This file should be world-readable. | ||
1029 | This file contains | ||
1030 | public keys, one per line, in the following format (fields separated | ||
1031 | by spaces): system name, public key and optional comment field. | ||
1032 | When different names are used | ||
1033 | for the same machine, all such names should be listed, separated by | ||
1034 | commas. | ||
1035 | The format is described in the | ||
1036 | .Xr sshd 8 | ||
1037 | manual page. | ||
1038 | .Pp | 1265 | .Pp |
1039 | The canonical system name (as returned by name servers) is used by | 1266 | .It ~/.ssh/known_hosts |
1267 | Contains a list of host keys for all hosts the user has logged into | ||
1268 | that are not already in the systemwide list of known host keys. | ||
1269 | See | ||
1040 | .Xr sshd 8 | 1270 | .Xr sshd 8 |
1041 | to verify the client host when logging in; other names are needed because | 1271 | for further details of the format of this file. |
1272 | .Pp | ||
1273 | .It ~/.ssh/rc | ||
1274 | Commands in this file are executed by | ||
1042 | .Nm | 1275 | .Nm |
1043 | does not convert the user-supplied name to a canonical name before | 1276 | when the user logs in, just before the user's shell (or command) is |
1044 | checking the key, because someone with access to the name servers | 1277 | started. |
1045 | would then be able to fool host authentication. | 1278 | See the |
1279 | .Xr sshd 8 | ||
1280 | manual page for more information. | ||
1281 | .Pp | ||
1282 | .It /etc/hosts.equiv | ||
1283 | This file is for host-based authentication (see above). | ||
1284 | It should only be writable by root. | ||
1285 | .Pp | ||
1286 | .It /etc/shosts.equiv | ||
1287 | This file is used in exactly the same way as | ||
1288 | .Pa hosts.equiv , | ||
1289 | but allows host-based authentication without permitting login with | ||
1290 | rlogin/rsh. | ||
1291 | .Pp | ||
1046 | .It Pa /etc/ssh/ssh_config | 1292 | .It Pa /etc/ssh/ssh_config |
1047 | Systemwide configuration file. | 1293 | Systemwide configuration file. |
1048 | The file format and configuration options are described in | 1294 | The file format and configuration options are described in |
1049 | .Xr ssh_config 5 . | 1295 | .Xr ssh_config 5 . |
1050 | .It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key | 1296 | .Pp |
1297 | .It /etc/ssh/ssh_host_key | ||
1298 | .It /etc/ssh/ssh_host_dsa_key | ||
1299 | .It /etc/ssh/ssh_host_rsa_key | ||
1051 | These three files contain the private parts of the host keys | 1300 | These three files contain the private parts of the host keys |
1052 | and are used for | 1301 | and are used for host-based authentication. |
1053 | .Cm RhostsRSAAuthentication | 1302 | If protocol version 1 is used, |
1054 | and | ||
1055 | .Cm HostbasedAuthentication . | ||
1056 | If the protocol version 1 | ||
1057 | .Cm RhostsRSAAuthentication | ||
1058 | method is used, | ||
1059 | .Nm | 1303 | .Nm |
1060 | must be setuid root, since the host key is readable only by root. | 1304 | must be setuid root, since the host key is readable only by root. |
1061 | For protocol version 2, | 1305 | For protocol version 2, |
1062 | .Nm | 1306 | .Nm |
1063 | uses | 1307 | uses |
1064 | .Xr ssh-keysign 8 | 1308 | .Xr ssh-keysign 8 |
1065 | to access the host keys for | 1309 | to access the host keys, |
1066 | .Cm HostbasedAuthentication . | 1310 | eliminating the requirement that |
1067 | This eliminates the requirement that | ||
1068 | .Nm | 1311 | .Nm |
1069 | be setuid root when that authentication method is used. | 1312 | be setuid root when host-based authentication is used. |
1070 | By default | 1313 | By default |
1071 | .Nm | 1314 | .Nm |
1072 | is not setuid root. | 1315 | is not setuid root. |
1073 | .It Pa ~/.rhosts | ||
1074 | This file is used in | ||
1075 | .Cm RhostsRSAAuthentication | ||
1076 | and | ||
1077 | .Cm HostbasedAuthentication | ||
1078 | authentication to list the | ||
1079 | host/user pairs that are permitted to log in. | ||
1080 | (Note that this file is | ||
1081 | also used by rlogin and rsh, which makes using this file insecure.) | ||
1082 | Each line of the file contains a host name (in the canonical form | ||
1083 | returned by name servers), and then a user name on that host, | ||
1084 | separated by a space. | ||
1085 | On some machines this file may need to be | ||
1086 | world-readable if the user's home directory is on a NFS partition, | ||
1087 | because | ||
1088 | .Xr sshd 8 | ||
1089 | reads it as root. | ||
1090 | Additionally, this file must be owned by the user, | ||
1091 | and must not have write permissions for anyone else. | ||
1092 | The recommended | ||
1093 | permission for most machines is read/write for the user, and not | ||
1094 | accessible by others. | ||
1095 | .Pp | 1316 | .Pp |
1096 | Note that | 1317 | .It /etc/ssh/ssh_known_hosts |
1097 | .Xr sshd 8 | 1318 | Systemwide list of known host keys. |
1098 | allows authentication only in combination with client host key | 1319 | This file should be prepared by the |
1099 | authentication before permitting log in. | 1320 | system administrator to contain the public host keys of all machines in the |
1100 | If the server machine does not have the client's host key in | 1321 | organization. |
1101 | .Pa /etc/ssh/ssh_known_hosts , | 1322 | It should be world-readable. |
1102 | it can be stored in | 1323 | See |
1103 | .Pa ~/.ssh/known_hosts . | ||
1104 | The easiest way to do this is to | ||
1105 | connect back to the client from the server machine using ssh; this | ||
1106 | will automatically add the host key to | ||
1107 | .Pa ~/.ssh/known_hosts . | ||
1108 | .It Pa ~/.shosts | ||
1109 | This file is used exactly the same way as | ||
1110 | .Pa .rhosts . | ||
1111 | The purpose for | ||
1112 | having this file is to be able to use | ||
1113 | .Cm RhostsRSAAuthentication | ||
1114 | and | ||
1115 | .Cm HostbasedAuthentication | ||
1116 | authentication without permitting login with | ||
1117 | .Xr rlogin | ||
1118 | or | ||
1119 | .Xr rsh 1 . | ||
1120 | .It Pa /etc/hosts.equiv | ||
1121 | This file is used during | ||
1122 | .Cm RhostsRSAAuthentication | ||
1123 | and | ||
1124 | .Cm HostbasedAuthentication | ||
1125 | authentication. | ||
1126 | It contains | ||
1127 | canonical hosts names, one per line (the full format is described in the | ||
1128 | .Xr sshd 8 | ||
1129 | manual page). | ||
1130 | If the client host is found in this file, login is | ||
1131 | automatically permitted provided client and server user names are the | ||
1132 | same. | ||
1133 | Additionally, successful client host key authentication is required. | ||
1134 | This file should only be writable by root. | ||
1135 | .It Pa /etc/shosts.equiv | ||
1136 | This file is processed exactly as | ||
1137 | .Pa /etc/hosts.equiv . | ||
1138 | This file may be useful to permit logins using | ||
1139 | .Nm | ||
1140 | but not using rsh/rlogin. | ||
1141 | .It Pa /etc/ssh/sshrc | ||
1142 | Commands in this file are executed by | ||
1143 | .Nm | ||
1144 | when the user logs in just before the user's shell (or command) is started. | ||
1145 | See the | ||
1146 | .Xr sshd 8 | 1324 | .Xr sshd 8 |
1147 | manual page for more information. | 1325 | for further details of the format of this file. |
1148 | .It Pa ~/.ssh/rc | 1326 | .Pp |
1327 | .It /etc/ssh/sshrc | ||
1149 | Commands in this file are executed by | 1328 | Commands in this file are executed by |
1150 | .Nm | 1329 | .Nm |
1151 | when the user logs in just before the user's shell (or command) is | 1330 | when the user logs in, just before the user's shell (or command) is started. |
1152 | started. | ||
1153 | See the | 1331 | See the |
1154 | .Xr sshd 8 | 1332 | .Xr sshd 8 |
1155 | manual page for more information. | 1333 | manual page for more information. |
1156 | .It Pa ~/.ssh/environment | ||
1157 | Contains additional definitions for environment variables, see section | ||
1158 | .Sx ENVIRONMENT | ||
1159 | above. | ||
1160 | .El | 1334 | .El |
1161 | .Sh DIAGNOSTICS | ||
1162 | .Nm | ||
1163 | exits with the exit status of the remote command or with 255 | ||
1164 | if an error occurred. | ||
1165 | .Sh SEE ALSO | 1335 | .Sh SEE ALSO |
1166 | .Xr gzip 1 , | ||
1167 | .Xr rsh 1 , | ||
1168 | .Xr scp 1 , | 1336 | .Xr scp 1 , |
1169 | .Xr sftp 1 , | 1337 | .Xr sftp 1 , |
1170 | .Xr ssh-add 1 , | 1338 | .Xr ssh-add 1 , |
1171 | .Xr ssh-agent 1 , | 1339 | .Xr ssh-agent 1 , |
1172 | .Xr ssh-argv0 1 , | 1340 | .Xr ssh-argv0 1 , |
1173 | .Xr ssh-keygen 1 , | 1341 | .Xr ssh-keygen 1 , |
1174 | .Xr telnet 1 , | 1342 | .Xr ssh-keyscan 1 , |
1343 | .Xr tun 4 , | ||
1175 | .Xr hosts.equiv 5 , | 1344 | .Xr hosts.equiv 5 , |
1176 | .Xr ssh_config 5 , | 1345 | .Xr ssh_config 5 , |
1177 | .Xr ssh-keysign 8 , | 1346 | .Xr ssh-keysign 8 , |