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