blob: 51efc63f5280e335dfaa53a0da690da489224fba [file] [log] [blame]
Damien Miller32aa1441999-10-29 09:15:49 +10001.\" -*- nroff -*-
2.\"
Damien Miller32aa1441999-10-29 09:15:49 +10003.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
Damien Miller32aa1441999-10-29 09:15:49 +10004.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5.\" All rights reserved
6.\"
Damien Millere4340be2000-09-16 13:29:08 +11007.\" 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".
Damien Miller32aa1441999-10-29 09:15:49 +100012.\"
Ben Lindstrom92a2e382001-03-05 06:59:27 +000013.\" 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.
Damien Millere4340be2000-09-16 13:29:08 +110016.\"
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.
Damien Miller32aa1441999-10-29 09:15:49 +100036.\"
Ben Lindstromd58eb5f2001-03-07 06:07:22 +000037.\" $OpenBSD: ssh.1,v 1.96 2001/03/07 01:19:06 deraadt Exp $
Damien Miller32aa1441999-10-29 09:15:49 +100038.Dd September 25, 1999
39.Dt SSH 1
40.Os
41.Sh NAME
42.Nm ssh
Ben Lindstromd58eb5f2001-03-07 06:07:22 +000043.Nd OpenSSH SSH client (remote login program)
Damien Miller32aa1441999-10-29 09:15:49 +100044.Sh SYNOPSIS
45.Nm ssh
46.Op Fl l Ar login_name
47.Op Ar hostname | user@hostname
48.Op Ar command
49.Pp
50.Nm ssh
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +000051.Op Fl afgknqstvxACNPTX1246
Damien Miller30c3d422000-05-09 11:02:59 +100052.Op Fl c Ar cipher_spec
Damien Miller32aa1441999-10-29 09:15:49 +100053.Op Fl e Ar escape_char
54.Op Fl i Ar identity_file
55.Op Fl l Ar login_name
Ben Lindstrom06b33aa2001-02-15 03:01:59 +000056.Op Fl m Ar mac_spec
Damien Miller32aa1441999-10-29 09:15:49 +100057.Op Fl o Ar option
58.Op Fl p Ar port
59.Oo Fl L Xo
60.Sm off
Damien Miller32aa1441999-10-29 09:15:49 +100061.Ar port :
Damien Miller396691a2000-01-20 22:44:08 +110062.Ar host :
Damien Miller32aa1441999-10-29 09:15:49 +100063.Ar hostport
64.Sm on
65.Xc
66.Oc
67.Oo Fl R Xo
68.Sm off
Damien Miller32aa1441999-10-29 09:15:49 +100069.Ar port :
Damien Miller396691a2000-01-20 22:44:08 +110070.Ar host :
Damien Miller32aa1441999-10-29 09:15:49 +100071.Ar hostport
72.Sm on
73.Xc
74.Oc
75.Op Ar hostname | user@hostname
76.Op Ar command
Damien Miller22c77262000-04-13 12:26:34 +100077.Sh DESCRIPTION
Damien Miller32aa1441999-10-29 09:15:49 +100078.Nm
Ben Lindstromd58eb5f2001-03-07 06:07:22 +000079(SSH client) is a program for logging into a remote machine and for
Damien Miller7684ee12000-03-17 23:40:15 +110080executing commands on a remote machine.
81It is intended to replace
Damien Miller32aa1441999-10-29 09:15:49 +100082rlogin and rsh, and provide secure encrypted communications between
Damien Miller7684ee12000-03-17 23:40:15 +110083two untrusted hosts over an insecure network.
84X11 connections and
Damien Miller32aa1441999-10-29 09:15:49 +100085arbitrary TCP/IP ports can also be forwarded over the secure channel.
86.Pp
87.Nm
Damien Miller22c77262000-04-13 12:26:34 +100088connects and logs into the specified
Damien Miller32aa1441999-10-29 09:15:49 +100089.Ar hostname .
90The user must prove
Damien Millere247cc42000-05-07 12:03:14 +100091his/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
Damien Miller32aa1441999-10-29 09:15:49 +100095.Pp
96First, if the machine the user logs in from is listed in
97.Pa /etc/hosts.equiv
98or
Damien Miller886c63a2000-01-20 23:13:36 +110099.Pa /etc/shosts.equiv
Damien Miller32aa1441999-10-29 09:15:49 +1000100on the remote machine, and the user names are
101the same on both sides, the user is immediately permitted to log in.
Damien Miller22c77262000-04-13 12:26:34 +1000102Second, if
Damien Miller32aa1441999-10-29 09:15:49 +1000103.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
Damien Miller7684ee12000-03-17 23:40:15 +1100109permitted to log in.
110This form of authentication alone is normally not
Damien Miller32aa1441999-10-29 09:15:49 +1000111allowed 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
Damien Miller7684ee12000-03-17 23:40:15 +1100117method combined with RSA-based host authentication.
118It means that if the login would be permitted by
Damien Millere247cc42000-05-07 12:03:14 +1000119.Pa $HOME/.rhosts ,
120.Pa $HOME/.shosts ,
Damien Miller32aa1441999-10-29 09:15:49 +1000121.Pa /etc/hosts.equiv ,
122or
Damien Miller886c63a2000-01-20 23:13:36 +1100123.Pa /etc/shosts.equiv ,
Damien Miller32aa1441999-10-29 09:15:49 +1000124and if additionally the server can verify the client's
Damien Miller22c77262000-04-13 12:26:34 +1000125host key (see
Damien Miller886c63a2000-01-20 23:13:36 +1100126.Pa /etc/ssh_known_hosts
Damien Miller33e511e1999-11-11 11:43:13 +1100127and
128.Pa $HOME/.ssh/known_hosts
Damien Miller32aa1441999-10-29 09:15:49 +1000129in the
130.Sx FILES
Damien Miller7684ee12000-03-17 23:40:15 +1100131section), 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:
Damien Miller32aa1441999-10-29 09:15:49 +1000135.Pa /etc/hosts.equiv ,
Damien Millere247cc42000-05-07 12:03:14 +1000136.Pa $HOME/.rhosts ,
Damien Miller32aa1441999-10-29 09:15:49 +1000137and the rlogin/rsh protocol in general, are inherently insecure and should be
138disabled if security is desired.]
139.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000140As a third authentication method,
Damien Miller32aa1441999-10-29 09:15:49 +1000141.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.
Damien Miller7684ee12000-03-17 23:40:15 +1100146RSA is one such system.
Damien Miller22c77262000-04-13 12:26:34 +1000147The idea is that each user creates a public/private
Damien Miller7684ee12000-03-17 23:40:15 +1100148key pair for authentication purposes.
149The server knows the public key, and only the user knows the private key.
Damien Miller22c77262000-04-13 12:26:34 +1000150The file
Damien Miller32aa1441999-10-29 09:15:49 +1000151.Pa $HOME/.ssh/authorized_keys
152lists the public keys that are permitted for logging
Damien Miller7684ee12000-03-17 23:40:15 +1100153in.
154When the user logs in, the
Damien Miller32aa1441999-10-29 09:15:49 +1000155.Nm
156program tells the server which key pair it would like to use for
Damien Miller7684ee12000-03-17 23:40:15 +1100157authentication.
158The server checks if this key is permitted, and if
Damien Miller32aa1441999-10-29 09:15:49 +1000159so, sends the user (actually the
160.Nm
161program running on behalf of the user) a challenge, a random number,
Damien Miller7684ee12000-03-17 23:40:15 +1100162encrypted by the user's public key.
163The challenge can only be
164decrypted using the proper private key.
165The user's client then decrypts the
Damien Miller32aa1441999-10-29 09:15:49 +1000166challenge using the private key, proving that he/she knows the private
167key but without disclosing it to the server.
168.Pp
169.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100170implements the RSA authentication protocol automatically.
171The user creates his/her RSA key pair by running
Damien Miller32aa1441999-10-29 09:15:49 +1000172.Xr ssh-keygen 1 .
Damien Miller22c77262000-04-13 12:26:34 +1000173This stores the private key in
Damien Millere247cc42000-05-07 12:03:14 +1000174.Pa $HOME/.ssh/identity
Damien Miller32aa1441999-10-29 09:15:49 +1000175and the public key in
Damien Millere247cc42000-05-07 12:03:14 +1000176.Pa $HOME/.ssh/identity.pub
Damien Miller7684ee12000-03-17 23:40:15 +1100177in the user's home directory.
178The user should then copy the
Damien Miller32aa1441999-10-29 09:15:49 +1000179.Pa identity.pub
Damien Miller22c77262000-04-13 12:26:34 +1000180to
Damien Millere247cc42000-05-07 12:03:14 +1000181.Pa $HOME/.ssh/authorized_keys
Damien Miller22c77262000-04-13 12:26:34 +1000182in his/her home directory on the remote machine (the
Damien Miller32aa1441999-10-29 09:15:49 +1000183.Pa authorized_keys
Damien Miller22c77262000-04-13 12:26:34 +1000184file corresponds to the conventional
Damien Millere247cc42000-05-07 12:03:14 +1000185.Pa $HOME/.rhosts
Damien Miller32aa1441999-10-29 09:15:49 +1000186file, and has one key
Damien Miller7684ee12000-03-17 23:40:15 +1100187per line, though the lines can be very long).
188After this, the user can log in without giving the password.
189RSA authentication is much
Damien Miller32aa1441999-10-29 09:15:49 +1000190more secure than rhosts authentication.
191.Pp
192The most convenient way to use RSA authentication may be with an
Damien Miller7684ee12000-03-17 23:40:15 +1100193authentication agent.
194See
Damien Miller32aa1441999-10-29 09:15:49 +1000195.Xr ssh-agent 1
196for more information.
197.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000198If other authentication methods fail,
Damien Miller32aa1441999-10-29 09:15:49 +1000199.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100200prompts the user for a password.
201The password is sent to the remote
Damien Miller32aa1441999-10-29 09:15:49 +1000202host for checking; however, since all communications are encrypted,
203the password cannot be seen by someone listening on the network.
204.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000205.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
Damien Miller0bc1bd82000-11-13 22:57:25 +1100213in the previous section except that the DSA or RSA algorithm is used
214instead.
215The client uses his private key
Damien Millere247cc42000-05-07 12:03:14 +1000216.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
227S/Key authentication.
228.Pp
229Protocol 2 provides additional mechanisms for confidentiality
Damien Miller30c3d422000-05-09 11:02:59 +1000230(the traffic is encrypted using 3DES, Blowfish, CAST128 or Arcfour)
Ben Lindstromec26fb12001-03-06 01:05:23 +0000231and integrity (hmac-md5, hmac-sha1).
Damien Millere247cc42000-05-07 12:03:14 +1000232Note 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
Damien Miller32aa1441999-10-29 09:15:49 +1000237When the user's identity has been accepted by the server, the server
238either executes the given command, or logs into the machine and gives
Damien Miller7684ee12000-03-17 23:40:15 +1100239the user a normal shell on the remote machine.
240All communication with
Damien Miller32aa1441999-10-29 09:15:49 +1000241the 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
Damien Miller22c77262000-04-13 12:26:34 +1000251.Ic ~#
Damien Miller32aa1441999-10-29 09:15:49 +1000252and 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
Damien Miller7684ee12000-03-17 23:40:15 +1100257shell to hang).
258All available escapes can be listed with
Damien Miller32aa1441999-10-29 09:15:49 +1000259.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
Damien Miller7684ee12000-03-17 23:40:15 +1100265special.
266The escape character can be changed in configuration files
267or on the command line.
Damien Miller32aa1441999-10-29 09:15:49 +1000268.Pp
269If no pseudo tty has been allocated, the
270session is transparent and can be used to reliably transfer binary
Damien Miller7684ee12000-03-17 23:40:15 +1100271data.
272On most systems, setting the escape character to
Damien Miller32aa1441999-10-29 09:15:49 +1000273.Dq none
274will also make the session transparent even if a tty is used.
275.Pp
Ben Lindstroma6885612000-12-09 03:45:32 +0000276The session terminates when the command or shell on the remote
Ben Lindstromebd888d2001-03-05 05:49:29 +0000277machine exits and all X11 and TCP/IP connections have been closed.
Damien Miller32aa1441999-10-29 09:15:49 +1000278The exit status of the remote program is returned as the exit status
279of
280.Nm ssh .
281.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000282.Ss X11 and TCP forwarding
283.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000284If the user is using X11 (the
285.Ev DISPLAY
286environment variable is set), the connection to the X11 display is
287automatically 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
Damien Miller7684ee12000-03-17 23:40:15 +1100290from the local machine.
291The user should not manually set
Damien Miller32aa1441999-10-29 09:15:49 +1000292.Ev DISPLAY .
293Forwarding of X11 connections can be
294configured on the command line or in configuration files.
295.Pp
296The
Damien Miller22c77262000-04-13 12:26:34 +1000297.Ev DISPLAY
Damien Miller32aa1441999-10-29 09:15:49 +1000298value set by
299.Nm
300will point to the server machine, but with a display number greater
Damien Miller7684ee12000-03-17 23:40:15 +1100301than zero.
302This is normal, and happens because
Damien Miller32aa1441999-10-29 09:15:49 +1000303.Nm
304creates a
305.Dq proxy
306X server on the server machine for forwarding the
307connections over the encrypted channel.
308.Pp
309.Nm
310will also automatically set up Xauthority data on the server machine.
311For this purpose, it will generate a random authorization cookie,
312store it in Xauthority on the server, and verify that any forwarded
313connections carry this cookie and replace it by the real cookie when
Damien Miller7684ee12000-03-17 23:40:15 +1100314the connection is opened.
315The real authentication cookie is never
Damien Miller32aa1441999-10-29 09:15:49 +1000316sent to the server machine (and no cookies are sent in the plain).
317.Pp
318If the user is using an authentication agent, the connection to the agent
319is automatically forwarded to the remote side unless disabled on
320command line or in a configuration file.
321.Pp
322Forwarding of arbitrary TCP/IP connections over the secure channel can
Damien Miller7684ee12000-03-17 23:40:15 +1100323be specified either on command line or in a configuration file.
324One possible application of TCP/IP forwarding is a secure connection to an
Ben Lindstromebd888d2001-03-05 05:49:29 +0000325electronic purse; another is going through firewalls.
Damien Miller32aa1441999-10-29 09:15:49 +1000326.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000327.Ss Server authentication
328.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000329.Nm
Damien Millere247cc42000-05-07 12:03:14 +1000330automatically maintains and checks a database containing
Damien Miller7684ee12000-03-17 23:40:15 +1100331identifications for all hosts it has ever been used with.
Damien Millere247cc42000-05-07 12:03:14 +1000332RSA host keys are stored in
333.Pa $HOME/.ssh/known_hosts
334and
Damien Miller0bc1bd82000-11-13 22:57:25 +1100335host keys used in the protocol version 2 are stored in
Damien Millere247cc42000-05-07 12:03:14 +1000336.Pa $HOME/.ssh/known_hosts2
Damien Miller7684ee12000-03-17 23:40:15 +1100337in the user's home directory.
Damien Millere247cc42000-05-07 12:03:14 +1000338Additionally, the files
Damien Miller886c63a2000-01-20 23:13:36 +1100339.Pa /etc/ssh_known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000340and
341.Pa /etc/ssh_known_hosts2
342are automatically checked for known hosts.
Damien Miller7684ee12000-03-17 23:40:15 +1100343Any new hosts are automatically added to the user's file.
344If a host's identification
Damien Miller32aa1441999-10-29 09:15:49 +1000345ever changes,
346.Nm
347warns about this and disables password authentication to prevent a
Damien Miller7684ee12000-03-17 23:40:15 +1100348trojan horse from getting the user's password.
349Another purpose of
Damien Miller32aa1441999-10-29 09:15:49 +1000350this mechanism is to prevent man-in-the-middle attacks which could
Damien Miller7684ee12000-03-17 23:40:15 +1100351otherwise be used to circumvent the encryption.
352The
Damien Miller32aa1441999-10-29 09:15:49 +1000353.Cm StrictHostKeyChecking
354option (see below) can be used to prevent logins to machines whose
355host key is not known or has changed.
Damien Miller0bc1bd82000-11-13 22:57:25 +1100356.Pp
357The options are as follows:
Damien Miller32aa1441999-10-29 09:15:49 +1000358.Bl -tag -width Ds
359.It Fl a
Damien Miller450a7a12000-03-26 13:04:51 +1000360Disables forwarding of the authentication agent connection.
Damien Millerb1715dc2000-05-30 13:44:51 +1000361.It Fl A
362Enables forwarding of the authentication agent connection.
363This can also be specified on a per-host basis in a configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000364.It Fl c Ar blowfish|3des
Damien Miller22c77262000-04-13 12:26:34 +1000365Selects the cipher to use for encrypting the session.
Damien Miller32aa1441999-10-29 09:15:49 +1000366.Ar 3des
Damien Miller7684ee12000-03-17 23:40:15 +1100367is used by default.
Damien Miller22c77262000-04-13 12:26:34 +1000368It is believed to be secure.
Damien Miller32aa1441999-10-29 09:15:49 +1000369.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
Damien Miller69b69aa2000-10-28 14:19:58 +1100373cipher which is no longer fully supported in
Damien Miller30c3d422000-05-09 11:02:59 +1000374.Nm ssh .
Damien Miller32aa1441999-10-29 09:15:49 +1000375.Ar blowfish
376is a fast block cipher, it appears very secure and is much faster than
Damien Miller7684ee12000-03-17 23:40:15 +1100377.Ar 3des .
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +0000378.It Fl c Ar cipher_spec
Damien Miller30c3d422000-05-09 11:02:59 +1000379Additionally, for protocol version 2 a comma-separated list of ciphers can
Damien Miller874d77b2000-10-14 16:23:11 +1100380be specified in order of preference.
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +0000381See
382.Cm Ciphers
383for more information.
Damien Miller32aa1441999-10-29 09:15:49 +1000384.It Fl e Ar ch|^ch|none
385Sets the escape character for sessions with a pty (default:
386.Ql ~ ) .
Damien Miller7684ee12000-03-17 23:40:15 +1100387The escape character is only recognized at the beginning of a line.
388The escape character followed by a dot
Damien Miller32aa1441999-10-29 09:15:49 +1000389.Pq Ql \&.
390closes the connection, followed
391by control-Z suspends the connection, and followed by itself sends the
Damien Miller7684ee12000-03-17 23:40:15 +1100392escape character once.
393Setting the character to
Damien Miller32aa1441999-10-29 09:15:49 +1000394.Dq none
395disables any escapes and makes the session fully transparent.
396.It Fl f
397Requests
398.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100399to go to background just before command execution.
400This is useful if
Damien Miller32aa1441999-10-29 09:15:49 +1000401.Nm
402is going to ask for passwords or passphrases, but the user
Damien Miller7684ee12000-03-17 23:40:15 +1100403wants it in the background.
Damien Miller22c77262000-04-13 12:26:34 +1000404This implies
Damien Miller32aa1441999-10-29 09:15:49 +1000405.Fl n .
406The recommended way to start X11 programs at a remote site is with
407something like
408.Ic ssh -f host xterm .
Damien Miller396691a2000-01-20 22:44:08 +1100409.It Fl g
410Allows remote hosts to connect to local forwarded ports.
Damien Miller32aa1441999-10-29 09:15:49 +1000411.It Fl i Ar identity_file
Damien Miller22c77262000-04-13 12:26:34 +1000412Selects the file from which the identity (private key) for
Damien Miller0bc1bd82000-11-13 22:57:25 +1100413RSA or DSA authentication is read.
Damien Miller22c77262000-04-13 12:26:34 +1000414Default is
Damien Millere247cc42000-05-07 12:03:14 +1000415.Pa $HOME/.ssh/identity
Damien Miller7684ee12000-03-17 23:40:15 +1100416in the user's home directory.
417Identity files may also be specified on
418a per-host basis in the configuration file.
419It is possible to have multiple
Damien Miller32aa1441999-10-29 09:15:49 +1000420.Fl i
421options (and multiple identities specified in
422configuration files).
Damien Miller32aa1441999-10-29 09:15:49 +1000423.It Fl k
Damien Miller450a7a12000-03-26 13:04:51 +1000424Disables forwarding of Kerberos tickets and AFS tokens.
425This may also be specified on a per-host basis in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000426.It Fl l Ar login_name
Damien Miller7684ee12000-03-17 23:40:15 +1100427Specifies the user to log in as on the remote machine.
428This also may be specified on a per-host basis in the configuration file.
Ben Lindstrom06b33aa2001-02-15 03:01:59 +0000429.It Fl m Ar mac_spec
430Additionally, for protocol version 2 a comma-separated list of MAC
431(message authentication code) algorithms can
432be specified in order of preference.
433See the
434.Cm MACs
435keyword for more information.
Damien Miller32aa1441999-10-29 09:15:49 +1000436.It Fl n
437Redirects stdin from
438.Pa /dev/null
439(actually, prevents reading from stdin).
440This must be used when
441.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100442is run in the background.
443A common trick is to use this to run X11 programs on a remote machine.
444For example,
Damien Miller32aa1441999-10-29 09:15:49 +1000445.Ic ssh -n shadows.cs.hut.fi emacs &
446will start an emacs on shadows.cs.hut.fi, and the X11
447connection will be automatically forwarded over an encrypted channel.
448The
449.Nm
450program will be put in the background.
451(This does not work if
452.Nm
453needs to ask for a password or passphrase; see also the
454.Fl f
455option.)
Damien Millerdcb6ecd2000-05-17 22:34:22 +1000456.It Fl N
457Do not execute a remote command.
Ben Lindstromc72745a2000-12-02 19:03:54 +0000458This is useful if you just want to forward ports
Damien Millerdcb6ecd2000-05-17 22:34:22 +1000459(protocol version 2 only).
Damien Miller32aa1441999-10-29 09:15:49 +1000460.It Fl o Ar option
461Can be used to give options in the format used in the config file.
462This is useful for specifying options for which there is no separate
Damien Miller7684ee12000-03-17 23:40:15 +1100463command-line flag.
464The option has the same format as a line in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000465.It Fl p Ar port
Damien Miller7684ee12000-03-17 23:40:15 +1100466Port to connect to on the remote host.
467This can be specified on a
Damien Miller32aa1441999-10-29 09:15:49 +1000468per-host basis in the configuration file.
469.It Fl P
470Use a non-privileged port for outgoing connections.
471This can be used if your firewall does
472not permit connections from privileged ports.
Damien Millera34a28b1999-12-14 10:47:15 +1100473Note that this option turns off
Damien Miller32aa1441999-10-29 09:15:49 +1000474.Cm RhostsAuthentication
475and
Kevin Stevesfcec7f82000-12-15 19:55:48 +0000476.Cm RhostsRSAAuthentication
477for older servers.
Damien Miller32aa1441999-10-29 09:15:49 +1000478.It Fl q
Damien Miller7684ee12000-03-17 23:40:15 +1100479Quiet mode.
480Causes all warning and diagnostic messages to be suppressed.
481Only fatal errors are displayed.
Damien Miller832562e2001-01-30 09:30:01 +1100482.It Fl s
483May be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the use
484of SSH as a secure transport for other application (eg. sftp). The
485subsystem is specified as the remote command.
Damien Miller32aa1441999-10-29 09:15:49 +1000486.It Fl t
Damien Miller7684ee12000-03-17 23:40:15 +1100487Force pseudo-tty allocation.
Damien Miller450a7a12000-03-26 13:04:51 +1000488This can be used to execute arbitrary
Damien Miller7684ee12000-03-17 23:40:15 +1100489screen-based programs on a remote machine, which can be very useful,
490e.g., when implementing menu services.
Ben Lindstrom4dccfa52000-12-28 16:40:05 +0000491Multiple
492.Fl t
493options force tty allocation, even if
494.Nm
495has no local tty.
Damien Millerdcb6ecd2000-05-17 22:34:22 +1000496.It Fl T
Ben Lindstromc72745a2000-12-02 19:03:54 +0000497Disable pseudo-tty allocation.
Damien Miller32aa1441999-10-29 09:15:49 +1000498.It Fl v
Damien Miller7684ee12000-03-17 23:40:15 +1100499Verbose mode.
500Causes
Damien Miller32aa1441999-10-29 09:15:49 +1000501.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100502to print debugging messages about its progress.
503This is helpful in
Damien Miller32aa1441999-10-29 09:15:49 +1000504debugging connection, authentication, and configuration problems.
Ben Lindstrom4dccfa52000-12-28 16:40:05 +0000505Multiple
506.Fl v
507options increases the verbosity.
Damien Miller874d77b2000-10-14 16:23:11 +1100508Maximum is 3.
Damien Miller32aa1441999-10-29 09:15:49 +1000509.It Fl x
Damien Miller7684ee12000-03-17 23:40:15 +1100510Disables X11 forwarding.
Damien Miller32aa1441999-10-29 09:15:49 +1000511.It Fl X
512Enables X11 forwarding.
Damien Millerb1715dc2000-05-30 13:44:51 +1000513This can also be specified on a per-host basis in a configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000514.It Fl C
515Requests compression of all data (including stdin, stdout, stderr, and
Damien Miller7684ee12000-03-17 23:40:15 +1100516data for forwarded X11 and TCP/IP connections).
517The compression algorithm is the same used by
Damien Miller396691a2000-01-20 22:44:08 +1100518.Xr gzip 1 ,
519and the
Damien Miller32aa1441999-10-29 09:15:49 +1000520.Dq level
521can be controlled by the
522.Cm CompressionLevel
Damien Miller7684ee12000-03-17 23:40:15 +1100523option (see below).
524Compression is desirable on modem lines and other
Damien Miller32aa1441999-10-29 09:15:49 +1000525slow connections, but will only slow down things on fast networks.
526The default value can be set on a host-by-host basis in the
527configuration files; see the
528.Cm Compress
529option below.
530.It Fl L Ar port:host:hostport
531Specifies that the given port on the local (client) host is to be
Damien Miller7684ee12000-03-17 23:40:15 +1100532forwarded to the given host and port on the remote side.
533This works by allocating a socket to listen to
Damien Miller32aa1441999-10-29 09:15:49 +1000534.Ar port
535on the local side, and whenever a connection is made to this port, the
536connection is forwarded over the secure channel, and a connection is
537made to
Damien Miller34132e52000-01-14 15:45:46 +1100538.Ar host
539port
540.Ar hostport
Damien Miller7684ee12000-03-17 23:40:15 +1100541from the remote machine.
542Port forwardings can also be specified in the configuration file.
543Only root can forward privileged ports.
Damien Miller34132e52000-01-14 15:45:46 +1100544IPv6 addresses can be specified with an alternative syntax:
545.Ar port/host/hostport
Damien Miller32aa1441999-10-29 09:15:49 +1000546.It Fl R Ar port:host:hostport
547Specifies that the given port on the remote (server) host is to be
Damien Miller7684ee12000-03-17 23:40:15 +1100548forwarded to the given host and port on the local side.
549This works by allocating a socket to listen to
Damien Miller32aa1441999-10-29 09:15:49 +1000550.Ar port
551on the remote side, and whenever a connection is made to this port, the
552connection is forwarded over the secure channel, and a connection is
553made to
Damien Miller34132e52000-01-14 15:45:46 +1100554.Ar host
555port
556.Ar hostport
Damien Miller7684ee12000-03-17 23:40:15 +1100557from the local machine.
558Port forwardings can also be specified in the configuration file.
559Privileged ports can be forwarded only when
Damien Miller32aa1441999-10-29 09:15:49 +1000560logging in as root on the remote machine.
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +0000561.It Fl 1
562Forces
563.Nm
564to try protocol version 1 only.
Damien Miller4af51302000-04-16 11:18:38 +1000565.It Fl 2
566Forces
567.Nm
Damien Millere247cc42000-05-07 12:03:14 +1000568to try protocol version 2 only.
Damien Miller34132e52000-01-14 15:45:46 +1100569.It Fl 4
570Forces
571.Nm
572to use IPv4 addresses only.
573.It Fl 6
574Forces
575.Nm
576to use IPv6 addresses only.
Damien Miller32aa1441999-10-29 09:15:49 +1000577.El
578.Sh CONFIGURATION FILES
579.Nm
580obtains configuration data from the following sources (in this order):
581command line options, user's configuration file
582.Pq Pa $HOME/.ssh/config ,
583and system-wide configuration file
Damien Miller886c63a2000-01-20 23:13:36 +1100584.Pq Pa /etc/ssh_config .
Damien Miller32aa1441999-10-29 09:15:49 +1000585For each parameter, the first obtained value
Damien Miller7684ee12000-03-17 23:40:15 +1100586will be used.
587The configuration files contain sections bracketed by
588.Dq Host
589specifications, and that section is only applied for hosts that
590match one of the patterns given in the specification.
591The matched host name is the one given on the command line.
Damien Miller32aa1441999-10-29 09:15:49 +1000592.Pp
593Since the first obtained value for each parameter is used, more
594host-specific declarations should be given near the beginning of the
595file, and general defaults at the end.
596.Pp
597The configuration file has the following format:
598.Pp
599Empty lines and lines starting with
600.Ql #
601are comments.
602.Pp
603Otherwise a line is of the format
604.Dq keyword arguments .
605The possible
606keywords and their meanings are as follows (note that the
607configuration files are case-sensitive):
608.Bl -tag -width Ds
609.It Cm Host
610Restricts the following declarations (up to the next
611.Cm Host
612keyword) to be only for those hosts that match one of the patterns
613given after the keyword.
614.Ql \&*
615and
616.Ql ?
617can be used as wildcards in the
Damien Miller7684ee12000-03-17 23:40:15 +1100618patterns.
619A single
Damien Miller32aa1441999-10-29 09:15:49 +1000620.Ql \&*
621as a pattern can be used to provide global
Damien Miller7684ee12000-03-17 23:40:15 +1100622defaults for all hosts.
623The host is the
Damien Miller32aa1441999-10-29 09:15:49 +1000624.Ar hostname
625argument given on the command line (i.e., the name is not converted to
626a canonicalized host name before matching).
627.It Cm AFSTokenPassing
Damien Miller450a7a12000-03-26 13:04:51 +1000628Specifies whether to pass AFS tokens to remote host.
629The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000630.Dq yes
631or
632.Dq no .
633.It Cm BatchMode
634If set to
635.Dq yes ,
Damien Miller7684ee12000-03-17 23:40:15 +1100636passphrase/password querying will be disabled.
637This option is useful in scripts and other batch jobs where you have no
638user to supply the password.
639The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000640.Dq yes
641or
642.Dq no .
Damien Miller396691a2000-01-20 22:44:08 +1100643.It Cm CheckHostIP
644If this flag is set to
645.Dq yes ,
646ssh will additionally check the host ip address in the
647.Pa known_hosts
Damien Miller450a7a12000-03-26 13:04:51 +1000648file.
649This allows ssh to detect if a host key changed due to DNS spoofing.
Damien Miller396691a2000-01-20 22:44:08 +1100650If the option is set to
651.Dq no ,
652the check will not be executed.
Damien Miller32aa1441999-10-29 09:15:49 +1000653.It Cm Cipher
Damien Miller50a41ed2000-10-16 12:14:42 +1100654Specifies the cipher to use for encrypting the session
Damien Miller69b69aa2000-10-28 14:19:58 +1100655in protocol version 1.
Damien Miller7684ee12000-03-17 23:40:15 +1100656Currently,
Damien Miller69b69aa2000-10-28 14:19:58 +1100657.Dq blowfish
Damien Miller32aa1441999-10-29 09:15:49 +1000658and
659.Dq 3des
Damien Miller7684ee12000-03-17 23:40:15 +1100660are supported.
661The default is
Damien Miller32aa1441999-10-29 09:15:49 +1000662.Dq 3des .
Damien Miller22c77262000-04-13 12:26:34 +1000663.It Cm Ciphers
664Specifies the ciphers allowed for protocol version 2
665in order of preference.
666Multiple ciphers must be comma-separated.
667The default is
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +0000668.Pp
669.Bd -literal
Ben Lindstromec26fb12001-03-06 01:05:23 +0000670 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +0000671 aes192-cbc,aes256-cbc,rijndael128-cbc,rijndael192-cbc,
672 rijndael256-cbc,rijndael-cbc@lysator.liu.se''
673.Ed
Damien Miller32aa1441999-10-29 09:15:49 +1000674.It Cm Compression
Damien Miller7684ee12000-03-17 23:40:15 +1100675Specifies whether to use compression.
676The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000677.Dq yes
678or
679.Dq no .
680.It Cm CompressionLevel
Damien Miller7684ee12000-03-17 23:40:15 +1100681Specifies the compression level to use if compression is enable.
682The argument must be an integer from 1 (fast) to 9 (slow, best).
683The default level is 6, which is good for most applications.
684The meaning of the values is the same as in
Damien Miller396691a2000-01-20 22:44:08 +1100685.Xr gzip 1 .
Damien Miller32aa1441999-10-29 09:15:49 +1000686.It Cm ConnectionAttempts
687Specifies the number of tries (one per second) to make before falling
Damien Miller7684ee12000-03-17 23:40:15 +1100688back to rsh or exiting.
689The argument must be an integer.
690This may be useful in scripts if the connection sometimes fails.
Damien Miller0bc1bd82000-11-13 22:57:25 +1100691.It Cm PubkeyAuthentication
692Specifies whether to try public key authentication.
Damien Millere247cc42000-05-07 12:03:14 +1000693The argument to this keyword must be
694.Dq yes
695or
696.Dq no .
Damien Millere247cc42000-05-07 12:03:14 +1000697Note that this option applies to protocol version 2 only.
Damien Miller32aa1441999-10-29 09:15:49 +1000698.It Cm EscapeChar
699Sets the escape character (default:
700.Ql ~ ) .
701The escape character can also
Damien Miller7684ee12000-03-17 23:40:15 +1100702be set on the command line.
703The argument should be a single character,
Damien Miller32aa1441999-10-29 09:15:49 +1000704.Ql ^
705followed by a letter, or
706.Dq none
707to disable the escape
708character entirely (making the connection transparent for binary
709data).
Damien Miller22c77262000-04-13 12:26:34 +1000710.It Cm FallBackToRsh
Damien Miller32aa1441999-10-29 09:15:49 +1000711Specifies that if connecting via
712.Nm
713fails due to a connection refused error (there is no
714.Xr sshd 8
Damien Miller22c77262000-04-13 12:26:34 +1000715listening on the remote host),
Damien Miller32aa1441999-10-29 09:15:49 +1000716.Xr rsh 1
717should automatically be used instead (after a suitable warning about
Damien Miller7684ee12000-03-17 23:40:15 +1100718the session being unencrypted).
719The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000720.Dq yes
721or
722.Dq no .
723.It Cm ForwardAgent
724Specifies whether the connection to the authentication agent (if any)
Damien Miller7684ee12000-03-17 23:40:15 +1100725will be forwarded to the remote machine.
726The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000727.Dq yes
728or
729.Dq no .
Damien Millerb1715dc2000-05-30 13:44:51 +1000730The default is
731.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000732.It Cm ForwardX11
733Specifies whether X11 connections will be automatically redirected
Damien Miller22c77262000-04-13 12:26:34 +1000734over the secure channel and
Damien Miller32aa1441999-10-29 09:15:49 +1000735.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +1100736set.
Damien Miller22c77262000-04-13 12:26:34 +1000737The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000738.Dq yes
739or
740.Dq no .
Damien Miller98c7ad62000-03-09 21:27:49 +1100741The default is
742.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000743.It Cm GatewayPorts
744Specifies whether remote hosts are allowed to connect to local
745forwarded ports.
746The argument must be
747.Dq yes
748or
749.Dq no .
750The default is
751.Dq no .
752.It Cm GlobalKnownHostsFile
Ben Lindstrom1e621742001-03-06 01:10:53 +0000753Specifies a file to use for the protocol version 1 global
754host key database instead of
Damien Miller886c63a2000-01-20 23:13:36 +1100755.Pa /etc/ssh_known_hosts .
Ben Lindstrom1e621742001-03-06 01:10:53 +0000756.It Cm GlobalKnownHostsFile2
757Specifies a file to use for the protocol version 2 global
758host key database instead of
759.Pa /etc/ssh_known_hosts2 .
Ben Lindstrom4dccfa52000-12-28 16:40:05 +0000760.It Cm HostKeyAlias
761Specifies an alias that should be used instead of the
762real host name when looking up or saving the host key
Damien Miller33804262001-02-04 23:20:18 +1100763in the known_hosts files.
764This option is useful for tunneling ssh connections
Ben Lindstrom4dccfa52000-12-28 16:40:05 +0000765or if you have multiple servers running on a single host.
Damien Miller32aa1441999-10-29 09:15:49 +1000766.It Cm HostName
Damien Miller7684ee12000-03-17 23:40:15 +1100767Specifies the real host name to log into.
768This can be used to specify nicknames or abbreviations for hosts.
769Default is the name given on the command line.
770Numeric IP addresses are also permitted (both on the command line and in
Damien Miller32aa1441999-10-29 09:15:49 +1000771.Cm HostName
772specifications).
773.It Cm IdentityFile
774Specifies the file from which the user's RSA authentication identity
775is read (default
Damien Millere247cc42000-05-07 12:03:14 +1000776.Pa $HOME/.ssh/identity
Damien Miller32aa1441999-10-29 09:15:49 +1000777in the user's home directory).
778Additionally, any identities represented by the authentication agent
Damien Miller7684ee12000-03-17 23:40:15 +1100779will be used for authentication.
780The file name may use the tilde
781syntax to refer to a user's home directory.
782It is possible to have
Damien Miller32aa1441999-10-29 09:15:49 +1000783multiple identity files specified in configuration files; all these
784identities will be tried in sequence.
785.It Cm KeepAlive
786Specifies whether the system should send keepalive messages to the
Damien Miller7684ee12000-03-17 23:40:15 +1100787other side.
788If they are sent, death of the connection or crash of one
789of the machines will be properly noticed.
790However, this means that
Damien Miller32aa1441999-10-29 09:15:49 +1000791connections will die if the route is down temporarily, and some people
Damien Miller450a7a12000-03-26 13:04:51 +1000792find it annoying.
Damien Miller32aa1441999-10-29 09:15:49 +1000793.Pp
794The default is
795.Dq yes
796(to send keepalives), and the client will notice
Damien Miller7684ee12000-03-17 23:40:15 +1100797if the network goes down or the remote host dies.
798This is important in scripts, and many users want it too.
Damien Miller32aa1441999-10-29 09:15:49 +1000799.Pp
800To disable keepalives, the value should be set to
801.Dq no
802in both the server and the client configuration files.
803.It Cm KerberosAuthentication
Damien Miller450a7a12000-03-26 13:04:51 +1000804Specifies whether Kerberos authentication will be used.
805The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000806.Dq yes
807or
808.Dq no .
809.It Cm KerberosTgtPassing
Damien Miller450a7a12000-03-26 13:04:51 +1000810Specifies whether a Kerberos TGT will be forwarded to the server.
811This will only work if the Kerberos server is actually an AFS kaserver.
812The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000813.Dq yes
814or
815.Dq no .
816.It Cm LocalForward
817Specifies that a TCP/IP port on the local machine be forwarded over
Damien Miller7684ee12000-03-17 23:40:15 +1100818the secure channel to given host:port from the remote machine.
819The first argument must be a port number, and the second must be
820host:port.
821Multiple forwardings may be specified, and additional
822forwardings can be given on the command line.
823Only the superuser can forward privileged ports.
Damien Miller5ce662a1999-11-11 17:57:39 +1100824.It Cm LogLevel
825Gives the verbosity level that is used when logging messages from
826.Nm ssh .
827The possible values are:
Ben Lindstromdb65e8f2001-01-19 04:26:52 +0000828QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
829The default is INFO.
Ben Lindstrom06b33aa2001-02-15 03:01:59 +0000830.It Cm MACs
831Specifies the MAC (message authentication code) algorithms
832in order of preference.
833The MAC algorithm is used in protocol version 2
834for data integrity protection.
835Multiple algorithms must be comma-separated.
836The default is
837.Pp
838.Bd -literal
Ben Lindstromec26fb12001-03-06 01:05:23 +0000839 ``hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,
Ben Lindstrom06b33aa2001-02-15 03:01:59 +0000840 hmac-sha1-96,hmac-md5-96''
841.Ed
Damien Miller32aa1441999-10-29 09:15:49 +1000842.It Cm NumberOfPasswordPrompts
Damien Miller450a7a12000-03-26 13:04:51 +1000843Specifies the number of password prompts before giving up.
844The argument to this keyword must be an integer.
845Default is 3.
Damien Miller396691a2000-01-20 22:44:08 +1100846.It Cm PasswordAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100847Specifies whether to use password authentication.
848The argument to this keyword must be
Damien Miller396691a2000-01-20 22:44:08 +1100849.Dq yes
850or
851.Dq no .
Damien Millere247cc42000-05-07 12:03:14 +1000852Note that this option applies to both protocol version 1 and 2.
Damien Miller32aa1441999-10-29 09:15:49 +1000853.It Cm Port
Damien Miller7684ee12000-03-17 23:40:15 +1100854Specifies the port number to connect on the remote host.
855Default is 22.
Damien Miller22c77262000-04-13 12:26:34 +1000856.It Cm Protocol
857Specifies the protocol versions
858.Nm
859should support in order of preference.
860The possible values are
861.Dq 1
862and
863.Dq 2 .
864Multiple versions must be comma-separated.
865The default is
Damien Millere247cc42000-05-07 12:03:14 +1000866.Dq 1,2 .
867This means that
868.Nm
869tries version 1 and falls back to version 2
Damien Miller30c3d422000-05-09 11:02:59 +1000870if version 1 is not available.
Damien Miller32aa1441999-10-29 09:15:49 +1000871.It Cm ProxyCommand
Damien Miller7684ee12000-03-17 23:40:15 +1100872Specifies the command to use to connect to the server.
873The command
874string extends to the end of the line, and is executed with
875.Pa /bin/sh .
876In the command string,
877.Ql %h
878will be substituted by the host name to
879connect and
880.Ql %p
881by the port.
882The command can be basically anything,
883and should read from its standard input and write to its standard output.
884It should eventually connect an
Damien Miller32aa1441999-10-29 09:15:49 +1000885.Xr sshd 8
886server running on some machine, or execute
887.Ic sshd -i
Damien Miller7684ee12000-03-17 23:40:15 +1100888somewhere.
889Host key management will be done using the
Damien Miller32aa1441999-10-29 09:15:49 +1000890HostName of the host being connected (defaulting to the name typed by
891the user).
Damien Milleraae6c611999-12-06 11:47:28 +1100892Note that
893.Cm CheckHostIP
894is not available for connects with a proxy command.
Damien Miller32aa1441999-10-29 09:15:49 +1000895.Pp
896.It Cm RemoteForward
897Specifies that a TCP/IP port on the remote machine be forwarded over
Damien Miller7684ee12000-03-17 23:40:15 +1100898the secure channel to given host:port from the local machine.
899The first argument must be a port number, and the second must be
900host:port.
901Multiple forwardings may be specified, and additional
902forwardings can be given on the command line.
903Only the superuser can forward privileged ports.
Damien Miller32aa1441999-10-29 09:15:49 +1000904.It Cm RhostsAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100905Specifies whether to try rhosts based authentication.
906Note that this
Damien Miller32aa1441999-10-29 09:15:49 +1000907declaration only affects the client side and has no effect whatsoever
Damien Miller7684ee12000-03-17 23:40:15 +1100908on security.
909Disabling rhosts authentication may reduce
Damien Miller32aa1441999-10-29 09:15:49 +1000910authentication time on slow connections when rhosts authentication is
Damien Miller7684ee12000-03-17 23:40:15 +1100911not used.
912Most servers do not permit RhostsAuthentication because it
913is not secure (see RhostsRSAAuthentication).
914The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000915.Dq yes
916or
917.Dq no .
918.It Cm RhostsRSAAuthentication
919Specifies whether to try rhosts based authentication with RSA host
Damien Miller7684ee12000-03-17 23:40:15 +1100920authentication.
921This is the primary authentication method for most sites.
922The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000923.Dq yes
924or
925.Dq no .
926.It Cm RSAAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100927Specifies whether to try RSA authentication.
928The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000929.Dq yes
930or
931.Dq no .
932RSA authentication will only be
933attempted if the identity file exists, or an authentication agent is
934running.
Damien Millere247cc42000-05-07 12:03:14 +1000935Note that this option applies to protocol version 1 only.
Damien Miller33804262001-02-04 23:20:18 +1100936.It Cm ChallengeResponseAuthentication
937Specifies whether to use challenge response authentication.
938Currently there is only support for
Damien Miller95def091999-11-25 00:26:21 +1100939.Xr skey 1
Damien Miller7684ee12000-03-17 23:40:15 +1100940authentication.
941The argument to this keyword must be
Damien Miller95def091999-11-25 00:26:21 +1100942.Dq yes
943or
944.Dq no .
945The default is
946.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000947.It Cm StrictHostKeyChecking
948If this flag is set to
Damien Miller22c77262000-04-13 12:26:34 +1000949.Dq yes ,
Damien Miller32aa1441999-10-29 09:15:49 +1000950.Nm
Ben Lindstromeb930d42001-01-29 08:37:08 +0000951will never automatically add host keys to the
Damien Miller32aa1441999-10-29 09:15:49 +1000952.Pa $HOME/.ssh/known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000953and
954.Pa $HOME/.ssh/known_hosts2
Ben Lindstromeb930d42001-01-29 08:37:08 +0000955files, and refuses to connect to hosts whose host key has changed.
Damien Miller7684ee12000-03-17 23:40:15 +1100956This provides maximum protection against trojan horse attacks.
957However, it can be somewhat annoying if you don't have good
Damien Miller886c63a2000-01-20 23:13:36 +1100958.Pa /etc/ssh_known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000959and
960.Pa /etc/ssh_known_hosts2
Damien Miller32aa1441999-10-29 09:15:49 +1000961files installed and frequently
Ben Lindstromeb930d42001-01-29 08:37:08 +0000962connect to new hosts.
963This option forces the user to manually
964add all new hosts.
965If this flag is set to
966.Dq no ,
967.Nm
968will automatically add new host keys to the
969user known hosts files.
970If this flag is set to
971.Dq ask ,
972new host keys
973will be added to the user known host files only after the user
974has confirmed that is what they really want to do, and
975.Nm
976will refuse to connect to hosts whose host key has changed.
Damien Miller7684ee12000-03-17 23:40:15 +1100977The host keys of
Ben Lindstromeb930d42001-01-29 08:37:08 +0000978known hosts will be verified automatically in all cases.
Damien Miller7684ee12000-03-17 23:40:15 +1100979The argument must be
Ben Lindstromeb930d42001-01-29 08:37:08 +0000980.Dq yes ,
981.Dq no
Damien Miller32aa1441999-10-29 09:15:49 +1000982or
Ben Lindstromeb930d42001-01-29 08:37:08 +0000983.Dq ask .
984The default is
985.Dq ask .
Damien Miller32aa1441999-10-29 09:15:49 +1000986.It Cm UsePrivilegedPort
987Specifies whether to use a privileged port for outgoing connections.
988The argument must be
989.Dq yes
990or
991.Dq no .
992The default is
993.Dq yes .
994Note that setting this option to
995.Dq no
Damien Millera34a28b1999-12-14 10:47:15 +1100996turns off
Damien Miller32aa1441999-10-29 09:15:49 +1000997.Cm RhostsAuthentication
998and
Kevin Stevesfcec7f82000-12-15 19:55:48 +0000999.Cm RhostsRSAAuthentication
1000for older servers.
Damien Miller396691a2000-01-20 22:44:08 +11001001.It Cm User
Damien Miller7684ee12000-03-17 23:40:15 +11001002Specifies the user to log in as.
1003This can be useful if you have a different user name on different machines.
1004This saves the trouble of
Damien Miller396691a2000-01-20 22:44:08 +11001005having to remember to give the user name on the command line.
1006.It Cm UserKnownHostsFile
Ben Lindstrom1e621742001-03-06 01:10:53 +00001007Specifies a file to use for the protocol version 1 user
1008host key database instead of
Damien Miller396691a2000-01-20 22:44:08 +11001009.Pa $HOME/.ssh/known_hosts .
Ben Lindstrom1e621742001-03-06 01:10:53 +00001010.It Cm UserKnownHostsFile2
1011Specifies a file to use for the protocol version 2 user
1012host key database instead of
1013.Pa $HOME/.ssh/known_hosts2 .
Damien Miller32aa1441999-10-29 09:15:49 +10001014.It Cm UseRsh
Damien Miller7684ee12000-03-17 23:40:15 +11001015Specifies that rlogin/rsh should be used for this host.
1016It is possible that the host does not at all support the
Damien Miller32aa1441999-10-29 09:15:49 +10001017.Nm
Damien Miller7684ee12000-03-17 23:40:15 +11001018protocol.
1019This causes
Damien Miller32aa1441999-10-29 09:15:49 +10001020.Nm
Damien Miller7684ee12000-03-17 23:40:15 +11001021to immediately execute
Damien Miller32aa1441999-10-29 09:15:49 +10001022.Xr rsh 1 .
1023All other options (except
1024.Cm HostName )
Damien Miller7684ee12000-03-17 23:40:15 +11001025are ignored if this has been specified.
1026The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +10001027.Dq yes
1028or
1029.Dq no .
Damien Millerd3a18572000-06-07 19:55:44 +10001030.It Cm XAuthLocation
1031Specifies the location of the
1032.Xr xauth 1
1033program.
1034The default is
1035.Pa /usr/X11R6/bin/xauth .
Damien Miller7b28dc52000-09-05 13:34:53 +11001036.El
Damien Miller32aa1441999-10-29 09:15:49 +10001037.Sh ENVIRONMENT
1038.Nm
1039will normally set the following environment variables:
1040.Bl -tag -width Ds
1041.It Ev DISPLAY
1042The
1043.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +11001044variable indicates the location of the X11 server.
Damien Miller22c77262000-04-13 12:26:34 +10001045It is automatically set by
Damien Miller32aa1441999-10-29 09:15:49 +10001046.Nm
1047to point to a value of the form
1048.Dq hostname:n
1049where hostname indicates
Damien Miller7684ee12000-03-17 23:40:15 +11001050the host where the shell runs, and n is an integer >= 1.
1051.Nm
1052uses this special value to forward X11 connections over the secure
1053channel.
1054The user should normally not set DISPLAY explicitly, as that
Damien Miller32aa1441999-10-29 09:15:49 +10001055will render the X11 connection insecure (and will require the user to
1056manually copy any required authorization cookies).
1057.It Ev HOME
1058Set to the path of the user's home directory.
1059.It Ev LOGNAME
1060Synonym for
1061.Ev USER ;
1062set for compatibility with systems that use this variable.
1063.It Ev MAIL
1064Set to point the user's mailbox.
Damien Miller7684ee12000-03-17 23:40:15 +11001065.It Ev PATH
Damien Miller32aa1441999-10-29 09:15:49 +10001066Set to the default
1067.Ev PATH ,
1068as specified when compiling
1069.Nm ssh .
1070.It Ev SSH_AUTH_SOCK
1071indicates the path of a unix-domain socket used to communicate with the
1072agent.
1073.It Ev SSH_CLIENT
Damien Miller7684ee12000-03-17 23:40:15 +11001074Identifies the client end of the connection.
1075The variable contains
Damien Miller32aa1441999-10-29 09:15:49 +10001076three space-separated values: client ip-address, client port number,
1077and server port number.
Ben Lindstrom4dccfa52000-12-28 16:40:05 +00001078.It Ev SSH_ORIGINAL_COMMAND
1079The variable contains the original command line if a forced command
1080is executed.
1081It can be used to extract the original arguments.
Damien Miller32aa1441999-10-29 09:15:49 +10001082.It Ev SSH_TTY
1083This is set to the name of the tty (path to the device) associated
Damien Miller7684ee12000-03-17 23:40:15 +11001084with the current shell or command.
1085If the current session has no tty,
Damien Miller32aa1441999-10-29 09:15:49 +10001086this variable is not set.
1087.It Ev TZ
1088The timezone variable is set to indicate the present timezone if it
Damien Miller942da032000-08-18 13:59:06 +10001089was set when the daemon was started (i.e., the daemon passes the value
Damien Miller32aa1441999-10-29 09:15:49 +10001090on to new connections).
1091.It Ev USER
1092Set to the name of the user logging in.
1093.El
1094.Pp
Damien Miller22c77262000-04-13 12:26:34 +10001095Additionally,
Damien Miller32aa1441999-10-29 09:15:49 +10001096.Nm
Damien Miller22c77262000-04-13 12:26:34 +10001097reads
1098.Pa $HOME/.ssh/environment ,
Damien Miller32aa1441999-10-29 09:15:49 +10001099and adds lines of the format
1100.Dq VARNAME=value
1101to the environment.
1102.Sh FILES
Damien Miller98c7ad62000-03-09 21:27:49 +11001103.Bl -tag -width Ds
Ben Lindstrom1e621742001-03-06 01:10:53 +00001104.It Pa $HOME/.ssh/known_hosts, $HOME/.ssh/known_hosts2
Damien Miller32aa1441999-10-29 09:15:49 +10001105Records host keys for all hosts the user has logged into (that are not
1106in
Ben Lindstrom1e621742001-03-06 01:10:53 +00001107.Pa /etc/ssh_known_hosts
1108for protocol version 1 or
1109.Pa /etc/ssh_known_hosts2
1110for protocol version 2).
Damien Miller32aa1441999-10-29 09:15:49 +10001111See
1112.Xr sshd 8 .
Damien Millere247cc42000-05-07 12:03:14 +10001113.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa
1114Contains the RSA and the DSA authentication identity of the user.
1115These files
1116contain sensitive data and should be readable by the user but not
Damien Miller32aa1441999-10-29 09:15:49 +10001117accessible by others (read/write/execute).
1118Note that
1119.Nm
Damien Millere247cc42000-05-07 12:03:14 +10001120ignores a private key file if it is accessible by others.
Damien Miller32aa1441999-10-29 09:15:49 +10001121It is possible to specify a passphrase when
1122generating the key; the passphrase will be used to encrypt the
1123sensitive part of this file using 3DES.
Damien Millere247cc42000-05-07 12:03:14 +10001124.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub
Damien Miller32aa1441999-10-29 09:15:49 +10001125Contains the public key for authentication (public part of the
Damien Miller7684ee12000-03-17 23:40:15 +11001126identity file in human-readable form).
Damien Millere247cc42000-05-07 12:03:14 +10001127The contents of the
1128.Pa $HOME/.ssh/identity.pub
1129file should be added to
Damien Miller32aa1441999-10-29 09:15:49 +10001130.Pa $HOME/.ssh/authorized_keys
1131on all machines
Damien Miller7684ee12000-03-17 23:40:15 +11001132where you wish to log in using RSA authentication.
Damien Millere247cc42000-05-07 12:03:14 +10001133The contents of the
1134.Pa $HOME/.ssh/id_dsa.pub
1135file should be added to
1136.Pa $HOME/.ssh/authorized_keys2
1137on all machines
1138where you wish to log in using DSA authentication.
1139These files are not
Damien Miller7684ee12000-03-17 23:40:15 +11001140sensitive and can (but need not) be readable by anyone.
Damien Millere247cc42000-05-07 12:03:14 +10001141These files are
Kevin Steves3c034ae2001-02-05 13:47:11 +00001142never used automatically and are not necessary; they are only provided for
Damien Miller32aa1441999-10-29 09:15:49 +10001143the convenience of the user.
1144.It Pa $HOME/.ssh/config
Damien Miller7684ee12000-03-17 23:40:15 +11001145This is the per-user configuration file.
1146The format of this file is described above.
1147This file is used by the
Damien Miller32aa1441999-10-29 09:15:49 +10001148.Nm
Damien Miller7684ee12000-03-17 23:40:15 +11001149client.
1150This file does not usually contain any sensitive information,
Damien Miller32aa1441999-10-29 09:15:49 +10001151but the recommended permissions are read/write for the user, and not
1152accessible by others.
1153.It Pa $HOME/.ssh/authorized_keys
Damien Miller7684ee12000-03-17 23:40:15 +11001154Lists the RSA keys that can be used for logging in as this user.
1155The format of this file is described in the
Damien Miller32aa1441999-10-29 09:15:49 +10001156.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001157manual page.
1158In the simplest form the format is the same as the .pub
Damien Miller32aa1441999-10-29 09:15:49 +10001159identity files (that is, each line contains the number of bits in
1160modulus, public exponent, modulus, and comment fields, separated by
Damien Miller7684ee12000-03-17 23:40:15 +11001161spaces).
1162This file is not highly sensitive, but the recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001163permissions are read/write for the user, and not accessible by others.
Damien Millere247cc42000-05-07 12:03:14 +10001164.It Pa $HOME/.ssh/authorized_keys2
Damien Miller0bc1bd82000-11-13 22:57:25 +11001165Lists the public keys (DSA/RSA) that can be used for logging in as this user.
Damien Millere247cc42000-05-07 12:03:14 +10001166This file is not highly sensitive, but the recommended
1167permissions are read/write for the user, and not accessible by others.
1168.It Pa /etc/ssh_known_hosts, /etc/ssh_known_hosts2
Damien Miller7684ee12000-03-17 23:40:15 +11001169Systemwide list of known host keys.
Damien Millere247cc42000-05-07 12:03:14 +10001170.Pa /etc/ssh_known_hosts
1171contains RSA and
1172.Pa /etc/ssh_known_hosts2
Damien Miller0bc1bd82000-11-13 22:57:25 +11001173contains DSA or RSA keys for protocol version 2.
Damien Millere247cc42000-05-07 12:03:14 +10001174These files should be prepared by the
Damien Miller32aa1441999-10-29 09:15:49 +10001175system administrator to contain the public host keys of all machines in the
Damien Miller7684ee12000-03-17 23:40:15 +11001176organization.
1177This file should be world-readable.
1178This file contains
Damien Miller32aa1441999-10-29 09:15:49 +10001179public keys, one per line, in the following format (fields separated
1180by spaces): system name, number of bits in modulus, public exponent,
Damien Miller7684ee12000-03-17 23:40:15 +11001181modulus, and optional comment field.
1182When different names are used
Damien Miller32aa1441999-10-29 09:15:49 +10001183for the same machine, all such names should be listed, separated by
Damien Miller7684ee12000-03-17 23:40:15 +11001184commas.
1185The format is described on the
Damien Miller32aa1441999-10-29 09:15:49 +10001186.Xr sshd 8
1187manual page.
1188.Pp
1189The canonical system name (as returned by name servers) is used by
1190.Xr sshd 8
1191to verify the client host when logging in; other names are needed because
1192.Nm
1193does not convert the user-supplied name to a canonical name before
1194checking the key, because someone with access to the name servers
1195would then be able to fool host authentication.
Damien Miller886c63a2000-01-20 23:13:36 +11001196.It Pa /etc/ssh_config
Damien Miller7684ee12000-03-17 23:40:15 +11001197Systemwide configuration file.
1198This file provides defaults for those
Damien Miller32aa1441999-10-29 09:15:49 +10001199values that are not specified in the user's configuration file, and
Damien Miller7684ee12000-03-17 23:40:15 +11001200for those users who do not have a configuration file.
1201This file must be world-readable.
Damien Miller32aa1441999-10-29 09:15:49 +10001202.It Pa $HOME/.rhosts
1203This file is used in
1204.Pa \&.rhosts
1205authentication to list the
Damien Miller7684ee12000-03-17 23:40:15 +11001206host/user pairs that are permitted to log in.
1207(Note that this file is
Damien Miller32aa1441999-10-29 09:15:49 +10001208also used by rlogin and rsh, which makes using this file insecure.)
1209Each line of the file contains a host name (in the canonical form
1210returned by name servers), and then a user name on that host,
Damien Miller7684ee12000-03-17 23:40:15 +11001211separated by a space.
Ben Lindstromebd888d2001-03-05 05:49:29 +00001212On some machines this file may need to be
Damien Miller32aa1441999-10-29 09:15:49 +10001213world-readable if the user's home directory is on a NFS partition,
1214because
1215.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001216reads it as root.
1217Additionally, this file must be owned by the user,
1218and must not have write permissions for anyone else.
1219The recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001220permission for most machines is read/write for the user, and not
1221accessible by others.
1222.Pp
1223Note that by default
1224.Xr sshd 8
1225will be installed so that it requires successful RSA host
Damien Miller7684ee12000-03-17 23:40:15 +11001226authentication before permitting \s+2.\s0rhosts authentication.
1227If your server machine does not have the client's host key in
Damien Miller886c63a2000-01-20 23:13:36 +11001228.Pa /etc/ssh_known_hosts ,
Damien Miller32aa1441999-10-29 09:15:49 +10001229you can store it in
1230.Pa $HOME/.ssh/known_hosts .
1231The easiest way to do this is to
1232connect back to the client from the server machine using ssh; this
Damien Millere247cc42000-05-07 12:03:14 +10001233will automatically add the host key to
Damien Miller32aa1441999-10-29 09:15:49 +10001234.Pa $HOME/.ssh/known_hosts .
1235.It Pa $HOME/.shosts
1236This file is used exactly the same way as
1237.Pa \&.rhosts .
1238The purpose for
1239having this file is to be able to use rhosts authentication with
1240.Nm
1241without permitting login with
1242.Xr rlogin 1
1243or
1244.Xr rsh 1 .
1245.It Pa /etc/hosts.equiv
1246This file is used during
Damien Miller7684ee12000-03-17 23:40:15 +11001247.Pa \&.rhosts authentication.
1248It contains
Damien Miller32aa1441999-10-29 09:15:49 +10001249canonical hosts names, one per line (the full format is described on
1250the
1251.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001252manual page).
1253If the client host is found in this file, login is
Damien Miller32aa1441999-10-29 09:15:49 +10001254automatically permitted provided client and server user names are the
Damien Miller7684ee12000-03-17 23:40:15 +11001255same.
1256Additionally, successful RSA host authentication is normally
1257required.
1258This file should only be writable by root.
Damien Miller886c63a2000-01-20 23:13:36 +11001259.It Pa /etc/shosts.equiv
Damien Miller22c77262000-04-13 12:26:34 +10001260This file is processed exactly as
Damien Miller32aa1441999-10-29 09:15:49 +10001261.Pa /etc/hosts.equiv .
1262This file may be useful to permit logins using
1263.Nm
1264but not using rsh/rlogin.
Damien Miller886c63a2000-01-20 23:13:36 +11001265.It Pa /etc/sshrc
Damien Miller32aa1441999-10-29 09:15:49 +10001266Commands in this file are executed by
1267.Nm
1268when the user logs in just before the user's shell (or command) is started.
1269See the
1270.Xr sshd 8
1271manual page for more information.
1272.It Pa $HOME/.ssh/rc
1273Commands in this file are executed by
1274.Nm
1275when the user logs in just before the user's shell (or command) is
1276started.
Damien Miller22c77262000-04-13 12:26:34 +10001277See the
Damien Miller32aa1441999-10-29 09:15:49 +10001278.Xr sshd 8
1279manual page for more information.
Damien Miller4f0fa561999-12-26 14:24:41 +11001280.It Pa $HOME/.ssh/environment
1281Contains additional definitions for environment variables, see section
1282.Sx ENVIRONMENT
1283above.
Damien Miller32aa1441999-10-29 09:15:49 +10001284.It Pa libcrypto.so.X.1
1285A version of this library which includes support for the RSA algorithm
1286is required for proper operation.
Damien Miller7b28dc52000-09-05 13:34:53 +11001287.El
Damien Miller0bc1bd82000-11-13 22:57:25 +11001288.Sh AUTHORS
Ben Lindstrom035782e2001-01-29 08:34:16 +00001289OpenSSH is a derivative of the original and free
1290ssh 1.2.12 release by Tatu Ylonen.
1291Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1292Theo de Raadt and Dug Song
1293removed many bugs, re-added newer features and
1294created OpenSSH.
1295Markus Friedl contributed the support for SSH
1296protocol versions 1.5 and 2.0.
Damien Miller32aa1441999-10-29 09:15:49 +10001297.Sh SEE ALSO
1298.Xr rlogin 1 ,
1299.Xr rsh 1 ,
1300.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +11001301.Xr sftp 1 ,
Damien Miller32aa1441999-10-29 09:15:49 +10001302.Xr ssh-add 1 ,
1303.Xr ssh-agent 1 ,
1304.Xr ssh-keygen 1 ,
1305.Xr telnet 1 ,
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +00001306.Xr sshd 8