Initial import from FreeBSD RELENG_4:
[dragonfly.git] / crypto / openssh / ssh.1
1 .\"  -*- nroff -*-
2 .\"
3 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 .\"                    All rights reserved
6 .\"
7 .\" As far as I am concerned, the code I have written for this software
8 .\" can be used freely for any purpose.  Any derived versions of this
9 .\" software must be clearly marked as such, and if the derived work is
10 .\" incompatible with the protocol description in the RFC file, it must be
11 .\" called by a name other than "ssh" or "Secure Shell".
12 .\"
13 .\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
14 .\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
15 .\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
16 .\"
17 .\" Redistribution and use in source and binary forms, with or without
18 .\" modification, are permitted provided that the following conditions
19 .\" are met:
20 .\" 1. Redistributions of source code must retain the above copyright
21 .\"    notice, this list of conditions and the following disclaimer.
22 .\" 2. Redistributions in binary form must reproduce the above copyright
23 .\"    notice, this list of conditions and the following disclaimer in the
24 .\"    documentation and/or other materials provided with the distribution.
25 .\"
26 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .\"
37 .\" $OpenBSD: ssh.1,v 1.167 2002/09/27 15:46:21 stevesk Exp $
38 .\" $FreeBSD: src/crypto/openssh/ssh.1,v 1.4.2.10 2003/02/03 17:31:07 des Exp $
39 .Dd September 25, 1999
40 .Dt SSH 1
41 .Os
42 .Sh NAME
43 .Nm ssh
44 .Nd OpenSSH SSH client (remote login program)
45 .Sh SYNOPSIS
46 .Nm ssh
47 .Op Fl l Ar login_name
48 .Ar hostname | user@hostname
49 .Op Ar command
50 .Pp
51 .Nm ssh
52 .Op Fl afgknqstvxACNTX1246
53 .Op Fl b Ar bind_address
54 .Op Fl c Ar cipher_spec
55 .Op Fl e Ar escape_char
56 .Op Fl i Ar identity_file
57 .Op Fl l Ar login_name
58 .Op Fl m Ar mac_spec
59 .Op Fl o Ar option
60 .Op Fl p Ar port
61 .Op Fl F Ar configfile
62 .Oo Fl L Xo
63 .Sm off
64 .Ar port :
65 .Ar host :
66 .Ar hostport
67 .Sm on
68 .Xc
69 .Oc
70 .Oo Fl R Xo
71 .Sm off
72 .Ar port :
73 .Ar host :
74 .Ar hostport
75 .Sm on
76 .Xc
77 .Oc
78 .Op Fl D Ar port
79 .Ar hostname | user@hostname
80 .Op Ar command
81 .Sh DESCRIPTION
82 .Nm
83 (SSH client) is a program for logging into a remote machine and for
84 executing commands on a remote machine.
85 It is intended to replace
86 rlogin and rsh, and provide secure encrypted communications between
87 two untrusted hosts over an insecure network.
88 X11 connections and
89 arbitrary TCP/IP ports can also be forwarded over the secure channel.
90 .Pp
91 .Nm
92 connects and logs into the specified
93 .Ar hostname .
94 The user must prove
95 his/her identity to the remote machine using one of several methods
96 depending on the protocol version used:
97 .Pp
98 .Ss SSH protocol version 1
99 .Pp
100 First, if the machine the user logs in from is listed in
101 .Pa /etc/hosts.equiv
102 or
103 .Pa /etc/ssh/shosts.equiv
104 on the remote machine, and the user names are
105 the same on both sides, the user is immediately permitted to log in.
106 Second, if
107 .Pa \&.rhosts
108 or
109 .Pa \&.shosts
110 exists in the user's home directory on the
111 remote machine and contains a line containing the name of the client
112 machine and the name of the user on that machine, the user is
113 permitted to log in.
114 This form of authentication alone is normally not
115 allowed by the server because it is not secure.
116 .Pp
117 The second authentication method is the
118 .Pa rhosts
119 or
120 .Pa hosts.equiv
121 method combined with RSA-based host authentication.
122 It means that if the login would be permitted by
123 .Pa $HOME/.rhosts ,
124 .Pa $HOME/.shosts ,
125 .Pa /etc/hosts.equiv ,
126 or
127 .Pa /etc/ssh/shosts.equiv ,
128 and if additionally the server can verify the client's
129 host key (see
130 .Pa /etc/ssh/ssh_known_hosts
131 and
132 .Pa $HOME/.ssh/known_hosts
133 in the
134 .Sx FILES
135 section), only then login is permitted.
136 This authentication method closes security holes due to IP
137 spoofing, DNS spoofing and routing spoofing.
138 [Note to the administrator:
139 .Pa /etc/hosts.equiv ,
140 .Pa $HOME/.rhosts ,
141 and the rlogin/rsh protocol in general, are inherently insecure and should be
142 disabled if security is desired.]
143 .Pp
144 As a third authentication method,
145 .Nm
146 supports RSA based authentication.
147 The scheme is based on public-key cryptography: there are cryptosystems
148 where encryption and decryption are done using separate keys, and it
149 is not possible to derive the decryption key from the encryption key.
150 RSA is one such system.
151 The idea is that each user creates a public/private
152 key pair for authentication purposes.
153 The server knows the public key, and only the user knows the private key.
154 The file
155 .Pa $HOME/.ssh/authorized_keys
156 lists the public keys that are permitted for logging
157 in.
158 When the user logs in, the
159 .Nm
160 program tells the server which key pair it would like to use for
161 authentication.
162 The server checks if this key is permitted, and if
163 so, sends the user (actually the
164 .Nm
165 program running on behalf of the user) a challenge, a random number,
166 encrypted by the user's public key.
167 The challenge can only be
168 decrypted using the proper private key.
169 The user's client then decrypts the
170 challenge using the private key, proving that he/she knows the private
171 key but without disclosing it to the server.
172 .Pp
173 .Nm
174 implements the RSA authentication protocol automatically.
175 The user creates his/her RSA key pair by running
176 .Xr ssh-keygen 1 .
177 This stores the private key in
178 .Pa $HOME/.ssh/identity
179 and the public key in
180 .Pa $HOME/.ssh/identity.pub
181 in the user's home directory.
182 The user should then copy the
183 .Pa identity.pub
184 to
185 .Pa $HOME/.ssh/authorized_keys
186 in his/her home directory on the remote machine (the
187 .Pa authorized_keys
188 file corresponds to the conventional
189 .Pa $HOME/.rhosts
190 file, and has one key
191 per line, though the lines can be very long).
192 After this, the user can log in without giving the password.
193 RSA authentication is much
194 more secure than rhosts authentication.
195 .Pp
196 The most convenient way to use RSA authentication may be with an
197 authentication agent.
198 See
199 .Xr ssh-agent 1
200 for more information.
201 .Pp
202 If other authentication methods fail,
203 .Nm
204 prompts the user for a password.
205 The password is sent to the remote
206 host for checking; however, since all communications are encrypted,
207 the password cannot be seen by someone listening on the network.
208 .Pp
209 .Ss SSH protocol version 2
210 .Pp
211 When a user connects using protocol version 2
212 similar authentication methods are available.
213 Using the default values for
214 .Cm PreferredAuthentications ,
215 the client will try to authenticate first using the hostbased method;
216 if this method fails public key authentication is attempted,
217 and finally if this method fails keyboard-interactive and
218 password authentication are tried.
219 .Pp
220 The public key method is similar to RSA authentication described
221 in the previous section and allows the RSA or DSA algorithm to be used:
222 The client uses his private key,
223 .Pa $HOME/.ssh/id_dsa
224 or
225 .Pa $HOME/.ssh/id_rsa ,
226 to sign the session identifier and sends the result to the server.
227 The server checks whether the matching public key is listed in
228 .Pa $HOME/.ssh/authorized_keys
229 and grants access if both the key is found and the signature is correct.
230 The session identifier is derived from a shared Diffie-Hellman value
231 and is only known to the client and the server.
232 .Pp
233 If public key authentication fails or is not available a password
234 can be sent encrypted to the remote host for proving the user's identity.
235 .Pp
236 Additionally,
237 .Nm
238 supports hostbased or challenge response authentication.
239 .Pp
240 Protocol 2 provides additional mechanisms for confidentiality
241 (the traffic is encrypted using 3DES, Blowfish, CAST128 or Arcfour)
242 and integrity (hmac-md5, hmac-sha1).
243 Note that protocol 1 lacks a strong mechanism for ensuring the
244 integrity of the connection.
245 .Pp
246 .Ss Login session and remote execution
247 .Pp
248 When the user's identity has been accepted by the server, the server
249 either executes the given command, or logs into the machine and gives
250 the user a normal shell on the remote machine.
251 All communication with
252 the remote command or shell will be automatically encrypted.
253 .Pp
254 If a pseudo-terminal has been allocated (normal login session), the
255 user may use the escape characters noted below.
256 .Pp
257 If no pseudo tty has been allocated, the
258 session is transparent and can be used to reliably transfer binary
259 data.
260 On most systems, setting the escape character to
261 .Dq none
262 will also make the session transparent even if a tty is used.
263 .Pp
264 The session terminates when the command or shell on the remote
265 machine exits and all X11 and TCP/IP connections have been closed.
266 The exit status of the remote program is returned as the exit status
267 of
268 .Nm ssh .
269 .Pp
270 .Ss Escape Characters
271 .Pp
272 When a pseudo terminal has been requested, ssh supports a number of functions
273 through the use of an escape character.
274 .Pp
275 A single tilde character can be sent as
276 .Ic ~~
277 or by following the tilde by a character other than those described below.
278 The escape character must always follow a newline to be interpreted as
279 special.
280 The escape character can be changed in configuration files using the
281 .Cm EscapeChar
282 configuration directive or on the command line by the
283 .Fl e
284 option.
285 .Pp
286 The supported escapes (assuming the default
287 .Ql ~ )
288 are:
289 .Bl -tag -width Ds
290 .It Cm ~.
291 Disconnect
292 .It Cm ~^Z
293 Background ssh
294 .It Cm ~#
295 List forwarded connections
296 .It Cm ~&
297 Background ssh at logout when waiting for forwarded connection / X11 sessions
298 to terminate
299 .It Cm ~?
300 Display a list of escape characters
301 .It Cm ~C
302 Open command line (only useful for adding port forwardings using the
303 .Fl L
304 and
305 .Fl R
306 options)
307 .It Cm ~R
308 Request rekeying of the connection (only useful for SSH protocol version 2
309 and if the peer supports it)
310 .El
311 .Pp
312 .Ss X11 and TCP forwarding
313 .Pp
314 If the
315 .Cm ForwardX11
316 variable is set to
317 .Dq yes
318 (or, see the description of the
319 .Fl X
320 and
321 .Fl x
322 options described later)
323 and the user is using X11 (the
324 .Ev DISPLAY
325 environment variable is set), the connection to the X11 display is
326 automatically forwarded to the remote side in such a way that any X11
327 programs started from the shell (or command) will go through the
328 encrypted channel, and the connection to the real X server will be made
329 from the local machine.
330 The user should not manually set
331 .Ev DISPLAY .
332 Forwarding of X11 connections can be
333 configured on the command line or in configuration files.
334 Take note that X11 forwarding can represent a security hazard.
335 .Pp
336 The
337 .Ev DISPLAY
338 value set by
339 .Nm
340 will point to the server machine, but with a display number greater
341 than zero.
342 This is normal, and happens because
343 .Nm
344 creates a
345 .Dq proxy
346 X server on the server machine for forwarding the
347 connections over the encrypted channel.
348 .Pp
349 .Nm
350 will also automatically set up Xauthority data on the server machine.
351 For this purpose, it will generate a random authorization cookie,
352 store it in Xauthority on the server, and verify that any forwarded
353 connections carry this cookie and replace it by the real cookie when
354 the connection is opened.
355 The real authentication cookie is never
356 sent to the server machine (and no cookies are sent in the plain).
357 .Pp
358 If the
359 .Cm ForwardAgent
360 variable is set to
361 .Dq yes
362 (or, see the description of the
363 .Fl A
364 and
365 .Fl a
366 options described later) and 
367 the user is using an authentication agent, the connection to the agent
368 is automatically forwarded to the remote side.
369 .Pp
370 Forwarding of arbitrary TCP/IP connections over the secure channel can
371 be specified either on the command line or in a configuration file.
372 One possible application of TCP/IP forwarding is a secure connection to an
373 electronic purse; another is going through firewalls.
374 .Pp
375 .Ss Server authentication
376 .Pp
377 .Nm
378 automatically maintains and checks a database containing
379 identifications for all hosts it has ever been used with.
380 Host keys are stored in
381 .Pa $HOME/.ssh/known_hosts
382 in the user's home directory.
383 Additionally, the file
384 .Pa /etc/ssh/ssh_known_hosts
385 is automatically checked for known hosts.
386 Any new hosts are automatically added to the user's file.
387 If a host's identification
388 ever changes,
389 .Nm
390 warns about this and disables password authentication to prevent a
391 trojan horse from getting the user's password.
392 Another purpose of
393 this mechanism is to prevent man-in-the-middle attacks which could
394 otherwise be used to circumvent the encryption.
395 The
396 .Cm StrictHostKeyChecking
397 option can be used to prevent logins to machines whose
398 host key is not known or has changed.
399 .Pp
400 The options are as follows:
401 .Bl -tag -width Ds
402 .It Fl a
403 Disables forwarding of the authentication agent connection.
404 .It Fl A
405 Enables forwarding of the authentication agent connection.
406 This can also be specified on a per-host basis in a configuration file.
407 .Pp
408 Agent forwarding should be enabled with caution.  Users with the
409 ability to bypass file permissions on the remote host (for the agent's
410 Unix-domain socket) can access the local agent through the forwarded
411 connection.  An attacker cannot obtain key material from the agent,
412 however they can perform operations on the keys that enable them to
413 authenticate using the identities loaded into the agent.
414 .It Fl b Ar bind_address
415 Specify the interface to transmit from on machines with multiple
416 interfaces or aliased addresses.
417 .It Fl c Ar blowfish|3des|des
418 Selects the cipher to use for encrypting the session.
419 .Ar 3des
420 is used by default.
421 It is believed to be secure.
422 .Ar 3des
423 (triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
424 .Ar blowfish
425 is a fast block cipher, it appears very secure and is much faster than
426 .Ar 3des .
427 .Ar des
428 is only supported in the
429 .Nm
430 client for interoperability with legacy protocol 1 implementations
431 that do not support the
432 .Ar 3des
433 cipher.  Its use is strongly discouraged due to cryptographic
434 weaknesses.
435 .It Fl c Ar cipher_spec
436 Additionally, for protocol version 2 a comma-separated list of ciphers can
437 be specified in order of preference.
438 See
439 .Cm Ciphers
440 for more information.
441 .It Fl e Ar ch|^ch|none
442 Sets the escape character for sessions with a pty (default:
443 .Ql ~ ) .
444 The escape character is only recognized at the beginning of a line.
445 The escape character followed by a dot
446 .Pq Ql \&.
447 closes the connection, followed
448 by control-Z suspends the connection, and followed by itself sends the
449 escape character once.
450 Setting the character to
451 .Dq none
452 disables any escapes and makes the session fully transparent.
453 .It Fl f
454 Requests
455 .Nm
456 to go to background just before command execution.
457 This is useful if
458 .Nm
459 is going to ask for passwords or passphrases, but the user
460 wants it in the background.
461 This implies
462 .Fl n .
463 The recommended way to start X11 programs at a remote site is with
464 something like
465 .Ic ssh -f host xterm .
466 .It Fl g
467 Allows remote hosts to connect to local forwarded ports.
468 .It Fl i Ar identity_file
469 Selects a file from which the identity (private key) for
470 RSA or DSA authentication is read.
471 The default is
472 .Pa $HOME/.ssh/identity
473 for protocol version 1, and
474 .Pa $HOME/.ssh/id_rsa
475 and
476 .Pa $HOME/.ssh/id_dsa
477 for protocol version 2.
478 Identity files may also be specified on
479 a per-host basis in the configuration file.
480 It is possible to have multiple
481 .Fl i
482 options (and multiple identities specified in
483 configuration files).
484 .It Fl I Ar smartcard_device
485 Specifies which smartcard device to use. The argument is
486 the device
487 .Nm
488 should use to communicate with a smartcard used for storing the user's
489 private RSA key.
490 .It Fl k
491 Disables forwarding of Kerberos tickets and AFS tokens.
492 This may also be specified on a per-host basis in the configuration file.
493 .It Fl l Ar login_name
494 Specifies the user to log in as on the remote machine.
495 This also may be specified on a per-host basis in the configuration file.
496 .It Fl m Ar mac_spec
497 Additionally, for protocol version 2 a comma-separated list of MAC
498 (message authentication code) algorithms can
499 be specified in order of preference.
500 See the
501 .Cm MACs
502 keyword for more information.
503 .It Fl n
504 Redirects stdin from
505 .Pa /dev/null
506 (actually, prevents reading from stdin).
507 This must be used when
508 .Nm
509 is run in the background.
510 A common trick is to use this to run X11 programs on a remote machine.
511 For example,
512 .Ic ssh -n shadows.cs.hut.fi emacs &
513 will start an emacs on shadows.cs.hut.fi, and the X11
514 connection will be automatically forwarded over an encrypted channel.
515 The
516 .Nm
517 program will be put in the background.
518 (This does not work if
519 .Nm
520 needs to ask for a password or passphrase; see also the
521 .Fl f
522 option.)
523 .It Fl N
524 Do not execute a remote command.
525 This is useful for just forwarding ports
526 (protocol version 2 only).
527 .It Fl o Ar option
528 Can be used to give options in the format used in the configuration file.
529 This is useful for specifying options for which there is no separate
530 command-line flag.
531 .It Fl p Ar port
532 Port to connect to on the remote host.
533 This can be specified on a
534 per-host basis in the configuration file.
535 .It Fl q
536 Quiet mode.
537 Causes all warning and diagnostic messages to be suppressed.
538 .It Fl s
539 May be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the use
540 of SSH as a secure transport for other applications (eg. sftp). The
541 subsystem is specified as the remote command.
542 .It Fl t
543 Force pseudo-tty allocation.
544 This can be used to execute arbitrary
545 screen-based programs on a remote machine, which can be very useful,
546 e.g., when implementing menu services.
547 Multiple
548 .Fl t
549 options force tty allocation, even if
550 .Nm
551 has no local tty.
552 .It Fl T
553 Disable pseudo-tty allocation.
554 .It Fl v
555 Verbose mode.
556 Causes
557 .Nm
558 to print debugging messages about its progress.
559 This is helpful in
560 debugging connection, authentication, and configuration problems.
561 Multiple
562 .Fl v
563 options increases the verbosity.
564 Maximum is 3.
565 .It Fl x
566 Disables X11 forwarding.
567 .It Fl X
568 Enables X11 forwarding.
569 This can also be specified on a per-host basis in a configuration file.
570 .Pp
571 X11 forwarding should be enabled with caution.  Users with the ability
572 to bypass file permissions on the remote host (for the user's X
573 authorization database) can access the local X11 display through the
574 forwarded connection.  An attacker may then be able to perform
575 activities such as keystroke monitoring.
576 .It Fl C
577 Requests compression of all data (including stdin, stdout, stderr, and
578 data for forwarded X11 and TCP/IP connections).
579 The compression algorithm is the same used by
580 .Xr gzip 1 ,
581 and the
582 .Dq level
583 can be controlled by the
584 .Cm CompressionLevel
585 option for protocol version 1.
586 Compression is desirable on modem lines and other
587 slow connections, but will only slow down things on fast networks.
588 The default value can be set on a host-by-host basis in the
589 configuration files; see the
590 .Cm Compression
591 option.
592 .It Fl F Ar configfile
593 Specifies an alternative per-user configuration file.
594 If a configuration file is given on the command line,
595 the system-wide configuration file
596 .Pq Pa /etc/ssh/ssh_config
597 will be ignored.
598 The default for the per-user configuration file is
599 .Pa $HOME/.ssh/config .
600 .It Fl L Ar port:host:hostport
601 Specifies that the given port on the local (client) host is to be
602 forwarded to the given host and port on the remote side.
603 This works by allocating a socket to listen to
604 .Ar port
605 on the local side, and whenever a connection is made to this port, the
606 connection is forwarded over the secure channel, and a connection is
607 made to
608 .Ar host
609 port
610 .Ar hostport
611 from the remote machine.
612 Port forwardings can also be specified in the configuration file.
613 Only root can forward privileged ports.
614 IPv6 addresses can be specified with an alternative syntax:
615 .Ar port/host/hostport
616 .It Fl R Ar port:host:hostport
617 Specifies that the given port on the remote (server) host is to be
618 forwarded to the given host and port on the local side.
619 This works by allocating a socket to listen to
620 .Ar port
621 on the remote side, and whenever a connection is made to this port, the
622 connection is forwarded over the secure channel, and a connection is
623 made to
624 .Ar host
625 port
626 .Ar hostport
627 from the local machine.
628 Port forwardings can also be specified in the configuration file.
629 Privileged ports can be forwarded only when
630 logging in as root on the remote machine.
631 IPv6 addresses can be specified with an alternative syntax:
632 .Ar port/host/hostport
633 .It Fl D Ar port
634 Specifies a local
635 .Dq dynamic
636 application-level port forwarding.
637 This works by allocating a socket to listen to
638 .Ar port
639 on the local side, and whenever a connection is made to this port, the
640 connection is forwarded over the secure channel, and the application
641 protocol is then used to determine where to connect to from the
642 remote machine.  Currently the SOCKS4 protocol is supported, and
643 .Nm
644 will act as a SOCKS4 server.
645 Only root can forward privileged ports.
646 Dynamic port forwardings can also be specified in the configuration file.
647 .It Fl 1
648 Forces
649 .Nm
650 to try protocol version 1 only.
651 .It Fl 2
652 Forces
653 .Nm
654 to try protocol version 2 only.
655 .It Fl 4
656 Forces
657 .Nm
658 to use IPv4 addresses only.
659 .It Fl 6
660 Forces
661 .Nm
662 to use IPv6 addresses only.
663 .El
664 .Sh CONFIGURATION FILES
665 .Nm
666 may additionally obtain configuration data from
667 a per-user configuration file and a system-wide configuration file.
668 The file format and configuration options are described in
669 .Xr ssh_config 5 .
670 .Sh ENVIRONMENT
671 .Nm
672 will normally set the following environment variables:
673 .Bl -tag -width Ds
674 .It Ev DISPLAY
675 The
676 .Ev DISPLAY
677 variable indicates the location of the X11 server.
678 It is automatically set by
679 .Nm
680 to point to a value of the form
681 .Dq hostname:n
682 where hostname indicates
683 the host where the shell runs, and n is an integer \*(>= 1.
684 .Nm
685 uses this special value to forward X11 connections over the secure
686 channel.
687 The user should normally not set
688 .Ev DISPLAY
689 explicitly, as that
690 will render the X11 connection insecure (and will require the user to
691 manually copy any required authorization cookies).
692 .It Ev HOME
693 Set to the path of the user's home directory.
694 .It Ev LOGNAME
695 Synonym for
696 .Ev USER ;
697 set for compatibility with systems that use this variable.
698 .It Ev MAIL
699 Set to the path of the user's mailbox.
700 .It Ev PATH
701 Set to the default
702 .Ev PATH ,
703 as specified when compiling
704 .Nm ssh .
705 .It Ev SSH_ASKPASS
706 If
707 .Nm
708 needs a passphrase, it will read the passphrase from the current
709 terminal if it was run from a terminal.
710 If
711 .Nm
712 does not have a terminal associated with it but
713 .Ev DISPLAY
714 and
715 .Ev SSH_ASKPASS
716 are set, it will execute the program specified by
717 .Ev SSH_ASKPASS
718 and open an X11 window to read the passphrase.
719 This is particularly useful when calling
720 .Nm
721 from a
722 .Pa .Xsession
723 or related script.
724 (Note that on some machines it
725 may be necessary to redirect the input from
726 .Pa /dev/null
727 to make this work.)
728 .It Ev SSH_AUTH_SOCK
729 Identifies the path of a unix-domain socket used to communicate with the
730 agent.
731 .It Ev SSH_CONNECTION
732 Identifies the client and server ends of the connection.
733 The variable contains
734 four space-separated values: client ip-address, client port number,
735 server ip-address and server port number.
736 .It Ev SSH_ORIGINAL_COMMAND
737 The variable contains the original command line if a forced command
738 is executed.
739 It can be used to extract the original arguments.
740 .It Ev SSH_TTY
741 This is set to the name of the tty (path to the device) associated
742 with the current shell or command.
743 If the current session has no tty,
744 this variable is not set.
745 .It Ev TZ
746 The timezone variable is set to indicate the present timezone if it
747 was set when the daemon was started (i.e., the daemon passes the value
748 on to new connections).
749 .It Ev USER
750 Set to the name of the user logging in.
751 .El
752 .Pp
753 Additionally,
754 .Nm
755 reads
756 .Pa $HOME/.ssh/environment ,
757 and adds lines of the format
758 .Dq VARNAME=value
759 to the environment if the file exists and if users are allowed to
760 change their environment.
761 See the
762 .Cm PermitUserEnvironment
763 option in
764 .Xr sshd_config 5 .
765 .Sh FILES
766 .Bl -tag -width Ds
767 .It Pa $HOME/.ssh/known_hosts
768 Records host keys for all hosts the user has logged into that are not
769 in
770 .Pa /etc/ssh/ssh_known_hosts .
771 See
772 .Xr sshd 8 .
773 .It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa
774 Contains the authentication identity of the user.
775 They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively.
776 These files
777 contain sensitive data and should be readable by the user but not
778 accessible by others (read/write/execute).
779 Note that
780 .Nm
781 ignores a private key file if it is accessible by others.
782 It is possible to specify a passphrase when
783 generating the key; the passphrase will be used to encrypt the
784 sensitive part of this file using 3DES.
785 .It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub
786 Contains the public key for authentication (public part of the
787 identity file in human-readable form).
788 The contents of the
789 .Pa $HOME/.ssh/identity.pub
790 file should be added to
791 .Pa $HOME/.ssh/authorized_keys
792 on all machines
793 where the user wishes to log in using protocol version 1 RSA authentication.
794 The contents of the
795 .Pa $HOME/.ssh/id_dsa.pub
796 and
797 .Pa $HOME/.ssh/id_rsa.pub
798 file should be added to
799 .Pa $HOME/.ssh/authorized_keys
800 on all machines
801 where the user wishes to log in using protocol version 2 DSA/RSA authentication.
802 These files are not
803 sensitive and can (but need not) be readable by anyone.
804 These files are
805 never used automatically and are not necessary; they are only provided for
806 the convenience of the user.
807 .It Pa $HOME/.ssh/config
808 This is the per-user configuration file.
809 The file format and configuration options are described in
810 .Xr ssh_config 5 .
811 .It Pa $HOME/.ssh/authorized_keys
812 Lists the public keys (RSA/DSA) that can be used for logging in as this user.
813 The format of this file is described in the
814 .Xr sshd 8
815 manual page.
816 In the simplest form the format is the same as the .pub
817 identity files.
818 This file is not highly sensitive, but the recommended
819 permissions are read/write for the user, and not accessible by others.
820 .It Pa /etc/ssh/ssh_known_hosts
821 Systemwide list of known host keys.
822 This file should be prepared by the
823 system administrator to contain the public host keys of all machines in the
824 organization.
825 This file should be world-readable.
826 This file contains
827 public keys, one per line, in the following format (fields separated
828 by spaces): system name, public key and optional comment field.
829 When different names are used
830 for the same machine, all such names should be listed, separated by
831 commas.
832 The format is described on the
833 .Xr sshd 8
834 manual page.
835 .Pp
836 The canonical system name (as returned by name servers) is used by
837 .Xr sshd 8
838 to verify the client host when logging in; other names are needed because
839 .Nm
840 does not convert the user-supplied name to a canonical name before
841 checking the key, because someone with access to the name servers
842 would then be able to fool host authentication.
843 .It Pa /etc/ssh/ssh_config
844 Systemwide configuration file.
845 The file format and configuration options are described in
846 .Xr ssh_config 5 .
847 .It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
848 These three files contain the private parts of the host keys
849 and are used for
850 .Cm RhostsRSAAuthentication
851 and
852 .Cm HostbasedAuthentication .
853 If the protocol version 1
854 .Cm RhostsRSAAuthentication
855 method is used,
856 .Nm
857 must be setuid root, since the host key is readable only by root.
858 For protocol version 2,
859 .Nm
860 uses
861 .Xr ssh-keysign 8
862 to access the host keys for
863 .Cm HostbasedAuthentication .
864 This eliminates the requirement that
865 .Nm
866 be setuid root when that authentication method is used.
867 By default
868 .Nm
869 is not setuid root.
870 .It Pa $HOME/.rhosts
871 This file is used in
872 .Pa \&.rhosts
873 authentication to list the
874 host/user pairs that are permitted to log in.
875 (Note that this file is
876 also used by rlogin and rsh, which makes using this file insecure.)
877 Each line of the file contains a host name (in the canonical form
878 returned by name servers), and then a user name on that host,
879 separated by a space.
880 On some machines this file may need to be
881 world-readable if the user's home directory is on a NFS partition,
882 because
883 .Xr sshd 8
884 reads it as root.
885 Additionally, this file must be owned by the user,
886 and must not have write permissions for anyone else.
887 The recommended
888 permission for most machines is read/write for the user, and not
889 accessible by others.
890 .Pp
891 Note that by default
892 .Xr sshd 8
893 will be installed so that it requires successful RSA host
894 authentication before permitting \s+2.\s0rhosts authentication.
895 If the server machine does not have the client's host key in
896 .Pa /etc/ssh/ssh_known_hosts ,
897 it can be stored in
898 .Pa $HOME/.ssh/known_hosts .
899 The easiest way to do this is to
900 connect back to the client from the server machine using ssh; this
901 will automatically add the host key to
902 .Pa $HOME/.ssh/known_hosts .
903 .It Pa $HOME/.shosts
904 This file is used exactly the same way as
905 .Pa \&.rhosts .
906 The purpose for
907 having this file is to be able to use rhosts authentication with
908 .Nm
909 without permitting login with
910 .Nm rlogin
911 or
912 .Xr rsh 1 .
913 .It Pa /etc/hosts.equiv
914 This file is used during
915 .Pa \&.rhosts
916 authentication.
917 It contains
918 canonical hosts names, one per line (the full format is described on
919 the
920 .Xr sshd 8
921 manual page).
922 If the client host is found in this file, login is
923 automatically permitted provided client and server user names are the
924 same.
925 Additionally, successful RSA host authentication is normally
926 required.
927 This file should only be writable by root.
928 .It Pa /etc/ssh/shosts.equiv
929 This file is processed exactly as
930 .Pa /etc/hosts.equiv .
931 This file may be useful to permit logins using
932 .Nm
933 but not using rsh/rlogin.
934 .It Pa /etc/ssh/sshrc
935 Commands in this file are executed by
936 .Nm
937 when the user logs in just before the user's shell (or command) is started.
938 See the
939 .Xr sshd 8
940 manual page for more information.
941 .It Pa $HOME/.ssh/rc
942 Commands in this file are executed by
943 .Nm
944 when the user logs in just before the user's shell (or command) is
945 started.
946 See the
947 .Xr sshd 8
948 manual page for more information.
949 .It Pa $HOME/.ssh/environment
950 Contains additional definitions for environment variables, see section
951 .Sx ENVIRONMENT
952 above.
953 .El
954 .Sh DIAGNOSTICS
955 .Nm
956 exits with the exit status of the remote command or with 255
957 if an error occurred.
958 .Sh AUTHORS
959 OpenSSH is a derivative of the original and free
960 ssh 1.2.12 release by Tatu Ylonen.
961 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
962 Theo de Raadt and Dug Song
963 removed many bugs, re-added newer features and
964 created OpenSSH.
965 Markus Friedl contributed the support for SSH
966 protocol versions 1.5 and 2.0.
967 .Sh SEE ALSO
968 .Xr rsh 1 ,
969 .Xr scp 1 ,
970 .Xr sftp 1 ,
971 .Xr ssh-add 1 ,
972 .Xr ssh-agent 1 ,
973 .Xr ssh-keygen 1 ,
974 .Xr telnet 1 ,
975 .Xr ssh_config 5 ,
976 .Xr ssh-keysign 8 ,
977 .Xr sshd 8
978 .Rs
979 .%A T. Ylonen
980 .%A T. Kivinen
981 .%A M. Saarinen
982 .%A T. Rinne
983 .%A S. Lehtinen
984 .%T "SSH Protocol Architecture"
985 .%N draft-ietf-secsh-architecture-12.txt
986 .%D January 2002
987 .%O work in progress material
988 .Re