xref: /freebsd/crypto/openssh/ssh.1 (revision c68159a6d8eede11766cf13896d0f7670dbd51aa)
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.\" $FreeBSD$
38.\"
39.Dd September 25, 1999
40.Dt SSH 1
41.Os
42.Sh NAME
43.Nm ssh
44.Nd OpenSSH secure shell client (remote login program)
45.Sh SYNOPSIS
46.Nm ssh
47.Op Fl l Ar login_name
48.Op Ar hostname | user@hostname
49.Op Ar command
50.Pp
51.Nm ssh
52.Op Fl afgknqtvxACNPTX246
53.Op Fl c Ar cipher_spec
54.Op Fl e Ar escape_char
55.Op Fl i Ar identity_file
56.Op Fl l Ar login_name
57.Op Fl o Ar option
58.Op Fl p Ar port
59.Oo Fl L Xo
60.Sm off
61.Ar port :
62.Ar host :
63.Ar hostport
64.Sm on
65.Xc
66.Oc
67.Oo Fl R Xo
68.Sm off
69.Ar port :
70.Ar host :
71.Ar hostport
72.Sm on
73.Xc
74.Oc
75.Op Ar hostname | user@hostname
76.Op Ar command
77.Sh DESCRIPTION
78.Nm
79(Secure Shell) is a program for logging into a remote machine and for
80executing commands on a remote machine.
81It is intended to replace
82rlogin and rsh, and provide secure encrypted communications between
83two untrusted hosts over an insecure network.
84X11 connections and
85arbitrary TCP/IP ports can also be forwarded over the secure channel.
86.Pp
87.Nm
88connects and logs into the specified
89.Ar hostname .
90The user must prove
91his/her identity to the remote machine using one of several methods
92depending on the protocol version used:
93.Pp
94.Ss SSH protocol version 1
95.Pp
96First, if the machine the user logs in from is listed in
97.Pa /etc/hosts.equiv
98or
99.Pa /etc/ssh/shosts.equiv
100on the remote machine, and the user names are
101the same on both sides, the user is immediately permitted to log in.
102Second, if
103.Pa \&.rhosts
104or
105.Pa \&.shosts
106exists in the user's home directory on the
107remote machine and contains a line containing the name of the client
108machine and the name of the user on that machine, the user is
109permitted to log in.
110This form of authentication alone is normally not
111allowed by the server because it is not secure.
112.Pp
113The second (and primary) authentication method is the
114.Pa rhosts
115or
116.Pa hosts.equiv
117method combined with RSA-based host authentication.
118It means that if the login would be permitted by
119.Pa $HOME/.rhosts ,
120.Pa $HOME/.shosts ,
121.Pa /etc/hosts.equiv ,
122or
123.Pa /etc/ssh/shosts.equiv ,
124and if additionally the server can verify the client's
125host key (see
126.Pa /etc/ssh/ssh_known_hosts
127and
128.Pa $HOME/.ssh/known_hosts
129in the
130.Sx FILES
131section), only then login is permitted.
132This authentication method closes security holes due to IP
133spoofing, DNS spoofing and routing spoofing.
134[Note to the administrator:
135.Pa /etc/hosts.equiv ,
136.Pa $HOME/.rhosts ,
137and the rlogin/rsh protocol in general, are inherently insecure and should be
138disabled if security is desired.]
139.Pp
140As a third authentication method,
141.Nm
142supports RSA based authentication.
143The scheme is based on public-key cryptography: there are cryptosystems
144where encryption and decryption are done using separate keys, and it
145is not possible to derive the decryption key from the encryption key.
146RSA is one such system.
147The idea is that each user creates a public/private
148key pair for authentication purposes.
149The server knows the public key, and only the user knows the private key.
150The file
151.Pa $HOME/.ssh/authorized_keys
152lists the public keys that are permitted for logging
153in.
154When the user logs in, the
155.Nm
156program tells the server which key pair it would like to use for
157authentication.
158The server checks if this key is permitted, and if
159so, sends the user (actually the
160.Nm
161program running on behalf of the user) a challenge, a random number,
162encrypted by the user's public key.
163The challenge can only be
164decrypted using the proper private key.
165The user's client then decrypts the
166challenge using the private key, proving that he/she knows the private
167key but without disclosing it to the server.
168.Pp
169.Nm
170implements the RSA authentication protocol automatically.
171The user creates his/her RSA key pair by running
172.Xr ssh-keygen 1 .
173This stores the private key in
174.Pa $HOME/.ssh/identity
175and the public key in
176.Pa $HOME/.ssh/identity.pub
177in the user's home directory.
178The user should then copy the
179.Pa identity.pub
180to
181.Pa $HOME/.ssh/authorized_keys
182in his/her home directory on the remote machine (the
183.Pa authorized_keys
184file corresponds to the conventional
185.Pa $HOME/.rhosts
186file, and has one key
187per line, though the lines can be very long).
188After this, the user can log in without giving the password.
189RSA authentication is much
190more secure than rhosts authentication.
191.Pp
192The most convenient way to use RSA authentication may be with an
193authentication agent.
194See
195.Xr ssh-agent 1
196for more information.
197.Pp
198If other authentication methods fail,
199.Nm
200prompts the user for a password.
201The password is sent to the remote
202host for checking; however, since all communications are encrypted,
203the password cannot be seen by someone listening on the network.
204.Pp
205.Ss SSH protocol version 2
206.Pp
207When a user connects using the protocol version 2
208different authentication methods are available:
209At first, the client attempts to authenticate using the public key method.
210If this method fails password authentication is tried.
211.Pp
212The public key method is similar to RSA authentication described
213in the previous section except that the DSA algorithm is used
214instead of the patented RSA algorithm.
215The client uses his private DSA key
216.Pa $HOME/.ssh/id_dsa
217to sign the session identifier and sends the result to the server.
218The server checks whether the matching public key is listed in
219.Pa $HOME/.ssh/authorized_keys2
220and grants access if both the key is found and the signature is correct.
221The session identifier is derived from a shared Diffie-Hellman value
222and is only known to the client and the server.
223.Pp
224If public key authentication fails or is not available a password
225can be sent encrypted to the remote host for proving the user's identity.
226This protocol 2 implementation does not yet support Kerberos or
227OPIE authentication.
228.Pp
229Protocol 2 provides additional mechanisms for confidentiality
230(the traffic is encrypted using 3DES, Blowfish, CAST128 or Arcfour)
231and integrity (hmac-sha1, hmac-md5).
232Note that protocol 1 lacks a strong mechanism for ensuring the
233integrity of the connection.
234.Pp
235.Ss Login session and remote execution
236.Pp
237When the user's identity has been accepted by the server, the server
238either executes the given command, or logs into the machine and gives
239the user a normal shell on the remote machine.
240All communication with
241the remote command or shell will be automatically encrypted.
242.Pp
243If a pseudo-terminal has been allocated (normal login session), the
244user can disconnect with
245.Ic ~. ,
246and suspend
247.Nm
248with
249.Ic ~^Z .
250All forwarded connections can be listed with
251.Ic ~#
252and if
253the session blocks waiting for forwarded X11 or TCP/IP
254connections to terminate, it can be backgrounded with
255.Ic ~&
256(this should not be used while the user shell is active, as it can cause the
257shell to hang).
258All available escapes can be listed with
259.Ic ~? .
260.Pp
261A single tilde character can be sent as
262.Ic ~~
263(or by following the tilde by a character other than those described above).
264The escape character must always follow a newline to be interpreted as
265special.
266The escape character can be changed in configuration files
267or on the command line.
268.Pp
269If no pseudo tty has been allocated, the
270session is transparent and can be used to reliably transfer binary
271data.
272On most systems, setting the escape character to
273.Dq none
274will also make the session transparent even if a tty is used.
275.Pp
276The session terminates when the command or shell in on the remote
277machine exists and all X11 and TCP/IP connections have been closed.
278The exit status of the remote program is returned as the exit status
279of
280.Nm ssh .
281.Pp
282.Ss X11 and TCP forwarding
283.Pp
284If the user is using X11 (the
285.Ev DISPLAY
286environment variable is set), the connection to the X11 display can
287be forwarded to the remote side in such a way that any X11
288programs started from the shell (or command) will go through the
289encrypted channel, and the connection to the real X server will be made
290from the local machine.
291The user should not manually set
292.Ev DISPLAY .
293Forwarding of X11 connections weakens the security of ssh and is
294disabled by default.  X11 forwarding can be enabled on the command line
295or in configuration files.
296.Pp
297The
298.Ev DISPLAY
299value set by
300.Nm
301will point to the server machine, but with a display number greater
302than zero.
303This is normal, and happens because
304.Nm
305creates a
306.Dq proxy
307X server on the server machine for forwarding the
308connections over the encrypted channel.
309.Pp
310.Nm
311will also automatically set up Xauthority data on the server machine.
312For this purpose, it will generate a random authorization cookie,
313store it in Xauthority on the server, and verify that any forwarded
314connections carry this cookie and replace it by the real cookie when
315the connection is opened.
316The real authentication cookie is never
317sent to the server machine (and no cookies are sent in the plain).
318.Pp
319If the user is using an authentication agent, the connection to the agent
320is automatically forwarded to the remote side unless disabled on
321command line or in a configuration file.
322.Pp
323Forwarding of arbitrary TCP/IP connections over the secure channel can
324be specified either on command line or in a configuration file.
325One possible application of TCP/IP forwarding is a secure connection to an
326electronic purse; another is going trough firewalls.
327.Pp
328.Ss Server authentication
329.Pp
330.Nm
331automatically maintains and checks a database containing
332identifications for all hosts it has ever been used with.
333RSA host keys are stored in
334.Pa $HOME/.ssh/known_hosts
335and
336DSA host keys are stored in
337.Pa $HOME/.ssh/known_hosts2
338in the user's home directory.
339Additionally, the files
340.Pa /etc/ssh/ssh_known_hosts
341and
342.Pa /etc/ssh/ssh_known_hosts2
343are automatically checked for known hosts.
344Any new hosts are automatically added to the user's file.
345If a host's identification
346ever changes,
347.Nm
348warns about this and disables password authentication to prevent a
349trojan horse from getting the user's password.
350Another purpose of
351this mechanism is to prevent man-in-the-middle attacks which could
352otherwise be used to circumvent the encryption.
353The
354.Cm StrictHostKeyChecking
355option (see below) can be used to prevent logins to machines whose
356host key is not known or has changed.
357.Sh OPTIONS
358.Bl -tag -width Ds
359.It Fl a
360Disables forwarding of the authentication agent connection.
361.It Fl A
362Enables forwarding of the authentication agent connection.
363This can also be specified on a per-host basis in a configuration file.
364.It Fl c Ar blowfish|3des
365Selects the cipher to use for encrypting the session.
366.Ar 3des
367is used by default.
368It is believed to be secure.
369.Ar 3des
370(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
371It is presumably more secure than the
372.Ar des
373cipher which is no longer fully supported in
374.Nm ssh .
375.Ar blowfish
376is a fast block cipher, it appears very secure and is much faster than
377.Ar 3des .
378.It Fl c Ar "3des-cbc,blowfish-cbc,arcfour,cast128-cbc"
379Additionally, for protocol version 2 a comma-separated list of ciphers can
380be specified in order of preference.
381Protocol version 2 supports 3DES, Blowfish, and CAST128 in CBC mode
382and Arcfour.
383.It Fl e Ar ch|^ch|none
384Sets the escape character for sessions with a pty (default:
385.Ql ~ ) .
386The escape character is only recognized at the beginning of a line.
387The escape character followed by a dot
388.Pq Ql \&.
389closes the connection, followed
390by control-Z suspends the connection, and followed by itself sends the
391escape character once.
392Setting the character to
393.Dq none
394disables any escapes and makes the session fully transparent.
395.It Fl f
396Requests
397.Nm
398to go to background just before command execution.
399This is useful if
400.Nm
401is going to ask for passwords or passphrases, but the user
402wants it in the background.
403This implies
404.Fl n .
405The recommended way to start X11 programs at a remote site is with
406something like
407.Ic ssh -f host xterm .
408.It Fl g
409Allows remote hosts to connect to local forwarded ports.
410.It Fl i Ar identity_file
411Selects the file from which the identity (private key) for
412RSA authentication is read.
413Default is
414.Pa $HOME/.ssh/identity
415in the user's home directory.
416Identity files may also be specified on
417a per-host basis in the configuration file.
418It is possible to have multiple
419.Fl i
420options (and multiple identities specified in
421configuration files).
422.It Fl k
423Disables forwarding of Kerberos tickets and AFS tokens.
424This may also be specified on a per-host basis in the configuration file.
425.It Fl l Ar login_name
426Specifies the user to log in as on the remote machine.
427This also may be specified on a per-host basis in the configuration file.
428.It Fl n
429Redirects stdin from
430.Pa /dev/null
431(actually, prevents reading from stdin).
432This must be used when
433.Nm
434is run in the background.
435A common trick is to use this to run X11 programs on a remote machine.
436For example,
437.Ic ssh -n shadows.cs.hut.fi emacs &
438will start an emacs on shadows.cs.hut.fi, and the X11
439connection will be automatically forwarded over an encrypted channel.
440The
441.Nm
442program will be put in the background.
443(This does not work if
444.Nm
445needs to ask for a password or passphrase; see also the
446.Fl f
447option.)
448.It Fl N
449Do not execute a remote command.
450This is usefull if you just want to forward ports
451(protocol version 2 only).
452.It Fl o Ar option
453Can be used to give options in the format used in the config file.
454This is useful for specifying options for which there is no separate
455command-line flag.
456The option has the same format as a line in the configuration file.
457.It Fl p Ar port
458Port to connect to on the remote host.
459This can be specified on a
460per-host basis in the configuration file.
461.It Fl P
462Use a non-privileged port for outgoing connections.
463This can be used if your firewall does
464not permit connections from privileged ports.
465Note that this option turns off
466.Cm RhostsAuthentication
467and
468.Cm RhostsRSAAuthentication .
469.It Fl q
470Quiet mode.
471Causes all warning and diagnostic messages to be suppressed.
472Only fatal errors are displayed.
473.It Fl t
474Force pseudo-tty allocation.
475This can be used to execute arbitrary
476screen-based programs on a remote machine, which can be very useful,
477e.g., when implementing menu services.
478.It Fl T
479Disable pseudo-tty allocation (protocol version 2 only).
480.It Fl v
481Verbose mode.
482Causes
483.Nm
484to print debugging messages about its progress.
485This is helpful in
486debugging connection, authentication, and configuration problems.
487The verbose mode is also used to display
488.Xr skey 1
489challenges, if the user entered "s/key" as password.
490Multiple -v options increases the verbosity.
491Maximum is 3.
492.It Fl x
493Disables X11 forwarding.
494.It Fl X
495Enables X11 forwarding.
496This can also be specified on a per-host basis in a configuration file.
497.It Fl C
498Requests compression of all data (including stdin, stdout, stderr, and
499data for forwarded X11 and TCP/IP connections).
500The compression algorithm is the same used by
501.Xr gzip 1 ,
502and the
503.Dq level
504can be controlled by the
505.Cm CompressionLevel
506option (see below).
507Compression is desirable on modem lines and other
508slow connections, but will only slow down things on fast networks.
509The default value can be set on a host-by-host basis in the
510configuration files; see the
511.Cm Compress
512option below.
513.It Fl L Ar port:host:hostport
514Specifies that the given port on the local (client) host is to be
515forwarded to the given host and port on the remote side.
516This works by allocating a socket to listen to
517.Ar port
518on the local side, and whenever a connection is made to this port, the
519connection is forwarded over the secure channel, and a connection is
520made to
521.Ar host
522port
523.Ar hostport
524from the remote machine.
525Port forwardings can also be specified in the configuration file.
526Only root can forward privileged ports.
527IPv6 addresses can be specified with an alternative syntax:
528.Ar port/host/hostport
529.It Fl R Ar port:host:hostport
530Specifies that the given port on the remote (server) host is to be
531forwarded to the given host and port on the local side.
532This works by allocating a socket to listen to
533.Ar port
534on the remote side, and whenever a connection is made to this port, the
535connection is forwarded over the secure channel, and a connection is
536made to
537.Ar host
538port
539.Ar hostport
540from the local machine.
541Port forwardings can also be specified in the configuration file.
542Privileged ports can be forwarded only when
543logging in as root on the remote machine.
544.It Fl 2
545Forces
546.Nm
547to try protocol version 2 only.
548.It Fl 4
549Forces
550.Nm
551to use IPv4 addresses only.
552.It Fl 6
553Forces
554.Nm
555to use IPv6 addresses only.
556.El
557.Sh CONFIGURATION FILES
558.Nm
559obtains configuration data from the following sources (in this order):
560command line options, user's configuration file
561.Pq Pa $HOME/.ssh/config ,
562and system-wide configuration file
563.Pq Pa /etc/ssh/ssh_config .
564For each parameter, the first obtained value
565will be used.
566The configuration files contain sections bracketed by
567.Dq Host
568specifications, and that section is only applied for hosts that
569match one of the patterns given in the specification.
570The matched host name is the one given on the command line.
571.Pp
572Since the first obtained value for each parameter is used, more
573host-specific declarations should be given near the beginning of the
574file, and general defaults at the end.
575.Pp
576The configuration file has the following format:
577.Pp
578Empty lines and lines starting with
579.Ql #
580are comments.
581.Pp
582Otherwise a line is of the format
583.Dq keyword arguments .
584The possible
585keywords and their meanings are as follows (note that the
586configuration files are case-sensitive):
587.Bl -tag -width Ds
588.It Cm Host
589Restricts the following declarations (up to the next
590.Cm Host
591keyword) to be only for those hosts that match one of the patterns
592given after the keyword.
593.Ql \&*
594and
595.Ql ?
596can be used as wildcards in the
597patterns.
598A single
599.Ql \&*
600as a pattern can be used to provide global
601defaults for all hosts.
602The host is the
603.Ar hostname
604argument given on the command line (i.e., the name is not converted to
605a canonicalized host name before matching).
606.It Cm AFSTokenPassing
607Specifies whether to pass AFS tokens to remote host.
608The argument to this keyword must be
609.Dq yes
610or
611.Dq no .
612.It Cm BatchMode
613If set to
614.Dq yes ,
615passphrase/password querying will be disabled.
616This option is useful in scripts and other batch jobs where you have no
617user to supply the password.
618The argument must be
619.Dq yes
620or
621.Dq no .
622.It Cm CheckHostIP
623If this flag is set to
624.Dq yes ,
625ssh will additionally check the host ip address in the
626.Pa known_hosts
627file.
628This allows ssh to detect if a host key changed due to DNS spoofing.
629If the option is set to
630.Dq no ,
631the check will not be executed.
632.It Cm Cipher
633Specifies the cipher to use for encrypting the session
634in protocol version 1.
635Currently,
636.Dq blowfish
637and
638.Dq 3des
639are supported.
640The default is
641.Dq 3des .
642.It Cm Ciphers
643Specifies the ciphers allowed for protocol version 2
644in order of preference.
645Multiple ciphers must be comma-separated.
646The default is
647.Dq 3des-cbc,blowfish-cbc,cast128-cbc,arcfour .
648.It Cm Compression
649Specifies whether to use compression.
650The argument must be
651.Dq yes
652or
653.Dq no .
654.It Cm CompressionLevel
655Specifies the compression level to use if compression is enable.
656The argument must be an integer from 1 (fast) to 9 (slow, best).
657The default level is 6, which is good for most applications.
658The meaning of the values is the same as in
659.Xr gzip 1 .
660.It Cm ConnectionAttempts
661Specifies the number of tries (one per second) to make before falling
662back to rsh or exiting.
663The argument must be an integer.
664This may be useful in scripts if the connection sometimes fails.
665.It Cm DSAAuthentication
666Specifies whether to try DSA authentication.
667The argument to this keyword must be
668.Dq yes
669or
670.Dq no .
671DSA authentication will only be
672attempted if a DSA identity file exists.
673Note that this option applies to protocol version 2 only.
674.It Cm EscapeChar
675Sets the escape character (default:
676.Ql ~ ) .
677The escape character can also
678be set on the command line.
679The argument should be a single character,
680.Ql ^
681followed by a letter, or
682.Dq none
683to disable the escape
684character entirely (making the connection transparent for binary
685data).
686.It Cm FallBackToRsh
687Specifies that if connecting via
688.Nm
689fails due to a connection refused error (there is no
690.Xr sshd 8
691listening on the remote host),
692.Xr rsh 1
693should automatically be used instead (after a suitable warning about
694the session being unencrypted).
695The argument must be
696.Dq yes
697or
698.Dq no .
699.It Cm ForwardAgent
700Specifies whether the connection to the authentication agent (if any)
701will be forwarded to the remote machine.
702The argument must be
703.Dq yes
704or
705.Dq no .
706The default is
707.Dq no .
708.It Cm ForwardX11
709Specifies whether X11 connections will be automatically redirected
710over the secure channel and
711.Ev DISPLAY
712set.
713The argument must be
714.Dq yes
715or
716.Dq no .
717The default is
718.Dq no .
719.It Cm GatewayPorts
720Specifies whether remote hosts are allowed to connect to local
721forwarded ports.
722The argument must be
723.Dq yes
724or
725.Dq no .
726The default is
727.Dq no .
728.It Cm GlobalKnownHostsFile
729Specifies a file to use instead of
730.Pa /etc/ssh/ssh_known_hosts .
731.It Cm HostName
732Specifies the real host name to log into.
733This can be used to specify nicknames or abbreviations for hosts.
734Default is the name given on the command line.
735Numeric IP addresses are also permitted (both on the command line and in
736.Cm HostName
737specifications).
738.It Cm IdentityFile
739Specifies the file from which the user's RSA authentication identity
740is read (default
741.Pa $HOME/.ssh/identity
742in the user's home directory).
743Additionally, any identities represented by the authentication agent
744will be used for authentication.
745The file name may use the tilde
746syntax to refer to a user's home directory.
747It is possible to have
748multiple identity files specified in configuration files; all these
749identities will be tried in sequence.
750.It Cm IdentityFile2
751Specifies the file from which the user's DSA authentication identity
752is read (default
753.Pa $HOME/.ssh/id_dsa
754in the user's home directory).
755The file name may use the tilde
756syntax to refer to a user's home directory.
757It is possible to have
758multiple identity files specified in configuration files; all these
759identities will be tried in sequence.
760.It Cm KeepAlive
761Specifies whether the system should send keepalive messages to the
762other side.
763If they are sent, death of the connection or crash of one
764of the machines will be properly noticed.
765However, this means that
766connections will die if the route is down temporarily, and some people
767find it annoying.
768.Pp
769The default is
770.Dq yes
771(to send keepalives), and the client will notice
772if the network goes down or the remote host dies.
773This is important in scripts, and many users want it too.
774.Pp
775To disable keepalives, the value should be set to
776.Dq no
777in both the server and the client configuration files.
778.It Cm KerberosAuthentication
779Specifies whether Kerberos authentication will be used.
780The argument to this keyword must be
781.Dq yes
782or
783.Dq no .
784.It Cm KerberosTgtPassing
785Specifies whether a Kerberos TGT will be forwarded to the server.
786This will only work if the Kerberos server is actually an AFS kaserver.
787The argument to this keyword must be
788.Dq yes
789or
790.Dq no .
791.It Cm LocalForward
792Specifies that a TCP/IP port on the local machine be forwarded over
793the secure channel to given host:port from the remote machine.
794The first argument must be a port number, and the second must be
795host:port.
796Multiple forwardings may be specified, and additional
797forwardings can be given on the command line.
798Only the superuser can forward privileged ports.
799.It Cm LogLevel
800Gives the verbosity level that is used when logging messages from
801.Nm ssh .
802The possible values are:
803QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
804The default is INFO.
805.It Cm NumberOfPasswordPrompts
806Specifies the number of password prompts before giving up.
807The argument to this keyword must be an integer.
808Default is 3.
809.It Cm PasswordAuthentication
810Specifies whether to use password authentication.
811The argument to this keyword must be
812.Dq yes
813or
814.Dq no .
815Note that this option applies to both protocol version 1 and 2.
816.It Cm Port
817Specifies the port number to connect on the remote host.
818Default is 22.
819.It Cm Protocol
820Specifies the protocol versions
821.Nm
822should support in order of preference.
823The possible values are
824.Dq 1
825and
826.Dq 2 .
827Multiple versions must be comma-separated.
828The default is
829.Dq 1,2 .
830This means that
831.Nm
832tries version 1 and falls back to version 2
833if version 1 is not available.
834.It Cm ProxyCommand
835Specifies the command to use to connect to the server.
836The command
837string extends to the end of the line, and is executed with
838.Pa /bin/sh .
839In the command string,
840.Ql %h
841will be substituted by the host name to
842connect and
843.Ql %p
844by the port.
845The command can be basically anything,
846and should read from its standard input and write to its standard output.
847It should eventually connect an
848.Xr sshd 8
849server running on some machine, or execute
850.Ic sshd -i
851somewhere.
852Host key management will be done using the
853HostName of the host being connected (defaulting to the name typed by
854the user).
855Note that
856.Cm CheckHostIP
857is not available for connects with a proxy command.
858.Pp
859.It Cm RemoteForward
860Specifies that a TCP/IP port on the remote machine be forwarded over
861the secure channel to given host:port from the local machine.
862The first argument must be a port number, and the second must be
863host:port.
864Multiple forwardings may be specified, and additional
865forwardings can be given on the command line.
866Only the superuser can forward privileged ports.
867.It Cm RhostsAuthentication
868Specifies whether to try rhosts based authentication.
869Note that this
870declaration only affects the client side and has no effect whatsoever
871on security.
872Disabling rhosts authentication may reduce
873authentication time on slow connections when rhosts authentication is
874not used.
875Most servers do not permit RhostsAuthentication because it
876is not secure (see RhostsRSAAuthentication).
877The argument to this keyword must be
878.Dq yes
879or
880.Dq no .
881.It Cm RhostsRSAAuthentication
882Specifies whether to try rhosts based authentication with RSA host
883authentication.
884This is the primary authentication method for most sites.
885The argument must be
886.Dq yes
887or
888.Dq no .
889.It Cm RSAAuthentication
890Specifies whether to try RSA authentication.
891The argument to this keyword must be
892.Dq yes
893or
894.Dq no .
895RSA authentication will only be
896attempted if the identity file exists, or an authentication agent is
897running.
898Note that this option applies to protocol version 1 only.
899.It Cm SkeyAuthentication
900Specifies whether to use
901.Xr skey 1
902authentication.
903The argument to this keyword must be
904.Dq yes
905or
906.Dq no .
907The default is
908.Dq no .
909.It Cm StrictHostKeyChecking
910If this flag is set to
911.Dq yes ,
912.Nm
913ssh will never automatically add host keys to the
914.Pa $HOME/.ssh/known_hosts
915and
916.Pa $HOME/.ssh/known_hosts2
917files, and refuses to connect hosts whose host key has changed.
918This provides maximum protection against trojan horse attacks.
919However, it can be somewhat annoying if you don't have good
920.Pa /etc/ssh/ssh_known_hosts
921and
922.Pa /etc/ssh/ssh_known_hosts2
923files installed and frequently
924connect new hosts.
925Basically this option forces the user to manually
926add any new hosts.
927Normally this option is disabled, and new hosts
928will automatically be added to the known host files.
929The host keys of
930known hosts will be verified automatically in either case.
931The argument must be
932.Dq yes
933or
934.Dq no .
935.It Cm UsePrivilegedPort
936Specifies whether to use a privileged port for outgoing connections.
937The argument must be
938.Dq yes
939or
940.Dq no .
941The default is
942.Dq yes .
943Note that setting this option to
944.Dq no
945turns off
946.Cm RhostsAuthentication
947and
948.Cm RhostsRSAAuthentication .
949.It Cm User
950Specifies the user to log in as.
951This can be useful if you have a different user name on different machines.
952This saves the trouble of
953having to remember to give the user name on the command line.
954.It Cm UserKnownHostsFile
955Specifies a file to use instead of
956.Pa $HOME/.ssh/known_hosts .
957.It Cm UseRsh
958Specifies that rlogin/rsh should be used for this host.
959It is possible that the host does not at all support the
960.Nm
961protocol.
962This causes
963.Nm
964to immediately execute
965.Xr rsh 1 .
966All other options (except
967.Cm HostName )
968are ignored if this has been specified.
969The argument must be
970.Dq yes
971or
972.Dq no .
973.It Cm XAuthLocation
974Specifies the location of the
975.Xr xauth 1
976program.
977The default is
978.Pa /usr/X11R6/bin/xauth .
979.El
980.Sh ENVIRONMENT
981.Nm
982will normally set the following environment variables:
983.Bl -tag -width Ds
984.It Ev DISPLAY
985The
986.Ev DISPLAY
987variable indicates the location of the X11 server.
988It is automatically set by
989.Nm
990to point to a value of the form
991.Dq hostname:n
992where hostname indicates
993the host where the shell runs, and n is an integer \*(>= 1.
994.Nm
995uses this special value to forward X11 connections over the secure
996channel.
997The user should normally not set DISPLAY explicitly, as that
998will render the X11 connection insecure (and will require the user to
999manually copy any required authorization cookies).
1000.It Ev HOME
1001Set to the path of the user's home directory.
1002.It Ev LOGNAME
1003Synonym for
1004.Ev USER ;
1005set for compatibility with systems that use this variable.
1006.It Ev MAIL
1007Set to point the user's mailbox.
1008.It Ev PATH
1009Set to the default
1010.Ev PATH ,
1011as specified when compiling
1012.Nm ssh .
1013.It Ev SSH_AUTH_SOCK
1014indicates the path of a unix-domain socket used to communicate with the
1015agent.
1016.It Ev SSH_CLIENT
1017Identifies the client end of the connection.
1018The variable contains
1019three space-separated values: client ip-address, client port number,
1020and server port number.
1021.It Ev SSH_TTY
1022This is set to the name of the tty (path to the device) associated
1023with the current shell or command.
1024If the current session has no tty,
1025this variable is not set.
1026.It Ev TZ
1027The timezone variable is set to indicate the present timezone if it
1028was set when the daemon was started (i.e., the daemon passes the value
1029on to new connections).
1030.It Ev USER
1031Set to the name of the user logging in.
1032.El
1033.Pp
1034Additionally,
1035.Nm
1036reads
1037.Pa $HOME/.ssh/environment ,
1038and adds lines of the format
1039.Dq VARNAME=value
1040to the environment.
1041.Sh FILES
1042.Bl -tag -width Ds
1043.It Pa $HOME/.ssh/known_hosts
1044Records host keys for all hosts the user has logged into (that are not
1045in
1046.Pa /etc/ssh/ssh_known_hosts ) .
1047See
1048.Xr sshd 8 .
1049.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa
1050Contains the RSA and the DSA authentication identity of the user.
1051These files
1052contain sensitive data and should be readable by the user but not
1053accessible by others (read/write/execute).
1054Note that
1055.Nm
1056ignores a private key file if it is accessible by others.
1057It is possible to specify a passphrase when
1058generating the key; the passphrase will be used to encrypt the
1059sensitive part of this file using 3DES.
1060.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub
1061Contains the public key for authentication (public part of the
1062identity file in human-readable form).
1063The contents of the
1064.Pa $HOME/.ssh/identity.pub
1065file should be added to
1066.Pa $HOME/.ssh/authorized_keys
1067on all machines
1068where you wish to log in using RSA authentication.
1069The contents of the
1070.Pa $HOME/.ssh/id_dsa.pub
1071file should be added to
1072.Pa $HOME/.ssh/authorized_keys2
1073on all machines
1074where you wish to log in using DSA authentication.
1075These files are not
1076sensitive and can (but need not) be readable by anyone.
1077These files are
1078never used automatically and are not necessary; they are only provided for
1079the convenience of the user.
1080.It Pa $HOME/.ssh/config
1081This is the per-user configuration file.
1082The format of this file is described above.
1083This file is used by the
1084.Nm
1085client.
1086This file does not usually contain any sensitive information,
1087but the recommended permissions are read/write for the user, and not
1088accessible by others.
1089.It Pa $HOME/.ssh/authorized_keys
1090Lists the RSA keys that can be used for logging in as this user.
1091The format of this file is described in the
1092.Xr sshd 8
1093manual page.
1094In the simplest form the format is the same as the .pub
1095identity files (that is, each line contains the number of bits in
1096modulus, public exponent, modulus, and comment fields, separated by
1097spaces).
1098This file is not highly sensitive, but the recommended
1099permissions are read/write for the user, and not accessible by others.
1100.It Pa $HOME/.ssh/authorized_keys2
1101Lists the DSA keys that can be used for logging in as this user.
1102This file is not highly sensitive, but the recommended
1103permissions are read/write for the user, and not accessible by others.
1104.It Pa /etc/ssh/ssh_known_hosts, /etc/ssh/ssh_known_hosts2
1105Systemwide list of known host keys.
1106.Pa /etc/ssh_known_hosts
1107contains RSA and
1108.Pa /etc/ssh_known_hosts2
1109contains DSA keys.
1110These files should be prepared by the
1111system administrator to contain the public host keys of all machines in the
1112organization.
1113This file should be world-readable.
1114This file contains
1115public keys, one per line, in the following format (fields separated
1116by spaces): system name, number of bits in modulus, public exponent,
1117modulus, and optional comment field.
1118When different names are used
1119for the same machine, all such names should be listed, separated by
1120commas.
1121The format is described on the
1122.Xr sshd 8
1123manual page.
1124.Pp
1125The canonical system name (as returned by name servers) is used by
1126.Xr sshd 8
1127to verify the client host when logging in; other names are needed because
1128.Nm
1129does not convert the user-supplied name to a canonical name before
1130checking the key, because someone with access to the name servers
1131would then be able to fool host authentication.
1132.It Pa /etc/ssh/ssh_config
1133Systemwide configuration file.
1134This file provides defaults for those
1135values that are not specified in the user's configuration file, and
1136for those users who do not have a configuration file.
1137This file must be world-readable.
1138.It Pa $HOME/.rhosts
1139This file is used in
1140.Pa \&.rhosts
1141authentication to list the
1142host/user pairs that are permitted to log in.
1143(Note that this file is
1144also used by rlogin and rsh, which makes using this file insecure.)
1145Each line of the file contains a host name (in the canonical form
1146returned by name servers), and then a user name on that host,
1147separated by a space.
1148One some machines this file may need to be
1149world-readable if the user's home directory is on a NFS partition,
1150because
1151.Xr sshd 8
1152reads it as root.
1153Additionally, this file must be owned by the user,
1154and must not have write permissions for anyone else.
1155The recommended
1156permission for most machines is read/write for the user, and not
1157accessible by others.
1158.Pp
1159Note that by default
1160.Xr sshd 8
1161will be installed so that it requires successful RSA host
1162authentication before permitting \s+2.\s0rhosts authentication.
1163If your server machine does not have the client's host key in
1164.Pa /etc/ssh/ssh_known_hosts ,
1165you can store it in
1166.Pa $HOME/.ssh/known_hosts .
1167The easiest way to do this is to
1168connect back to the client from the server machine using ssh; this
1169will automatically add the host key to
1170.Pa $HOME/.ssh/known_hosts .
1171.It Pa $HOME/.shosts
1172This file is used exactly the same way as
1173.Pa \&.rhosts .
1174The purpose for
1175having this file is to be able to use rhosts authentication with
1176.Nm
1177without permitting login with
1178.Xr rlogin 1
1179or
1180.Xr rsh 1 .
1181.It Pa /etc/hosts.equiv
1182This file is used during
1183.Pa \&.rhosts
1184authentication.
1185It contains
1186canonical hosts names, one per line (the full format is described on
1187the
1188.Xr sshd 8
1189manual page).
1190If the client host is found in this file, login is
1191automatically permitted provided client and server user names are the
1192same.
1193Additionally, successful RSA host authentication is normally
1194required.
1195This file should only be writable by root.
1196.It Pa /etc/ssh/shosts.equiv
1197This file is processed exactly as
1198.Pa /etc/hosts.equiv .
1199This file may be useful to permit logins using
1200.Nm
1201but not using rsh/rlogin.
1202.It Pa /etc/ssh/sshrc
1203Commands in this file are executed by
1204.Nm
1205when the user logs in just before the user's shell (or command) is started.
1206See the
1207.Xr sshd 8
1208manual page for more information.
1209.It Pa $HOME/.ssh/rc
1210Commands in this file are executed by
1211.Nm
1212when the user logs in just before the user's shell (or command) is
1213started.
1214See the
1215.Xr sshd 8
1216manual page for more information.
1217.It Pa $HOME/.ssh/environment
1218Contains additional definitions for environment variables, see section
1219.Sx ENVIRONMENT
1220above.
1221.It Pa libcrypto.so.X.1
1222A version of this library which includes support for the RSA algorithm
1223is required for proper operation.
1224.El
1225.Sh AUTHOR
1226OpenSSH
1227is a derivative of the original (free) ssh 1.2.12 release by Tatu Ylonen,
1228but with bugs removed and newer features re-added.
1229Rapidly after the
12301.2.12 release, newer versions of the original ssh bore successively
1231more restrictive licenses, and thus demand for a free version was born.
1232.Pp
1233This version of OpenSSH
1234.Bl -bullet
1235.It
1236has all components of a restrictive nature (i.e., patents, see
1237.Xr ssl 8 )
1238directly removed from the source code; any licensed or patented components
1239are chosen from
1240external libraries.
1241.It
1242has been updated to support SSH protocol 1.5 and 2, making it compatible with
1243all other SSH clients and servers.
1244.It
1245contains added support for
1246.Xr kerberos 8
1247authentication and ticket passing.
1248.It
1249supports one-time password authentication with
1250.Xr skey 1 .
1251.El
1252.Pp
1253OpenSSH has been created by Aaron Campbell, Bob Beck, Markus Friedl,
1254Niels Provos, Theo de Raadt, and Dug Song.
1255.Pp
1256The support for SSH protocol 2 was written by Markus Friedl.
1257.Sh SEE ALSO
1258.Xr rlogin 1 ,
1259.Xr rsh 1 ,
1260.Xr scp 1 ,
1261.Xr ssh-add 1 ,
1262.Xr ssh-agent 1 ,
1263.Xr ssh-keygen 1 ,
1264.Xr telnet 1 ,
1265.Xr sshd 8 ,
1266.Xr ssl 8
1267