diff options
Diffstat (limited to 'ssh.0')
-rw-r--r-- | ssh.0 | 728 |
1 files changed, 728 insertions, 0 deletions
@@ -0,0 +1,728 @@ | |||
1 | SSH(1) OpenBSD Reference Manual SSH(1) | ||
2 | |||
3 | NAME | ||
4 | ssh - OpenSSH SSH client (remote login program) | ||
5 | |||
6 | SYNOPSIS | ||
7 | ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] | ||
8 | [-D port] [-e escape_char] [-F configfile] [-i identity_file] | ||
9 | [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] | ||
10 | [-O ctl_cmd] [-o option] [-p port] | ||
11 | [-R [bind_address:]port:host:hostport] [-S ctl_path] [user@]hostname | ||
12 | [command] | ||
13 | |||
14 | DESCRIPTION | ||
15 | ssh (SSH client) is a program for logging into a remote machine and for | ||
16 | executing commands on a remote machine. It is intended to replace rlogin | ||
17 | and rsh, and provide secure encrypted communications between two untrust- | ||
18 | ed hosts over an insecure network. X11 connections and arbitrary TCP/IP | ||
19 | ports can also be forwarded over the secure channel. | ||
20 | |||
21 | ssh connects and logs into the specified hostname (with optional user | ||
22 | name). The user must prove his/her identity to the remote machine using | ||
23 | one of several methods depending on the protocol version used. | ||
24 | |||
25 | If command is specified, command is executed on the remote host instead | ||
26 | of a login shell. | ||
27 | |||
28 | SSH protocol version 1 | ||
29 | The first authentication method is the rhosts or hosts.equiv method com- | ||
30 | bined with RSA-based host authentication. If the machine the user logs | ||
31 | in from is listed in /etc/hosts.equiv or /etc/shosts.equiv on the remote | ||
32 | machine, and the user names are the same on both sides, or if the files | ||
33 | $HOME/.rhosts or $HOME/.shosts exist in the user's home directory on the | ||
34 | remote machine and contain a line containing the name of the client ma- | ||
35 | chine and the name of the user on that machine, the user is considered | ||
36 | for log in. Additionally, if the server can verify the client's host key | ||
37 | (see /etc/ssh/ssh_known_hosts and $HOME/.ssh/known_hosts in the FILES | ||
38 | section), only then is login permitted. This authentication method clos- | ||
39 | es security holes due to IP spoofing, DNS spoofing and routing spoofing. | ||
40 | [Note to the administrator: /etc/hosts.equiv, $HOME/.rhosts, and the | ||
41 | rlogin/rsh protocol in general, are inherently insecure and should be | ||
42 | disabled if security is desired.] | ||
43 | |||
44 | As a second authentication method, ssh supports RSA based authentication. | ||
45 | The scheme is based on public-key cryptography: there are cryptosystems | ||
46 | where encryption and decryption are done using separate keys, and it is | ||
47 | not possible to derive the decryption key from the encryption key. RSA | ||
48 | is one such system. The idea is that each user creates a public/private | ||
49 | key pair for authentication purposes. The server knows the public key, | ||
50 | and only the user knows the private key. | ||
51 | |||
52 | The file $HOME/.ssh/authorized_keys lists the public keys that are per- | ||
53 | mitted for logging in. When the user logs in, the ssh program tells the | ||
54 | server which key pair it would like to use for authentication. The serv- | ||
55 | er checks if this key is permitted, and if so, sends the user (actually | ||
56 | the ssh program running on behalf of the user) a challenge, a random num- | ||
57 | ber, encrypted by the user's public key. The challenge can only be de- | ||
58 | crypted using the proper private key. The user's client then decrypts | ||
59 | the challenge using the private key, proving that he/she knows the pri- | ||
60 | vate key but without disclosing it to the server. | ||
61 | |||
62 | ssh implements the RSA authentication protocol automatically. The user | ||
63 | creates his/her RSA key pair by running ssh-keygen(1). This stores the | ||
64 | private key in $HOME/.ssh/identity and stores the public key in | ||
65 | $HOME/.ssh/identity.pub in the user's home directory. The user should | ||
66 | then copy the identity.pub to $HOME/.ssh/authorized_keys in his/her home | ||
67 | directory on the remote machine (the authorized_keys file corresponds to | ||
68 | the conventional $HOME/.rhosts file, and has one key per line, though the | ||
69 | lines can be very long). After this, the user can log in without giving | ||
70 | the password. | ||
71 | |||
72 | The most convenient way to use RSA authentication may be with an authen- | ||
73 | tication agent. See ssh-agent(1) for more information. | ||
74 | |||
75 | If other authentication methods fail, ssh prompts the user for a pass- | ||
76 | word. The password is sent to the remote host for checking; however, | ||
77 | since all communications are encrypted, the password cannot be seen by | ||
78 | someone listening on the network. | ||
79 | |||
80 | SSH protocol version 2 | ||
81 | When a user connects using protocol version 2, similar authentication | ||
82 | methods are available. Using the default values for | ||
83 | PreferredAuthentications, the client will try to authenticate first using | ||
84 | the hostbased method; if this method fails, public key authentication is | ||
85 | attempted, and finally if this method fails, keyboard-interactive and | ||
86 | password authentication are tried. | ||
87 | |||
88 | The public key method is similar to RSA authentication described in the | ||
89 | previous section and allows the RSA or DSA algorithm to be used: The | ||
90 | client uses his private key, $HOME/.ssh/id_dsa or $HOME/.ssh/id_rsa, to | ||
91 | sign the session identifier and sends the result to the server. The | ||
92 | server checks whether the matching public key is listed in | ||
93 | $HOME/.ssh/authorized_keys and grants access if both the key is found and | ||
94 | the signature is correct. The session identifier is derived from a | ||
95 | shared Diffie-Hellman value and is only known to the client and the serv- | ||
96 | er. | ||
97 | |||
98 | If public key authentication fails or is not available, a password can be | ||
99 | sent encrypted to the remote host to prove the user's identity. | ||
100 | |||
101 | Additionally, ssh supports hostbased or challenge response authentica- | ||
102 | tion. | ||
103 | |||
104 | Protocol 2 provides additional mechanisms for confidentiality (the traf- | ||
105 | fic is encrypted using AES, 3DES, Blowfish, CAST128 or Arcfour) and in- | ||
106 | tegrity (hmac-md5, hmac-sha1, hmac-ripemd160). Note that protocol 1 | ||
107 | lacks a strong mechanism for ensuring the integrity of the connection. | ||
108 | |||
109 | Login session and remote execution | ||
110 | When the user's identity has been accepted by the server, the server ei- | ||
111 | ther executes the given command, or logs into the machine and gives the | ||
112 | user a normal shell on the remote machine. All communication with the | ||
113 | remote command or shell will be automatically encrypted. | ||
114 | |||
115 | If a pseudo-terminal has been allocated (normal login session), the user | ||
116 | may use the escape characters noted below. | ||
117 | |||
118 | If no pseudo-tty has been allocated, the session is transparent and can | ||
119 | be used to reliably transfer binary data. On most systems, setting the | ||
120 | escape character to ``none'' will also make the session transparent even | ||
121 | if a tty is used. | ||
122 | |||
123 | The session terminates when the command or shell on the remote machine | ||
124 | exits and all X11 and TCP/IP connections have been closed. The exit sta- | ||
125 | tus of the remote program is returned as the exit status of ssh. | ||
126 | |||
127 | Escape Characters | ||
128 | When a pseudo-terminal has been requested, ssh supports a number of func- | ||
129 | tions through the use of an escape character. | ||
130 | |||
131 | A single tilde character can be sent as ~~ or by following the tilde by a | ||
132 | character other than those described below. The escape character must | ||
133 | always follow a newline to be interpreted as special. The escape charac- | ||
134 | ter can be changed in configuration files using the EscapeChar configura- | ||
135 | tion directive or on the command line by the -e option. | ||
136 | |||
137 | The supported escapes (assuming the default `~') are: | ||
138 | |||
139 | ~. Disconnect. | ||
140 | |||
141 | ~^Z Background ssh. | ||
142 | |||
143 | ~# List forwarded connections. | ||
144 | |||
145 | ~& Background ssh at logout when waiting for forwarded connection / | ||
146 | X11 sessions to terminate. | ||
147 | |||
148 | ~? Display a list of escape characters. | ||
149 | |||
150 | ~B Send a BREAK to the remote system (only useful for SSH protocol | ||
151 | version 2 and if the peer supports it). | ||
152 | |||
153 | ~C Open command line. Currently this allows the addition of port | ||
154 | forwardings using the -L and -R options (see below). It also al- | ||
155 | lows the cancellation of existing remote port-forwardings using | ||
156 | -KR hostport. Basic help is available, using the -h option. | ||
157 | |||
158 | ~R Request rekeying of the connection (only useful for SSH protocol | ||
159 | version 2 and if the peer supports it). | ||
160 | |||
161 | X11 and TCP forwarding | ||
162 | If the ForwardX11 variable is set to ``yes'' (or see the description of | ||
163 | the -X and -x options described later) and the user is using X11 (the | ||
164 | DISPLAY environment variable is set), the connection to the X11 display | ||
165 | is automatically forwarded to the remote side in such a way that any X11 | ||
166 | programs started from the shell (or command) will go through the encrypt- | ||
167 | ed channel, and the connection to the real X server will be made from the | ||
168 | local machine. The user should not manually set DISPLAY. Forwarding of | ||
169 | X11 connections can be configured on the command line or in configuration | ||
170 | files. | ||
171 | |||
172 | The DISPLAY value set by ssh will point to the server machine, but with a | ||
173 | display number greater than zero. This is normal, and happens because | ||
174 | ssh creates a ``proxy'' X server on the server machine for forwarding the | ||
175 | connections over the encrypted channel. | ||
176 | |||
177 | ssh will also automatically set up Xauthority data on the server machine. | ||
178 | For this purpose, it will generate a random authorization cookie, store | ||
179 | it in Xauthority on the server, and verify that any forwarded connections | ||
180 | carry this cookie and replace it by the real cookie when the connection | ||
181 | is opened. The real authentication cookie is never sent to the server | ||
182 | machine (and no cookies are sent in the plain). | ||
183 | |||
184 | If the ForwardAgent variable is set to ``yes'' (or see the description of | ||
185 | the -A and -a options described later) and the user is using an authenti- | ||
186 | cation agent, the connection to the agent is automatically forwarded to | ||
187 | the remote side. | ||
188 | |||
189 | Forwarding of arbitrary TCP/IP connections over the secure channel can be | ||
190 | specified either on the command line or in a configuration file. One | ||
191 | possible application of TCP/IP forwarding is a secure connection to an | ||
192 | electronic purse; another is going through firewalls. | ||
193 | |||
194 | Server authentication | ||
195 | ssh automatically maintains and checks a database containing identifica- | ||
196 | tions for all hosts it has ever been used with. Host keys are stored in | ||
197 | $HOME/.ssh/known_hosts in the user's home directory. Additionally, the | ||
198 | file /etc/ssh/ssh_known_hosts is automatically checked for known hosts. | ||
199 | Any new hosts are automatically added to the user's file. If a host's | ||
200 | identification ever changes, ssh warns about this and disables password | ||
201 | authentication to prevent a trojan horse from getting the user's pass- | ||
202 | word. Another purpose of this mechanism is to prevent man-in-the-middle | ||
203 | attacks which could otherwise be used to circumvent the encryption. The | ||
204 | StrictHostKeyChecking option can be used to prevent logins to machines | ||
205 | whose host key is not known or has changed. | ||
206 | |||
207 | ssh can be configured to verify host identification using fingerprint re- | ||
208 | source records (SSHFP) published in DNS. The VerifyHostKeyDNS option can | ||
209 | be used to control how DNS lookups are performed. SSHFP resource records | ||
210 | can be generated using ssh-keygen(1). | ||
211 | |||
212 | The options are as follows: | ||
213 | |||
214 | -1 Forces ssh to try protocol version 1 only. | ||
215 | |||
216 | -2 Forces ssh to try protocol version 2 only. | ||
217 | |||
218 | -4 Forces ssh to use IPv4 addresses only. | ||
219 | |||
220 | -6 Forces ssh to use IPv6 addresses only. | ||
221 | |||
222 | -A Enables forwarding of the authentication agent connection. This | ||
223 | can also be specified on a per-host basis in a configuration | ||
224 | file. | ||
225 | |||
226 | Agent forwarding should be enabled with caution. Users with the | ||
227 | ability to bypass file permissions on the remote host (for the | ||
228 | agent's Unix-domain socket) can access the local agent through | ||
229 | the forwarded connection. An attacker cannot obtain key material | ||
230 | from the agent, however they can perform operations on the keys | ||
231 | that enable them to authenticate using the identities loaded into | ||
232 | the agent. | ||
233 | |||
234 | -a Disables forwarding of the authentication agent connection. | ||
235 | |||
236 | -b bind_address | ||
237 | Specify the interface to transmit from on machines with multiple | ||
238 | interfaces or aliased addresses. | ||
239 | |||
240 | -C Requests compression of all data (including stdin, stdout, | ||
241 | stderr, and data for forwarded X11 and TCP/IP connections). The | ||
242 | compression algorithm is the same used by gzip(1), and the | ||
243 | ``level'' can be controlled by the CompressionLevel option for | ||
244 | protocol version 1. Compression is desirable on modem lines and | ||
245 | other slow connections, but will only slow down things on fast | ||
246 | networks. The default value can be set on a host-by-host basis | ||
247 | in the configuration files; see the Compression option. | ||
248 | |||
249 | -c cipher_spec | ||
250 | Selects the cipher specification for encrypting the session. | ||
251 | |||
252 | Protocol version 1 allows specification of a single cipher. The | ||
253 | suported values are ``3des'', ``blowfish'' and ``des''. 3des | ||
254 | (triple-des) is an encrypt-decrypt-encrypt triple with three dif- | ||
255 | ferent keys. It is believed to be secure. blowfish is a fast | ||
256 | block cipher; it appears very secure and is much faster than | ||
257 | 3des. des is only supported in the ssh client for interoperabil- | ||
258 | ity with legacy protocol 1 implementations that do not support | ||
259 | the 3des cipher. Its use is strongly discouraged due to crypto- | ||
260 | graphic weaknesses. The default is ``3des''. | ||
261 | |||
262 | For protocol version 2 cipher_spec is a comma-separated list of | ||
263 | ciphers listed in order of preference. The supported ciphers are | ||
264 | ``3des-cbc'', ``aes128-cbc'', ``aes192-cbc'', ``aes256-cbc'', | ||
265 | ``aes128-ctr'', ``aes192-ctr'', ``aes256-ctr'', ``arcfour'', | ||
266 | ``blowfish-cbc'', and ``cast128-cbc''. The default is | ||
267 | |||
268 | ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour, | ||
269 | aes192-cbc,aes256-cbc'' | ||
270 | |||
271 | -D port | ||
272 | Specifies a local ``dynamic'' application-level port forwarding. | ||
273 | This works by allocating a socket to listen to port on the local | ||
274 | side, and whenever a connection is made to this port, the connec- | ||
275 | tion is forwarded over the secure channel, and the application | ||
276 | protocol is then used to determine where to connect to from the | ||
277 | remote machine. Currently the SOCKS4 and SOCKS5 protocols are | ||
278 | supported, and ssh will act as a SOCKS server. Only root can | ||
279 | forward privileged ports. Dynamic port forwardings can also be | ||
280 | specified in the configuration file. | ||
281 | |||
282 | -e ch | ^ch | none | ||
283 | Sets the escape character for sessions with a pty (default: `~'). | ||
284 | The escape character is only recognized at the beginning of a | ||
285 | line. The escape character followed by a dot (`.') closes the | ||
286 | connection; followed by control-Z suspends the connection; and | ||
287 | followed by itself sends the escape character once. Setting the | ||
288 | character to ``none'' disables any escapes and makes the session | ||
289 | fully transparent. | ||
290 | |||
291 | -F configfile | ||
292 | Specifies an alternative per-user configuration file. If a con- | ||
293 | figuration file is given on the command line, the system-wide | ||
294 | configuration file (/etc/ssh/ssh_config) will be ignored. The | ||
295 | default for the per-user configuration file is $HOME/.ssh/config. | ||
296 | |||
297 | -f Requests ssh to go to background just before command execution. | ||
298 | This is useful if ssh is going to ask for passwords or passphras- | ||
299 | es, but the user wants it in the background. This implies -n. | ||
300 | The recommended way to start X11 programs at a remote site is | ||
301 | with something like ssh -f host xterm. | ||
302 | |||
303 | -g Allows remote hosts to connect to local forwarded ports. | ||
304 | |||
305 | -I smartcard_device | ||
306 | Specifies which smartcard device to use. The argument is the de- | ||
307 | vice ssh should use to communicate with a smartcard used for | ||
308 | storing the user's private RSA key. | ||
309 | |||
310 | -i identity_file | ||
311 | Selects a file from which the identity (private key) for RSA or | ||
312 | DSA authentication is read. The default is $HOME/.ssh/identity | ||
313 | for protocol version 1, and $HOME/.ssh/id_rsa and | ||
314 | $HOME/.ssh/id_dsa for protocol version 2. Identity files may al- | ||
315 | so be specified on a per-host basis in the configuration file. | ||
316 | It is possible to have multiple -i options (and multiple identi- | ||
317 | ties specified in configuration files). | ||
318 | |||
319 | -k Disables forwarding (delegation) of GSSAPI credentials to the | ||
320 | server. | ||
321 | |||
322 | -L [bind_address:]port:host:hostport | ||
323 | Specifies that the given port on the local (client) host is to be | ||
324 | forwarded to the given host and port on the remote side. This | ||
325 | works by allocating a socket to listen to port on the local side, | ||
326 | optionally bound to the specified bind_address. Whenever a con- | ||
327 | nection is made to this port, the connection is forwarded over | ||
328 | the secure channel, and a connection is made to host port | ||
329 | hostport from the remote machine. Port forwardings can also be | ||
330 | specified in the configuration file. IPv6 addresses can be spec- | ||
331 | ified with an alternative syntax: [bind_address/]port/host/host- | ||
332 | port or by enclosing the address in square brackets. Only the | ||
333 | superuser can forward privileged ports. By default, the local | ||
334 | port is bound in accordance with the GatewayPorts setting. How- | ||
335 | ever, an explicit bind_address may be used to bind the connection | ||
336 | to a specific address. The bind_address of ``localhost'' indi- | ||
337 | cates that the listening port be bound for local use only, while | ||
338 | an empty address or `*' indicates that the port should be avail- | ||
339 | able from all interfaces. | ||
340 | |||
341 | -l login_name | ||
342 | Specifies the user to log in as on the remote machine. This also | ||
343 | may be specified on a per-host basis in the configuration file. | ||
344 | |||
345 | -M Places the ssh client into ``master'' mode for connection shar- | ||
346 | ing. Refer to the description of ControlMaster in ssh_config(5) | ||
347 | for details. | ||
348 | |||
349 | -m mac_spec | ||
350 | Additionally, for protocol version 2 a comma-separated list of | ||
351 | MAC (message authentication code) algorithms can be specified in | ||
352 | order of preference. See the MACs keyword for more information. | ||
353 | |||
354 | -N Do not execute a remote command. This is useful for just for- | ||
355 | warding ports (protocol version 2 only). | ||
356 | |||
357 | -n Redirects stdin from /dev/null (actually, prevents reading from | ||
358 | stdin). This must be used when ssh is run in the background. A | ||
359 | common trick is to use this to run X11 programs on a remote ma- | ||
360 | chine. For example, ssh -n shadows.cs.hut.fi emacs & will start | ||
361 | an emacs on shadows.cs.hut.fi, and the X11 connection will be au- | ||
362 | tomatically forwarded over an encrypted channel. The ssh program | ||
363 | will be put in the background. (This does not work if ssh needs | ||
364 | to ask for a password or passphrase; see also the -f option.) | ||
365 | |||
366 | -O ctl_cmd | ||
367 | Control an active connection multiplexing master process. When | ||
368 | the -O option is specified, the ctl_cmd argument is interpreted | ||
369 | and passed to the master process. Valid commands are: ``check'' | ||
370 | (check that the master process is running) and ``exit'' (request | ||
371 | the master to exit). | ||
372 | |||
373 | -o option | ||
374 | Can be used to give options in the format used in the configura- | ||
375 | tion file. This is useful for specifying options for which there | ||
376 | is no separate command-line flag. For full details of the op- | ||
377 | tions listed below, and their possible values, see ssh_config(5). | ||
378 | |||
379 | AddressFamily | ||
380 | BatchMode | ||
381 | BindAddress | ||
382 | ChallengeResponseAuthentication | ||
383 | CheckHostIP | ||
384 | Cipher | ||
385 | Ciphers | ||
386 | ClearAllForwardings | ||
387 | Compression | ||
388 | CompressionLevel | ||
389 | ConnectionAttempts | ||
390 | ConnectTimeout | ||
391 | ControlMaster | ||
392 | ControlPath | ||
393 | DynamicForward | ||
394 | EscapeChar | ||
395 | ForwardAgent | ||
396 | ForwardX11 | ||
397 | ForwardX11Trusted | ||
398 | GatewayPorts | ||
399 | GlobalKnownHostsFile | ||
400 | GSSAPIAuthentication | ||
401 | GSSAPIDelegateCredentials | ||
402 | HashKnownHosts | ||
403 | Host | ||
404 | HostbasedAuthentication | ||
405 | HostKeyAlgorithms | ||
406 | HostKeyAlias | ||
407 | HostName | ||
408 | IdentityFile | ||
409 | IdentitiesOnly | ||
410 | KbdInteractiveDevices | ||
411 | LocalForward | ||
412 | LogLevel | ||
413 | MACs | ||
414 | NoHostAuthenticationForLocalhost | ||
415 | NumberOfPasswordPrompts | ||
416 | PasswordAuthentication | ||
417 | Port | ||
418 | PreferredAuthentications | ||
419 | Protocol | ||
420 | ProxyCommand | ||
421 | PubkeyAuthentication | ||
422 | RemoteForward | ||
423 | RhostsRSAAuthentication | ||
424 | RSAAuthentication | ||
425 | SendEnv | ||
426 | ServerAliveInterval | ||
427 | ServerAliveCountMax | ||
428 | SmartcardDevice | ||
429 | StrictHostKeyChecking | ||
430 | TCPKeepAlive | ||
431 | UsePrivilegedPort | ||
432 | User | ||
433 | UserKnownHostsFile | ||
434 | VerifyHostKeyDNS | ||
435 | XAuthLocation | ||
436 | |||
437 | -p port | ||
438 | Port to connect to on the remote host. This can be specified on | ||
439 | a per-host basis in the configuration file. | ||
440 | |||
441 | -q Quiet mode. Causes all warning and diagnostic messages to be | ||
442 | suppressed. | ||
443 | |||
444 | -R [bind_address:]port:host:hostport | ||
445 | Specifies that the given port on the remote (server) host is to | ||
446 | be forwarded to the given host and port on the local side. This | ||
447 | works by allocating a socket to listen to port on the remote | ||
448 | side, and whenever a connection is made to this port, the connec- | ||
449 | tion is forwarded over the secure channel, and a connection is | ||
450 | made to host port hostport from the local machine. | ||
451 | |||
452 | Port forwardings can also be specified in the configuration file. | ||
453 | Privileged ports can be forwarded only when logging in as root on | ||
454 | the remote machine. IPv6 addresses can be specified by enclosing | ||
455 | the address in square braces or using an alternative syntax: | ||
456 | [bind_address/]host/port/hostport. | ||
457 | |||
458 | By default, the listening socket on the server will be bound to | ||
459 | the loopback interface only. This may be overriden by specifying | ||
460 | a bind_address. An empty bind_address, or the address `*', indi- | ||
461 | cates that the remote socket should listen on all interfaces. | ||
462 | Specifying a remote bind_address will only succeed if the serv- | ||
463 | er's GatewayPorts option is enabled (see sshd_config(5)). | ||
464 | |||
465 | -S ctl_path | ||
466 | Specifies the location of a control socket for connection shar- | ||
467 | ing. Refer to the description of ControlPath and ControlMaster | ||
468 | in ssh_config(5) for details. | ||
469 | |||
470 | -s May be used to request invocation of a subsystem on the remote | ||
471 | system. Subsystems are a feature of the SSH2 protocol which fa- | ||
472 | cilitate the use of SSH as a secure transport for other applica- | ||
473 | tions (eg. sftp(1)). The subsystem is specified as the remote | ||
474 | command. | ||
475 | |||
476 | -T Disable pseudo-tty allocation. | ||
477 | |||
478 | -t Force pseudo-tty allocation. This can be used to execute arbi- | ||
479 | trary screen-based programs on a remote machine, which can be | ||
480 | very useful, e.g., when implementing menu services. Multiple -t | ||
481 | options force tty allocation, even if ssh has no local tty. | ||
482 | |||
483 | -V Display the version number and exit. | ||
484 | |||
485 | -v Verbose mode. Causes ssh to print debugging messages about its | ||
486 | progress. This is helpful in debugging connection, authentica- | ||
487 | tion, and configuration problems. Multiple -v options increase | ||
488 | the verbosity. The maximum is 3. | ||
489 | |||
490 | -X Enables X11 forwarding. This can also be specified on a per-host | ||
491 | basis in a configuration file. | ||
492 | |||
493 | X11 forwarding should be enabled with caution. Users with the | ||
494 | ability to bypass file permissions on the remote host (for the | ||
495 | user's X authorization database) can access the local X11 display | ||
496 | through the forwarded connection. An attacker may then be able | ||
497 | to perform activities such as keystroke monitoring. | ||
498 | |||
499 | For this reason, X11 forwarding is subjected to X11 SECURITY ex- | ||
500 | tension restrictions by default. Please refer to the ssh -Y op- | ||
501 | tion and the ForwardX11Trusted directive in ssh_config(5) for | ||
502 | more information. | ||
503 | |||
504 | -x Disables X11 forwarding. | ||
505 | |||
506 | -Y Enables trusted X11 forwarding. Trusted X11 forwardings are not | ||
507 | subjected to the X11 SECURITY extension controls. | ||
508 | |||
509 | CONFIGURATION FILES | ||
510 | ssh may additionally obtain configuration data from a per-user configura- | ||
511 | tion file and a system-wide configuration file. The file format and con- | ||
512 | figuration options are described in ssh_config(5). | ||
513 | |||
514 | ENVIRONMENT | ||
515 | ssh will normally set the following environment variables: | ||
516 | |||
517 | DISPLAY The DISPLAY variable indicates the location of the X11 server. | ||
518 | It is automatically set by ssh to point to a value of the form | ||
519 | ``hostname:n'' where hostname indicates the host where the shell | ||
520 | runs, and n is an integer >= 1. ssh uses this special value to | ||
521 | forward X11 connections over the secure channel. The user | ||
522 | should normally not set DISPLAY explicitly, as that will render | ||
523 | the X11 connection insecure (and will require the user to manu- | ||
524 | ally copy any required authorization cookies). | ||
525 | |||
526 | HOME Set to the path of the user's home directory. | ||
527 | |||
528 | LOGNAME Synonym for USER; set for compatibility with systems that use | ||
529 | this variable. | ||
530 | |||
531 | MAIL Set to the path of the user's mailbox. | ||
532 | |||
533 | PATH Set to the default PATH, as specified when compiling ssh. | ||
534 | |||
535 | SSH_ASKPASS | ||
536 | If ssh needs a passphrase, it will read the passphrase from the | ||
537 | current terminal if it was run from a terminal. If ssh does not | ||
538 | have a terminal associated with it but DISPLAY and SSH_ASKPASS | ||
539 | are set, it will execute the program specified by SSH_ASKPASS | ||
540 | and open an X11 window to read the passphrase. This is particu- | ||
541 | larly useful when calling ssh from a .xsession or related | ||
542 | script. (Note that on some machines it may be necessary to | ||
543 | redirect the input from /dev/null to make this work.) | ||
544 | |||
545 | SSH_AUTH_SOCK | ||
546 | Identifies the path of a unix-domain socket used to communicate | ||
547 | with the agent. | ||
548 | |||
549 | SSH_CONNECTION | ||
550 | Identifies the client and server ends of the connection. The | ||
551 | variable contains four space-separated values: client ip-ad- | ||
552 | dress, client port number, server ip-address and server port | ||
553 | number. | ||
554 | |||
555 | SSH_ORIGINAL_COMMAND | ||
556 | The variable contains the original command line if a forced com- | ||
557 | mand is executed. It can be used to extract the original argu- | ||
558 | ments. | ||
559 | |||
560 | SSH_TTY This is set to the name of the tty (path to the device) associ- | ||
561 | ated with the current shell or command. If the current session | ||
562 | has no tty, this variable is not set. | ||
563 | |||
564 | TZ The timezone variable is set to indicate the present timezone if | ||
565 | it was set when the daemon was started (i.e., the daemon passes | ||
566 | the value on to new connections). | ||
567 | |||
568 | USER Set to the name of the user logging in. | ||
569 | |||
570 | Additionally, ssh reads $HOME/.ssh/environment, and adds lines of the | ||
571 | format ``VARNAME=value'' to the environment if the file exists and if | ||
572 | users are allowed to change their environment. For more information, see | ||
573 | the PermitUserEnvironment option in sshd_config(5). | ||
574 | |||
575 | FILES | ||
576 | $HOME/.ssh/known_hosts | ||
577 | Records host keys for all hosts the user has logged into that are | ||
578 | not in /etc/ssh/ssh_known_hosts. See sshd(8). | ||
579 | |||
580 | $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa | ||
581 | Contains the authentication identity of the user. They are for | ||
582 | protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively. | ||
583 | These files contain sensitive data and should be readable by the | ||
584 | user but not accessible by others (read/write/execute). Note | ||
585 | that ssh ignores a private key file if it is accessible by oth- | ||
586 | ers. It is possible to specify a passphrase when generating the | ||
587 | key; the passphrase will be used to encrypt the sensitive part of | ||
588 | this file using 3DES. | ||
589 | |||
590 | $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub | ||
591 | Contains the public key for authentication (public part of the | ||
592 | identity file in human-readable form). The contents of the | ||
593 | $HOME/.ssh/identity.pub file should be added to the file | ||
594 | $HOME/.ssh/authorized_keys on all machines where the user wishes | ||
595 | to log in using protocol version 1 RSA authentication. The con- | ||
596 | tents of the $HOME/.ssh/id_dsa.pub and $HOME/.ssh/id_rsa.pub file | ||
597 | should be added to $HOME/.ssh/authorized_keys on all machines | ||
598 | where the user wishes to log in using protocol version 2 DSA/RSA | ||
599 | authentication. These files are not sensitive and can (but need | ||
600 | not) be readable by anyone. These files are never used automati- | ||
601 | cally and are not necessary; they are only provided for the con- | ||
602 | venience of the user. | ||
603 | |||
604 | $HOME/.ssh/config | ||
605 | This is the per-user configuration file. The file format and | ||
606 | configuration options are described in ssh_config(5). Because of | ||
607 | the potential for abuse, this file must have strict permissions: | ||
608 | read/write for the user, and not accessible by others. | ||
609 | |||
610 | $HOME/.ssh/authorized_keys | ||
611 | Lists the public keys (RSA/DSA) that can be used for logging in | ||
612 | as this user. The format of this file is described in the | ||
613 | sshd(8) manual page. In the simplest form the format is the same | ||
614 | as the .pub identity files. This file is not highly sensitive, | ||
615 | but the recommended permissions are read/write for the user, and | ||
616 | not accessible by others. | ||
617 | |||
618 | /etc/ssh/ssh_known_hosts | ||
619 | Systemwide list of known host keys. This file should be prepared | ||
620 | by the system administrator to contain the public host keys of | ||
621 | all machines in the organization. This file should be world- | ||
622 | readable. This file contains public keys, one per line, in the | ||
623 | following format (fields separated by spaces): system name, pub- | ||
624 | lic key and optional comment field. When different names are | ||
625 | used for the same machine, all such names should be listed, sepa- | ||
626 | rated by commas. The format is described in the sshd(8) manual | ||
627 | page. | ||
628 | |||
629 | The canonical system name (as returned by name servers) is used | ||
630 | by sshd(8) to verify the client host when logging in; other names | ||
631 | are needed because ssh does not convert the user-supplied name to | ||
632 | a canonical name before checking the key, because someone with | ||
633 | access to the name servers would then be able to fool host au- | ||
634 | thentication. | ||
635 | |||
636 | /etc/ssh/ssh_config | ||
637 | Systemwide configuration file. The file format and configuration | ||
638 | options are described in ssh_config(5). | ||
639 | |||
640 | /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, | ||
641 | /etc/ssh/ssh_host_rsa_key | ||
642 | These three files contain the private parts of the host keys and | ||
643 | are used for RhostsRSAAuthentication and HostbasedAuthentication. | ||
644 | If the protocol version 1 RhostsRSAAuthentication method is used, | ||
645 | ssh must be setuid root, since the host key is readable only by | ||
646 | root. For protocol version 2, ssh uses ssh-keysign(8) to access | ||
647 | the host keys for HostbasedAuthentication. This eliminates the | ||
648 | requirement that ssh be setuid root when that authentication | ||
649 | method is used. By default ssh is not setuid root. | ||
650 | |||
651 | $HOME/.rhosts | ||
652 | This file is used in RhostsRSAAuthentication and | ||
653 | HostbasedAuthentication authentication to list the host/user | ||
654 | pairs that are permitted to log in. (Note that this file is also | ||
655 | used by rlogin and rsh, which makes using this file insecure.) | ||
656 | Each line of the file contains a host name (in the canonical form | ||
657 | returned by name servers), and then a user name on that host, | ||
658 | separated by a space. On some machines this file may need to be | ||
659 | world-readable if the user's home directory is on a NFS parti- | ||
660 | tion, because sshd(8) reads it as root. Additionally, this file | ||
661 | must be owned by the user, and must not have write permissions | ||
662 | for anyone else. The recommended permission for most machines is | ||
663 | read/write for the user, and not accessible by others. | ||
664 | |||
665 | Note that sshd(8) allows authentication only in combination with | ||
666 | client host key authentication before permitting log in. If the | ||
667 | server machine does not have the client's host key in | ||
668 | /etc/ssh/ssh_known_hosts, it can be stored in | ||
669 | $HOME/.ssh/known_hosts. The easiest way to do this is to connect | ||
670 | back to the client from the server machine using ssh; this will | ||
671 | automatically add the host key to $HOME/.ssh/known_hosts. | ||
672 | |||
673 | $HOME/.shosts | ||
674 | This file is used exactly the same way as .rhosts. The purpose | ||
675 | for having this file is to be able to use RhostsRSAAuthentication | ||
676 | and HostbasedAuthentication authentication without permitting lo- | ||
677 | gin with rlogin or rsh(1). | ||
678 | |||
679 | /etc/hosts.equiv | ||
680 | This file is used during RhostsRSAAuthentication and | ||
681 | HostbasedAuthentication authentication. It contains canonical | ||
682 | hosts names, one per line (the full format is described in the | ||
683 | sshd(8) manual page). If the client host is found in this file, | ||
684 | login is automatically permitted provided client and server user | ||
685 | names are the same. Additionally, successful client host key au- | ||
686 | thentication is required. This file should only be writable by | ||
687 | root. | ||
688 | |||
689 | /etc/shosts.equiv | ||
690 | This file is processed exactly as /etc/hosts.equiv. This file | ||
691 | may be useful to permit logins using ssh but not using | ||
692 | rsh/rlogin. | ||
693 | |||
694 | /etc/ssh/sshrc | ||
695 | Commands in this file are executed by ssh when the user logs in | ||
696 | just before the user's shell (or command) is started. See the | ||
697 | sshd(8) manual page for more information. | ||
698 | |||
699 | $HOME/.ssh/rc | ||
700 | Commands in this file are executed by ssh when the user logs in | ||
701 | just before the user's shell (or command) is started. See the | ||
702 | sshd(8) manual page for more information. | ||
703 | |||
704 | $HOME/.ssh/environment | ||
705 | Contains additional definitions for environment variables, see | ||
706 | section ENVIRONMENT above. | ||
707 | |||
708 | DIAGNOSTICS | ||
709 | ssh exits with the exit status of the remote command or with 255 if an | ||
710 | error occurred. | ||
711 | |||
712 | SEE ALSO | ||
713 | gzip(1), rsh(1), scp(1), sftp(1), ssh-add(1), ssh-agent(1), | ||
714 | ssh-keygen(1), telnet(1), hosts.equiv(5), ssh_config(5), ssh-keysign(8), | ||
715 | sshd(8) | ||
716 | |||
717 | T. Ylonen, T. Kivinen, M. Saarinen, T. Rinne, and S. Lehtinen, SSH | ||
718 | Protocol Architecture, draft-ietf-secsh-architecture-12.txt, January | ||
719 | 2002, work in progress material. | ||
720 | |||
721 | AUTHORS | ||
722 | OpenSSH is a derivative of the original and free ssh 1.2.12 release by | ||
723 | Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo | ||
724 | de Raadt and Dug Song removed many bugs, re-added newer features and | ||
725 | created OpenSSH. Markus Friedl contributed the support for SSH protocol | ||
726 | versions 1.5 and 2.0. | ||
727 | |||
728 | OpenBSD 3.6 September 25, 1999 11 | ||