xref: /freebsd/crypto/openssh/ssh.1 (revision 77a0943ded95b9e6438f7db70c4a28e4d93946d4)
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 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. Protocol version 2 supports
3813DES, Blowfish and CAST128 in CBC mode and Arcfour.
382.It Fl e Ar ch|^ch|none
383Sets the escape character for sessions with a pty (default:
384.Ql ~ ) .
385The escape character is only recognized at the beginning of a line.
386The escape character followed by a dot
387.Pq Ql \&.
388closes the connection, followed
389by control-Z suspends the connection, and followed by itself sends the
390escape character once.
391Setting the character to
392.Dq none
393disables any escapes and makes the session fully transparent.
394.It Fl f
395Requests
396.Nm
397to go to background just before command execution.
398This is useful if
399.Nm
400is going to ask for passwords or passphrases, but the user
401wants it in the background.
402This implies
403.Fl n .
404The recommended way to start X11 programs at a remote site is with
405something like
406.Ic ssh -f host xterm .
407.It Fl g
408Allows remote hosts to connect to local forwarded ports.
409.It Fl i Ar identity_file
410Selects the file from which the identity (private key) for
411RSA authentication is read.
412Default is
413.Pa $HOME/.ssh/identity
414in the user's home directory.
415Identity files may also be specified on
416a per-host basis in the configuration file.
417It is possible to have multiple
418.Fl i
419options (and multiple identities specified in
420configuration files).
421.It Fl k
422Disables forwarding of Kerberos tickets and AFS tokens.
423This may also be specified on a per-host basis in the configuration file.
424.It Fl l Ar login_name
425Specifies the user to log in as on the remote machine.
426This also may be specified on a per-host basis in the configuration file.
427.It Fl n
428Redirects stdin from
429.Pa /dev/null
430(actually, prevents reading from stdin).
431This must be used when
432.Nm
433is run in the background.
434A common trick is to use this to run X11 programs on a remote machine.
435For example,
436.Ic ssh -n shadows.cs.hut.fi emacs &
437will start an emacs on shadows.cs.hut.fi, and the X11
438connection will be automatically forwarded over an encrypted channel.
439The
440.Nm
441program will be put in the background.
442(This does not work if
443.Nm
444needs to ask for a password or passphrase; see also the
445.Fl f
446option.)
447.It Fl N
448Do not execute a remote command.
449This is usefull if you just want to forward ports
450(protocol version 2 only).
451.It Fl o Ar option
452Can be used to give options in the format used in the config file.
453This is useful for specifying options for which there is no separate
454command-line flag.
455The option has the same format as a line in the configuration file.
456.It Fl p Ar port
457Port to connect to on the remote host.
458This can be specified on a
459per-host basis in the configuration file.
460.It Fl P
461Use a non-privileged port for outgoing connections.
462This can be used if your firewall does
463not permit connections from privileged ports.
464Note that this option turns off
465.Cm RhostsAuthentication
466and
467.Cm RhostsRSAAuthentication .
468.It Fl q
469Quiet mode.
470Causes all warning and diagnostic messages to be suppressed.
471Only fatal errors are displayed.
472.It Fl t
473Force pseudo-tty allocation.
474This can be used to execute arbitrary
475screen-based programs on a remote machine, which can be very useful,
476e.g., when implementing menu services.
477.It Fl T
478Disable pseudo-tty allocation (protocol version 2 only).
479.It Fl v
480Verbose mode.
481Causes
482.Nm
483to print debugging messages about its progress.
484This is helpful in
485debugging connection, authentication, and configuration problems.
486The verbose mode is also used to display
487.Xr skey 1
488challenges, if the user entered "s/key" as password.
489.It Fl x
490Disables X11 forwarding.
491.It Fl X
492Enables X11 forwarding.
493This can also be specified on a per-host basis in a configuration file.
494.It Fl C
495Requests compression of all data (including stdin, stdout, stderr, and
496data for forwarded X11 and TCP/IP connections).
497The compression algorithm is the same used by
498.Xr gzip 1 ,
499and the
500.Dq level
501can be controlled by the
502.Cm CompressionLevel
503option (see below).
504Compression is desirable on modem lines and other
505slow connections, but will only slow down things on fast networks.
506The default value can be set on a host-by-host basis in the
507configuration files; see the
508.Cm Compress
509option below.
510.It Fl L Ar port:host:hostport
511Specifies that the given port on the local (client) host is to be
512forwarded to the given host and port on the remote side.
513This works by allocating a socket to listen to
514.Ar port
515on the local side, and whenever a connection is made to this port, the
516connection is forwarded over the secure channel, and a connection is
517made to
518.Ar host
519port
520.Ar hostport
521from the remote machine.
522Port forwardings can also be specified in the configuration file.
523Only root can forward privileged ports.
524IPv6 addresses can be specified with an alternative syntax:
525.Ar port/host/hostport
526.It Fl R Ar port:host:hostport
527Specifies that the given port on the remote (server) host is to be
528forwarded to the given host and port on the local side.
529This works by allocating a socket to listen to
530.Ar port
531on the remote side, and whenever a connection is made to this port, the
532connection is forwarded over the secure channel, and a connection is
533made to
534.Ar host
535port
536.Ar hostport
537from the local machine.
538Port forwardings can also be specified in the configuration file.
539Privileged ports can be forwarded only when
540logging in as root on the remote machine.
541.It Fl 2
542Forces
543.Nm
544to try protocol version 2 only.
545.It Fl 4
546Forces
547.Nm
548to use IPv4 addresses only.
549.It Fl 6
550Forces
551.Nm
552to use IPv6 addresses only.
553.El
554.Sh CONFIGURATION FILES
555.Nm
556obtains configuration data from the following sources (in this order):
557command line options, user's configuration file
558.Pq Pa $HOME/.ssh/config ,
559and system-wide configuration file
560.Pq Pa /etc/ssh/ssh_config .
561For each parameter, the first obtained value
562will be used.
563The configuration files contain sections bracketed by
564.Dq Host
565specifications, and that section is only applied for hosts that
566match one of the patterns given in the specification.
567The matched host name is the one given on the command line.
568.Pp
569Since the first obtained value for each parameter is used, more
570host-specific declarations should be given near the beginning of the
571file, and general defaults at the end.
572.Pp
573The configuration file has the following format:
574.Pp
575Empty lines and lines starting with
576.Ql #
577are comments.
578.Pp
579Otherwise a line is of the format
580.Dq keyword arguments .
581The possible
582keywords and their meanings are as follows (note that the
583configuration files are case-sensitive):
584.Bl -tag -width Ds
585.It Cm Host
586Restricts the following declarations (up to the next
587.Cm Host
588keyword) to be only for those hosts that match one of the patterns
589given after the keyword.
590.Ql \&*
591and
592.Ql ?
593can be used as wildcards in the
594patterns.
595A single
596.Ql \&*
597as a pattern can be used to provide global
598defaults for all hosts.
599The host is the
600.Ar hostname
601argument given on the command line (i.e., the name is not converted to
602a canonicalized host name before matching).
603.It Cm AFSTokenPassing
604Specifies whether to pass AFS tokens to remote host.
605The argument to this keyword must be
606.Dq yes
607or
608.Dq no .
609.It Cm BatchMode
610If set to
611.Dq yes ,
612passphrase/password querying will be disabled.
613This option is useful in scripts and other batch jobs where you have no
614user to supply the password.
615The argument must be
616.Dq yes
617or
618.Dq no .
619.It Cm CheckHostIP
620If this flag is set to
621.Dq yes ,
622ssh will additionally check the host ip address in the
623.Pa known_hosts
624file.
625This allows ssh to detect if a host key changed due to DNS spoofing.
626If the option is set to
627.Dq no ,
628the check will not be executed.
629.It Cm Cipher
630Specifies the cipher to use for encrypting the session.
631Currently,
632.Dq blowfish ,
633and
634.Dq 3des
635are supported.
636The default is
637.Dq 3des .
638.It Cm Ciphers
639Specifies the ciphers allowed for protocol version 2
640in order of preference.
641Multiple ciphers must be comma-separated.
642The default is
643.Dq 3des-cbc,blowfish-cbc,arcfour,cast128-cbc .
644.It Cm Compression
645Specifies whether to use compression.
646The argument must be
647.Dq yes
648or
649.Dq no .
650.It Cm CompressionLevel
651Specifies the compression level to use if compression is enable.
652The argument must be an integer from 1 (fast) to 9 (slow, best).
653The default level is 6, which is good for most applications.
654The meaning of the values is the same as in
655.Xr gzip 1 .
656.It Cm ConnectionAttempts
657Specifies the number of tries (one per second) to make before falling
658back to rsh or exiting.
659The argument must be an integer.
660This may be useful in scripts if the connection sometimes fails.
661.It Cm DSAAuthentication
662Specifies whether to try DSA authentication.
663The argument to this keyword must be
664.Dq yes
665or
666.Dq no .
667DSA authentication will only be
668attempted if a DSA identity file exists.
669Note that this option applies to protocol version 2 only.
670.It Cm EscapeChar
671Sets the escape character (default:
672.Ql ~ ) .
673The escape character can also
674be set on the command line.
675The argument should be a single character,
676.Ql ^
677followed by a letter, or
678.Dq none
679to disable the escape
680character entirely (making the connection transparent for binary
681data).
682.It Cm FallBackToRsh
683Specifies that if connecting via
684.Nm
685fails due to a connection refused error (there is no
686.Xr sshd 8
687listening on the remote host),
688.Xr rsh 1
689should automatically be used instead (after a suitable warning about
690the session being unencrypted).
691The argument must be
692.Dq yes
693or
694.Dq no .
695.It Cm ForwardAgent
696Specifies whether the connection to the authentication agent (if any)
697will be forwarded to the remote machine.
698The argument must be
699.Dq yes
700or
701.Dq no .
702The default is
703.Dq no .
704.It Cm ForwardX11
705Specifies whether X11 connections will be automatically redirected
706over the secure channel and
707.Ev DISPLAY
708set.
709The argument must be
710.Dq yes
711or
712.Dq no .
713The default is
714.Dq no .
715.It Cm GatewayPorts
716Specifies whether remote hosts are allowed to connect to local
717forwarded ports.
718The argument must be
719.Dq yes
720or
721.Dq no .
722The default is
723.Dq no .
724.It Cm GlobalKnownHostsFile
725Specifies a file to use instead of
726.Pa /etc/ssh/ssh_known_hosts .
727.It Cm HostName
728Specifies the real host name to log into.
729This can be used to specify nicknames or abbreviations for hosts.
730Default is the name given on the command line.
731Numeric IP addresses are also permitted (both on the command line and in
732.Cm HostName
733specifications).
734.It Cm IdentityFile
735Specifies the file from which the user's RSA authentication identity
736is read (default
737.Pa $HOME/.ssh/identity
738in the user's home directory).
739Additionally, any identities represented by the authentication agent
740will be used for authentication.
741The file name may use the tilde
742syntax to refer to a user's home directory.
743It is possible to have
744multiple identity files specified in configuration files; all these
745identities will be tried in sequence.
746.It Cm IdentityFile2
747Specifies the file from which the user's DSA authentication identity
748is read (default
749.Pa $HOME/.ssh/id_dsa
750in the user's home directory).
751The file name may use the tilde
752syntax to refer to a user's home directory.
753It is possible to have
754multiple identity files specified in configuration files; all these
755identities will be tried in sequence.
756.It Cm KeepAlive
757Specifies whether the system should send keepalive messages to the
758other side.
759If they are sent, death of the connection or crash of one
760of the machines will be properly noticed.
761However, this means that
762connections will die if the route is down temporarily, and some people
763find it annoying.
764.Pp
765The default is
766.Dq yes
767(to send keepalives), and the client will notice
768if the network goes down or the remote host dies.
769This is important in scripts, and many users want it too.
770.Pp
771To disable keepalives, the value should be set to
772.Dq no
773in both the server and the client configuration files.
774.It Cm KerberosAuthentication
775Specifies whether Kerberos authentication will be used.
776The argument to this keyword must be
777.Dq yes
778or
779.Dq no .
780.It Cm KerberosTgtPassing
781Specifies whether a Kerberos TGT will be forwarded to the server.
782This will only work if the Kerberos server is actually an AFS kaserver.
783The argument to this keyword must be
784.Dq yes
785or
786.Dq no .
787.It Cm LocalForward
788Specifies that a TCP/IP port on the local machine be forwarded over
789the secure channel to given host:port from the remote machine.
790The first argument must be a port number, and the second must be
791host:port.
792Multiple forwardings may be specified, and additional
793forwardings can be given on the command line.
794Only the superuser can forward privileged ports.
795.It Cm LogLevel
796Gives the verbosity level that is used when logging messages from
797.Nm ssh .
798The possible values are:
799QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
800The default is INFO.
801.It Cm NumberOfPasswordPrompts
802Specifies the number of password prompts before giving up.
803The argument to this keyword must be an integer.
804Default is 3.
805.It Cm PasswordAuthentication
806Specifies whether to use password authentication.
807The argument to this keyword must be
808.Dq yes
809or
810.Dq no .
811Note that this option applies to both protocol version 1 and 2.
812.It Cm Port
813Specifies the port number to connect on the remote host.
814Default is 22.
815.It Cm Protocol
816Specifies the protocol versions
817.Nm
818should support in order of preference.
819The possible values are
820.Dq 1
821and
822.Dq 2 .
823Multiple versions must be comma-separated.
824The default is
825.Dq 1,2 .
826This means that
827.Nm
828tries version 1 and falls back to version 2
829if version 1 is not available.
830.It Cm ProxyCommand
831Specifies the command to use to connect to the server.
832The command
833string extends to the end of the line, and is executed with
834.Pa /bin/sh .
835In the command string,
836.Ql %h
837will be substituted by the host name to
838connect and
839.Ql %p
840by the port.
841The command can be basically anything,
842and should read from its standard input and write to its standard output.
843It should eventually connect an
844.Xr sshd 8
845server running on some machine, or execute
846.Ic sshd -i
847somewhere.
848Host key management will be done using the
849HostName of the host being connected (defaulting to the name typed by
850the user).
851Note that
852.Cm CheckHostIP
853is not available for connects with a proxy command.
854.Pp
855.It Cm RemoteForward
856Specifies that a TCP/IP port on the remote machine be forwarded over
857the secure channel to given host:port from the local machine.
858The first argument must be a port number, and the second must be
859host:port.
860Multiple forwardings may be specified, and additional
861forwardings can be given on the command line.
862Only the superuser can forward privileged ports.
863.It Cm RhostsAuthentication
864Specifies whether to try rhosts based authentication.
865Note that this
866declaration only affects the client side and has no effect whatsoever
867on security.
868Disabling rhosts authentication may reduce
869authentication time on slow connections when rhosts authentication is
870not used.
871Most servers do not permit RhostsAuthentication because it
872is not secure (see RhostsRSAAuthentication).
873The argument to this keyword must be
874.Dq yes
875or
876.Dq no .
877.It Cm RhostsRSAAuthentication
878Specifies whether to try rhosts based authentication with RSA host
879authentication.
880This is the primary authentication method for most sites.
881The argument must be
882.Dq yes
883or
884.Dq no .
885.It Cm RSAAuthentication
886Specifies whether to try RSA authentication.
887The argument to this keyword must be
888.Dq yes
889or
890.Dq no .
891RSA authentication will only be
892attempted if the identity file exists, or an authentication agent is
893running.
894Note that this option applies to protocol version 1 only.
895.It Cm SkeyAuthentication
896Specifies whether to use
897.Xr skey 1
898authentication.
899The argument to this keyword must be
900.Dq yes
901or
902.Dq no .
903The default is
904.Dq no .
905.It Cm StrictHostKeyChecking
906If this flag is set to
907.Dq yes ,
908.Nm
909ssh will never automatically add host keys to the
910.Pa $HOME/.ssh/known_hosts
911and
912.Pa $HOME/.ssh/known_hosts2
913files, and refuses to connect hosts whose host key has changed.
914This provides maximum protection against trojan horse attacks.
915However, it can be somewhat annoying if you don't have good
916.Pa /etc/ssh/ssh_known_hosts
917and
918.Pa /etc/ssh/ssh_known_hosts2
919files installed and frequently
920connect new hosts.
921Basically this option forces the user to manually
922add any new hosts.
923Normally this option is disabled, and new hosts
924will automatically be added to the known host files.
925The host keys of
926known hosts will be verified automatically in either case.
927The argument must be
928.Dq yes
929or
930.Dq no .
931.It Cm UsePrivilegedPort
932Specifies whether to use a privileged port for outgoing connections.
933The argument must be
934.Dq yes
935or
936.Dq no .
937The default is
938.Dq yes .
939Note that setting this option to
940.Dq no
941turns off
942.Cm RhostsAuthentication
943and
944.Cm RhostsRSAAuthentication .
945.It Cm User
946Specifies the user to log in as.
947This can be useful if you have a different user name on different machines.
948This saves the trouble of
949having to remember to give the user name on the command line.
950.It Cm UserKnownHostsFile
951Specifies a file to use instead of
952.Pa $HOME/.ssh/known_hosts .
953.It Cm UseRsh
954Specifies that rlogin/rsh should be used for this host.
955It is possible that the host does not at all support the
956.Nm
957protocol.
958This causes
959.Nm
960to immediately execute
961.Xr rsh 1 .
962All other options (except
963.Cm HostName )
964are ignored if this has been specified.
965The argument must be
966.Dq yes
967or
968.Dq no .
969.It Cm XAuthLocation
970Specifies the location of the
971.Xr xauth 1
972program.
973The default is
974.Pa /usr/X11R6/bin/xauth .
975.El
976.Sh ENVIRONMENT
977.Nm
978will normally set the following environment variables:
979.Bl -tag -width Ds
980.It Ev DISPLAY
981The
982.Ev DISPLAY
983variable indicates the location of the X11 server.
984It is automatically set by
985.Nm
986to point to a value of the form
987.Dq hostname:n
988where hostname indicates
989the host where the shell runs, and n is an integer \*(>= 1.
990.Nm
991uses this special value to forward X11 connections over the secure
992channel.
993The user should normally not set DISPLAY explicitly, as that
994will render the X11 connection insecure (and will require the user to
995manually copy any required authorization cookies).
996.It Ev HOME
997Set to the path of the user's home directory.
998.It Ev LOGNAME
999Synonym for
1000.Ev USER ;
1001set for compatibility with systems that use this variable.
1002.It Ev MAIL
1003Set to point the user's mailbox.
1004.It Ev PATH
1005Set to the default
1006.Ev PATH ,
1007as specified when compiling
1008.Nm ssh .
1009.It Ev SSH_AUTH_SOCK
1010indicates the path of a unix-domain socket used to communicate with the
1011agent.
1012.It Ev SSH_CLIENT
1013Identifies the client end of the connection.
1014The variable contains
1015three space-separated values: client ip-address, client port number,
1016and server port number.
1017.It Ev SSH_TTY
1018This is set to the name of the tty (path to the device) associated
1019with the current shell or command.
1020If the current session has no tty,
1021this variable is not set.
1022.It Ev TZ
1023The timezone variable is set to indicate the present timezone if it
1024was set when the daemon was started (i.e., the daemon passes the value
1025on to new connections).
1026.It Ev USER
1027Set to the name of the user logging in.
1028.El
1029.Pp
1030Additionally,
1031.Nm
1032reads
1033.Pa $HOME/.ssh/environment ,
1034and adds lines of the format
1035.Dq VARNAME=value
1036to the environment.
1037.Sh FILES
1038.Bl -tag -width Ds
1039.It Pa $HOME/.ssh/known_hosts
1040Records host keys for all hosts the user has logged into (that are not
1041in
1042.Pa /etc/ssh/ssh_known_hosts ) .
1043See
1044.Xr sshd 8 .
1045.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa
1046Contains the RSA and the DSA authentication identity of the user.
1047These files
1048contain sensitive data and should be readable by the user but not
1049accessible by others (read/write/execute).
1050Note that
1051.Nm
1052ignores a private key file if it is accessible by others.
1053It is possible to specify a passphrase when
1054generating the key; the passphrase will be used to encrypt the
1055sensitive part of this file using 3DES.
1056.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub
1057Contains the public key for authentication (public part of the
1058identity file in human-readable form).
1059The contents of the
1060.Pa $HOME/.ssh/identity.pub
1061file should be added to
1062.Pa $HOME/.ssh/authorized_keys
1063on all machines
1064where you wish to log in using RSA authentication.
1065The contents of the
1066.Pa $HOME/.ssh/id_dsa.pub
1067file should be added to
1068.Pa $HOME/.ssh/authorized_keys2
1069on all machines
1070where you wish to log in using DSA authentication.
1071These files are not
1072sensitive and can (but need not) be readable by anyone.
1073These files are
1074never used automatically and are not necessary; they are only provided for
1075the convenience of the user.
1076.It Pa $HOME/.ssh/config
1077This is the per-user configuration file.
1078The format of this file is described above.
1079This file is used by the
1080.Nm
1081client.
1082This file does not usually contain any sensitive information,
1083but the recommended permissions are read/write for the user, and not
1084accessible by others.
1085.It Pa $HOME/.ssh/authorized_keys
1086Lists the RSA keys that can be used for logging in as this user.
1087The format of this file is described in the
1088.Xr sshd 8
1089manual page.
1090In the simplest form the format is the same as the .pub
1091identity files (that is, each line contains the number of bits in
1092modulus, public exponent, modulus, and comment fields, separated by
1093spaces).
1094This file is not highly sensitive, but the recommended
1095permissions are read/write for the user, and not accessible by others.
1096.It Pa $HOME/.ssh/authorized_keys2
1097Lists the DSA keys that can be used for logging in as this user.
1098This file is not highly sensitive, but the recommended
1099permissions are read/write for the user, and not accessible by others.
1100.It Pa /etc/ssh/ssh_known_hosts, /etc/ssh/ssh_known_hosts2
1101Systemwide list of known host keys.
1102.Pa /etc/ssh_known_hosts
1103contains RSA and
1104.Pa /etc/ssh_known_hosts2
1105contains DSA keys.
1106These files should be prepared by the
1107system administrator to contain the public host keys of all machines in the
1108organization.
1109This file should be world-readable.
1110This file contains
1111public keys, one per line, in the following format (fields separated
1112by spaces): system name, number of bits in modulus, public exponent,
1113modulus, and optional comment field.
1114When different names are used
1115for the same machine, all such names should be listed, separated by
1116commas.
1117The format is described on the
1118.Xr sshd 8
1119manual page.
1120.Pp
1121The canonical system name (as returned by name servers) is used by
1122.Xr sshd 8
1123to verify the client host when logging in; other names are needed because
1124.Nm
1125does not convert the user-supplied name to a canonical name before
1126checking the key, because someone with access to the name servers
1127would then be able to fool host authentication.
1128.It Pa /etc/ssh/ssh_config
1129Systemwide configuration file.
1130This file provides defaults for those
1131values that are not specified in the user's configuration file, and
1132for those users who do not have a configuration file.
1133This file must be world-readable.
1134.It Pa $HOME/.rhosts
1135This file is used in
1136.Pa \&.rhosts
1137authentication to list the
1138host/user pairs that are permitted to log in.
1139(Note that this file is
1140also used by rlogin and rsh, which makes using this file insecure.)
1141Each line of the file contains a host name (in the canonical form
1142returned by name servers), and then a user name on that host,
1143separated by a space.
1144One some machines this file may need to be
1145world-readable if the user's home directory is on a NFS partition,
1146because
1147.Xr sshd 8
1148reads it as root.
1149Additionally, this file must be owned by the user,
1150and must not have write permissions for anyone else.
1151The recommended
1152permission for most machines is read/write for the user, and not
1153accessible by others.
1154.Pp
1155Note that by default
1156.Xr sshd 8
1157will be installed so that it requires successful RSA host
1158authentication before permitting \s+2.\s0rhosts authentication.
1159If your server machine does not have the client's host key in
1160.Pa /etc/ssh/ssh_known_hosts ,
1161you can store it in
1162.Pa $HOME/.ssh/known_hosts .
1163The easiest way to do this is to
1164connect back to the client from the server machine using ssh; this
1165will automatically add the host key to
1166.Pa $HOME/.ssh/known_hosts .
1167.It Pa $HOME/.shosts
1168This file is used exactly the same way as
1169.Pa \&.rhosts .
1170The purpose for
1171having this file is to be able to use rhosts authentication with
1172.Nm
1173without permitting login with
1174.Xr rlogin 1
1175or
1176.Xr rsh 1 .
1177.It Pa /etc/hosts.equiv
1178This file is used during
1179.Pa \&.rhosts
1180authentication.
1181It contains
1182canonical hosts names, one per line (the full format is described on
1183the
1184.Xr sshd 8
1185manual page).
1186If the client host is found in this file, login is
1187automatically permitted provided client and server user names are the
1188same.
1189Additionally, successful RSA host authentication is normally
1190required.
1191This file should only be writable by root.
1192.It Pa /etc/ssh/shosts.equiv
1193This file is processed exactly as
1194.Pa /etc/hosts.equiv .
1195This file may be useful to permit logins using
1196.Nm
1197but not using rsh/rlogin.
1198.It Pa /etc/ssh/sshrc
1199Commands in this file are executed by
1200.Nm
1201when the user logs in just before the user's shell (or command) is started.
1202See the
1203.Xr sshd 8
1204manual page for more information.
1205.It Pa $HOME/.ssh/rc
1206Commands in this file are executed by
1207.Nm
1208when the user logs in just before the user's shell (or command) is
1209started.
1210See the
1211.Xr sshd 8
1212manual page for more information.
1213.It Pa $HOME/.ssh/environment
1214Contains additional definitions for environment variables, see section
1215.Sx ENVIRONMENT
1216above.
1217.It Pa libcrypto.so.X.1
1218A version of this library which includes support for the RSA algorithm
1219is required for proper operation.
1220.El
1221.Sh AUTHOR
1222OpenSSH
1223is a derivative of the original (free) ssh 1.2.12 release by Tatu Ylonen,
1224but with bugs removed and newer features re-added.
1225Rapidly after the
12261.2.12 release, newer versions of the original ssh bore successively
1227more restrictive licenses, and thus demand for a free version was born.
1228.Pp
1229This version of OpenSSH
1230.Bl -bullet
1231.It
1232has all components of a restrictive nature (i.e., patents, see
1233.Xr ssl 8 )
1234directly removed from the source code; any licensed or patented components
1235are chosen from
1236external libraries.
1237.It
1238has been updated to support SSH protocol 1.5 and 2, making it compatible with
1239all other SSH clients and servers.
1240.It
1241contains added support for
1242.Xr kerberos 8
1243authentication and ticket passing.
1244.It
1245supports one-time password authentication with
1246.Xr skey 1 .
1247.El
1248.Pp
1249OpenSSH has been created by Aaron Campbell, Bob Beck, Markus Friedl,
1250Niels Provos, Theo de Raadt, and Dug Song.
1251.Pp
1252The support for SSH protocol 2 was written by Markus Friedl.
1253.Sh SEE ALSO
1254.Xr rlogin 1 ,
1255.Xr rsh 1 ,
1256.Xr scp 1 ,
1257.Xr ssh-add 1 ,
1258.Xr ssh-agent 1 ,
1259.Xr ssh-keygen 1 ,
1260.Xr telnet 1 ,
1261.Xr sshd 8 ,
1262.Xr ssl 8
1263