blob: dac24a43c017f01c05467c71af4795a3c2fb9850 [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.\"
Damien Millere4340be2000-09-16 13:29:08 +110013.\" 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.
Damien Miller32aa1441999-10-29 09:15:49 +100036.\"
37.Dd September 25, 1999
38.Dt SSH 1
39.Os
40.Sh NAME
41.Nm ssh
42.Nd OpenSSH secure shell client (remote login program)
43.Sh SYNOPSIS
44.Nm ssh
45.Op Fl l Ar login_name
46.Op Ar hostname | user@hostname
47.Op Ar command
48.Pp
49.Nm ssh
Damien Millerb1715dc2000-05-30 13:44:51 +100050.Op Fl afgknqtvxACNPTX246
Damien Miller30c3d422000-05-09 11:02:59 +100051.Op Fl c Ar cipher_spec
Damien Miller32aa1441999-10-29 09:15:49 +100052.Op Fl e Ar escape_char
53.Op Fl i Ar identity_file
54.Op Fl l Ar login_name
55.Op Fl o Ar option
56.Op Fl p Ar port
57.Oo Fl L Xo
58.Sm off
Damien Miller32aa1441999-10-29 09:15:49 +100059.Ar port :
Damien Miller396691a2000-01-20 22:44:08 +110060.Ar host :
Damien Miller32aa1441999-10-29 09:15:49 +100061.Ar hostport
62.Sm on
63.Xc
64.Oc
65.Oo Fl R Xo
66.Sm off
Damien Miller32aa1441999-10-29 09:15:49 +100067.Ar port :
Damien Miller396691a2000-01-20 22:44:08 +110068.Ar host :
Damien Miller32aa1441999-10-29 09:15:49 +100069.Ar hostport
70.Sm on
71.Xc
72.Oc
73.Op Ar hostname | user@hostname
74.Op Ar command
Damien Miller22c77262000-04-13 12:26:34 +100075.Sh DESCRIPTION
Damien Miller32aa1441999-10-29 09:15:49 +100076.Nm
77(Secure Shell) is a program for logging into a remote machine and for
Damien Miller7684ee12000-03-17 23:40:15 +110078executing commands on a remote machine.
79It is intended to replace
Damien Miller32aa1441999-10-29 09:15:49 +100080rlogin and rsh, and provide secure encrypted communications between
Damien Miller7684ee12000-03-17 23:40:15 +110081two untrusted hosts over an insecure network.
82X11 connections and
Damien Miller32aa1441999-10-29 09:15:49 +100083arbitrary TCP/IP ports can also be forwarded over the secure channel.
84.Pp
85.Nm
Damien Miller22c77262000-04-13 12:26:34 +100086connects and logs into the specified
Damien Miller32aa1441999-10-29 09:15:49 +100087.Ar hostname .
88The user must prove
Damien Millere247cc42000-05-07 12:03:14 +100089his/her identity to the remote machine using one of several methods
90depending on the protocol version used:
91.Pp
92.Ss SSH protocol version 1
Damien Miller32aa1441999-10-29 09:15:49 +100093.Pp
94First, if the machine the user logs in from is listed in
95.Pa /etc/hosts.equiv
96or
Damien Miller886c63a2000-01-20 23:13:36 +110097.Pa /etc/shosts.equiv
Damien Miller32aa1441999-10-29 09:15:49 +100098on the remote machine, and the user names are
99the same on both sides, the user is immediately permitted to log in.
Damien Miller22c77262000-04-13 12:26:34 +1000100Second, if
Damien Miller32aa1441999-10-29 09:15:49 +1000101.Pa \&.rhosts
102or
103.Pa \&.shosts
104exists in the user's home directory on the
105remote machine and contains a line containing the name of the client
106machine and the name of the user on that machine, the user is
Damien Miller7684ee12000-03-17 23:40:15 +1100107permitted to log in.
108This form of authentication alone is normally not
Damien Miller32aa1441999-10-29 09:15:49 +1000109allowed by the server because it is not secure.
110.Pp
111The second (and primary) authentication method is the
112.Pa rhosts
113or
114.Pa hosts.equiv
Damien Miller7684ee12000-03-17 23:40:15 +1100115method combined with RSA-based host authentication.
116It means that if the login would be permitted by
Damien Millere247cc42000-05-07 12:03:14 +1000117.Pa $HOME/.rhosts ,
118.Pa $HOME/.shosts ,
Damien Miller32aa1441999-10-29 09:15:49 +1000119.Pa /etc/hosts.equiv ,
120or
Damien Miller886c63a2000-01-20 23:13:36 +1100121.Pa /etc/shosts.equiv ,
Damien Miller32aa1441999-10-29 09:15:49 +1000122and if additionally the server can verify the client's
Damien Miller22c77262000-04-13 12:26:34 +1000123host key (see
Damien Miller886c63a2000-01-20 23:13:36 +1100124.Pa /etc/ssh_known_hosts
Damien Miller33e511e1999-11-11 11:43:13 +1100125and
126.Pa $HOME/.ssh/known_hosts
Damien Miller32aa1441999-10-29 09:15:49 +1000127in the
128.Sx FILES
Damien Miller7684ee12000-03-17 23:40:15 +1100129section), only then login is permitted.
130This authentication method closes security holes due to IP
131spoofing, DNS spoofing and routing spoofing.
132[Note to the administrator:
Damien Miller32aa1441999-10-29 09:15:49 +1000133.Pa /etc/hosts.equiv ,
Damien Millere247cc42000-05-07 12:03:14 +1000134.Pa $HOME/.rhosts ,
Damien Miller32aa1441999-10-29 09:15:49 +1000135and the rlogin/rsh protocol in general, are inherently insecure and should be
136disabled if security is desired.]
137.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000138As a third authentication method,
Damien Miller32aa1441999-10-29 09:15:49 +1000139.Nm
140supports RSA based authentication.
141The scheme is based on public-key cryptography: there are cryptosystems
142where encryption and decryption are done using separate keys, and it
143is not possible to derive the decryption key from the encryption key.
Damien Miller7684ee12000-03-17 23:40:15 +1100144RSA is one such system.
Damien Miller22c77262000-04-13 12:26:34 +1000145The idea is that each user creates a public/private
Damien Miller7684ee12000-03-17 23:40:15 +1100146key pair for authentication purposes.
147The server knows the public key, and only the user knows the private key.
Damien Miller22c77262000-04-13 12:26:34 +1000148The file
Damien Miller32aa1441999-10-29 09:15:49 +1000149.Pa $HOME/.ssh/authorized_keys
150lists the public keys that are permitted for logging
Damien Miller7684ee12000-03-17 23:40:15 +1100151in.
152When the user logs in, the
Damien Miller32aa1441999-10-29 09:15:49 +1000153.Nm
154program tells the server which key pair it would like to use for
Damien Miller7684ee12000-03-17 23:40:15 +1100155authentication.
156The server checks if this key is permitted, and if
Damien Miller32aa1441999-10-29 09:15:49 +1000157so, sends the user (actually the
158.Nm
159program running on behalf of the user) a challenge, a random number,
Damien Miller7684ee12000-03-17 23:40:15 +1100160encrypted by the user's public key.
161The challenge can only be
162decrypted using the proper private key.
163The user's client then decrypts the
Damien Miller32aa1441999-10-29 09:15:49 +1000164challenge using the private key, proving that he/she knows the private
165key but without disclosing it to the server.
166.Pp
167.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100168implements the RSA authentication protocol automatically.
169The user creates his/her RSA key pair by running
Damien Miller32aa1441999-10-29 09:15:49 +1000170.Xr ssh-keygen 1 .
Damien Miller22c77262000-04-13 12:26:34 +1000171This stores the private key in
Damien Millere247cc42000-05-07 12:03:14 +1000172.Pa $HOME/.ssh/identity
Damien Miller32aa1441999-10-29 09:15:49 +1000173and the public key in
Damien Millere247cc42000-05-07 12:03:14 +1000174.Pa $HOME/.ssh/identity.pub
Damien Miller7684ee12000-03-17 23:40:15 +1100175in the user's home directory.
176The user should then copy the
Damien Miller32aa1441999-10-29 09:15:49 +1000177.Pa identity.pub
Damien Miller22c77262000-04-13 12:26:34 +1000178to
Damien Millere247cc42000-05-07 12:03:14 +1000179.Pa $HOME/.ssh/authorized_keys
Damien Miller22c77262000-04-13 12:26:34 +1000180in his/her home directory on the remote machine (the
Damien Miller32aa1441999-10-29 09:15:49 +1000181.Pa authorized_keys
Damien Miller22c77262000-04-13 12:26:34 +1000182file corresponds to the conventional
Damien Millere247cc42000-05-07 12:03:14 +1000183.Pa $HOME/.rhosts
Damien Miller32aa1441999-10-29 09:15:49 +1000184file, and has one key
Damien Miller7684ee12000-03-17 23:40:15 +1100185per line, though the lines can be very long).
186After this, the user can log in without giving the password.
187RSA authentication is much
Damien Miller32aa1441999-10-29 09:15:49 +1000188more secure than rhosts authentication.
189.Pp
190The most convenient way to use RSA authentication may be with an
Damien Miller7684ee12000-03-17 23:40:15 +1100191authentication agent.
192See
Damien Miller32aa1441999-10-29 09:15:49 +1000193.Xr ssh-agent 1
194for more information.
195.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000196If other authentication methods fail,
Damien Miller32aa1441999-10-29 09:15:49 +1000197.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100198prompts the user for a password.
199The password is sent to the remote
Damien Miller32aa1441999-10-29 09:15:49 +1000200host for checking; however, since all communications are encrypted,
201the password cannot be seen by someone listening on the network.
202.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000203.Ss SSH protocol version 2
204.Pp
205When a user connects using the protocol version 2
206different authentication methods are available:
207At first, the client attempts to authenticate using the public key method.
208If this method fails password authentication is tried.
209.Pp
210The public key method is similar to RSA authentication described
211in the previous section except that the DSA algorithm is used
212instead of the patented RSA algorithm.
213The client uses his private DSA key
214.Pa $HOME/.ssh/id_dsa
215to sign the session identifier and sends the result to the server.
216The server checks whether the matching public key is listed in
217.Pa $HOME/.ssh/authorized_keys2
218and grants access if both the key is found and the signature is correct.
219The session identifier is derived from a shared Diffie-Hellman value
220and is only known to the client and the server.
221.Pp
222If public key authentication fails or is not available a password
223can be sent encrypted to the remote host for proving the user's identity.
224This protocol 2 implementation does not yet support Kerberos or
225S/Key authentication.
226.Pp
227Protocol 2 provides additional mechanisms for confidentiality
Damien Miller30c3d422000-05-09 11:02:59 +1000228(the traffic is encrypted using 3DES, Blowfish, CAST128 or Arcfour)
Damien Millere247cc42000-05-07 12:03:14 +1000229and integrity (hmac-sha1, hmac-md5).
230Note that protocol 1 lacks a strong mechanism for ensuring the
231integrity of the connection.
232.Pp
233.Ss Login session and remote execution
234.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000235When the user's identity has been accepted by the server, the server
236either executes the given command, or logs into the machine and gives
Damien Miller7684ee12000-03-17 23:40:15 +1100237the user a normal shell on the remote machine.
238All communication with
Damien Miller32aa1441999-10-29 09:15:49 +1000239the remote command or shell will be automatically encrypted.
240.Pp
241If a pseudo-terminal has been allocated (normal login session), the
242user can disconnect with
243.Ic ~. ,
244and suspend
245.Nm
246with
247.Ic ~^Z .
248All forwarded connections can be listed with
Damien Miller22c77262000-04-13 12:26:34 +1000249.Ic ~#
Damien Miller32aa1441999-10-29 09:15:49 +1000250and if
251the session blocks waiting for forwarded X11 or TCP/IP
252connections to terminate, it can be backgrounded with
253.Ic ~&
254(this should not be used while the user shell is active, as it can cause the
Damien Miller7684ee12000-03-17 23:40:15 +1100255shell to hang).
256All available escapes can be listed with
Damien Miller32aa1441999-10-29 09:15:49 +1000257.Ic ~? .
258.Pp
259A single tilde character can be sent as
260.Ic ~~
261(or by following the tilde by a character other than those described above).
262The escape character must always follow a newline to be interpreted as
Damien Miller7684ee12000-03-17 23:40:15 +1100263special.
264The escape character can be changed in configuration files
265or on the command line.
Damien Miller32aa1441999-10-29 09:15:49 +1000266.Pp
267If no pseudo tty has been allocated, the
268session is transparent and can be used to reliably transfer binary
Damien Miller7684ee12000-03-17 23:40:15 +1100269data.
270On most systems, setting the escape character to
Damien Miller32aa1441999-10-29 09:15:49 +1000271.Dq none
272will also make the session transparent even if a tty is used.
273.Pp
274The session terminates when the command or shell in on the remote
275machine exists and all X11 and TCP/IP connections have been closed.
276The exit status of the remote program is returned as the exit status
277of
278.Nm ssh .
279.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000280.Ss X11 and TCP forwarding
281.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000282If the user is using X11 (the
283.Ev DISPLAY
284environment variable is set), the connection to the X11 display is
285automatically forwarded to the remote side in such a way that any X11
286programs started from the shell (or command) will go through the
287encrypted channel, and the connection to the real X server will be made
Damien Miller7684ee12000-03-17 23:40:15 +1100288from the local machine.
289The user should not manually set
Damien Miller32aa1441999-10-29 09:15:49 +1000290.Ev DISPLAY .
291Forwarding of X11 connections can be
292configured on the command line or in configuration files.
293.Pp
294The
Damien Miller22c77262000-04-13 12:26:34 +1000295.Ev DISPLAY
Damien Miller32aa1441999-10-29 09:15:49 +1000296value set by
297.Nm
298will point to the server machine, but with a display number greater
Damien Miller7684ee12000-03-17 23:40:15 +1100299than zero.
300This is normal, and happens because
Damien Miller32aa1441999-10-29 09:15:49 +1000301.Nm
302creates a
303.Dq proxy
304X server on the server machine for forwarding the
305connections over the encrypted channel.
306.Pp
307.Nm
308will also automatically set up Xauthority data on the server machine.
309For this purpose, it will generate a random authorization cookie,
310store it in Xauthority on the server, and verify that any forwarded
311connections carry this cookie and replace it by the real cookie when
Damien Miller7684ee12000-03-17 23:40:15 +1100312the connection is opened.
313The real authentication cookie is never
Damien Miller32aa1441999-10-29 09:15:49 +1000314sent to the server machine (and no cookies are sent in the plain).
315.Pp
316If the user is using an authentication agent, the connection to the agent
317is automatically forwarded to the remote side unless disabled on
318command line or in a configuration file.
319.Pp
320Forwarding of arbitrary TCP/IP connections over the secure channel can
Damien Miller7684ee12000-03-17 23:40:15 +1100321be specified either on command line or in a configuration file.
322One possible application of TCP/IP forwarding is a secure connection to an
Damien Miller32aa1441999-10-29 09:15:49 +1000323electronic purse; another is going trough firewalls.
324.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000325.Ss Server authentication
326.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000327.Nm
Damien Millere247cc42000-05-07 12:03:14 +1000328automatically maintains and checks a database containing
Damien Miller7684ee12000-03-17 23:40:15 +1100329identifications for all hosts it has ever been used with.
Damien Millere247cc42000-05-07 12:03:14 +1000330RSA host keys are stored in
331.Pa $HOME/.ssh/known_hosts
332and
333DSA host keys are stored in
334.Pa $HOME/.ssh/known_hosts2
Damien Miller7684ee12000-03-17 23:40:15 +1100335in the user's home directory.
Damien Millere247cc42000-05-07 12:03:14 +1000336Additionally, the files
Damien Miller886c63a2000-01-20 23:13:36 +1100337.Pa /etc/ssh_known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000338and
339.Pa /etc/ssh_known_hosts2
340are automatically checked for known hosts.
Damien Miller7684ee12000-03-17 23:40:15 +1100341Any new hosts are automatically added to the user's file.
342If a host's identification
Damien Miller32aa1441999-10-29 09:15:49 +1000343ever changes,
344.Nm
345warns about this and disables password authentication to prevent a
Damien Miller7684ee12000-03-17 23:40:15 +1100346trojan horse from getting the user's password.
347Another purpose of
Damien Miller32aa1441999-10-29 09:15:49 +1000348this mechanism is to prevent man-in-the-middle attacks which could
Damien Miller7684ee12000-03-17 23:40:15 +1100349otherwise be used to circumvent the encryption.
350The
Damien Miller32aa1441999-10-29 09:15:49 +1000351.Cm StrictHostKeyChecking
352option (see below) can be used to prevent logins to machines whose
353host key is not known or has changed.
354.Sh OPTIONS
355.Bl -tag -width Ds
356.It Fl a
Damien Miller450a7a12000-03-26 13:04:51 +1000357Disables forwarding of the authentication agent connection.
Damien Millerb1715dc2000-05-30 13:44:51 +1000358.It Fl A
359Enables forwarding of the authentication agent connection.
360This can also be specified on a per-host basis in a configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000361.It Fl c Ar blowfish|3des
Damien Miller22c77262000-04-13 12:26:34 +1000362Selects the cipher to use for encrypting the session.
Damien Miller32aa1441999-10-29 09:15:49 +1000363.Ar 3des
Damien Miller7684ee12000-03-17 23:40:15 +1100364is used by default.
Damien Miller22c77262000-04-13 12:26:34 +1000365It is believed to be secure.
Damien Miller32aa1441999-10-29 09:15:49 +1000366.Ar 3des
367(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
368It is presumably more secure than the
369.Ar des
Damien Miller30c3d422000-05-09 11:02:59 +1000370cipher which is no longer supported in
371.Nm ssh .
Damien Miller32aa1441999-10-29 09:15:49 +1000372.Ar blowfish
373is a fast block cipher, it appears very secure and is much faster than
Damien Miller7684ee12000-03-17 23:40:15 +1100374.Ar 3des .
Damien Miller30c3d422000-05-09 11:02:59 +1000375.It Fl c Ar "3des-cbc,blowfish-cbc,arcfour,cast128-cbc"
376Additionally, for protocol version 2 a comma-separated list of ciphers can
Damien Miller874d77b2000-10-14 16:23:11 +1100377be specified in order of preference.
378Protocol version 2 supports 3DES, Blowfish, and CAST128 in CBC mode
379and Arcfour.
Damien Miller32aa1441999-10-29 09:15:49 +1000380.It Fl e Ar ch|^ch|none
381Sets the escape character for sessions with a pty (default:
382.Ql ~ ) .
Damien Miller7684ee12000-03-17 23:40:15 +1100383The escape character is only recognized at the beginning of a line.
384The escape character followed by a dot
Damien Miller32aa1441999-10-29 09:15:49 +1000385.Pq Ql \&.
386closes the connection, followed
387by control-Z suspends the connection, and followed by itself sends the
Damien Miller7684ee12000-03-17 23:40:15 +1100388escape character once.
389Setting the character to
Damien Miller32aa1441999-10-29 09:15:49 +1000390.Dq none
391disables any escapes and makes the session fully transparent.
392.It Fl f
393Requests
394.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100395to go to background just before command execution.
396This is useful if
Damien Miller32aa1441999-10-29 09:15:49 +1000397.Nm
398is going to ask for passwords or passphrases, but the user
Damien Miller7684ee12000-03-17 23:40:15 +1100399wants it in the background.
Damien Miller22c77262000-04-13 12:26:34 +1000400This implies
Damien Miller32aa1441999-10-29 09:15:49 +1000401.Fl n .
402The recommended way to start X11 programs at a remote site is with
403something like
404.Ic ssh -f host xterm .
Damien Miller396691a2000-01-20 22:44:08 +1100405.It Fl g
406Allows remote hosts to connect to local forwarded ports.
Damien Miller32aa1441999-10-29 09:15:49 +1000407.It Fl i Ar identity_file
Damien Miller22c77262000-04-13 12:26:34 +1000408Selects the file from which the identity (private key) for
Damien Miller7684ee12000-03-17 23:40:15 +1100409RSA authentication is read.
Damien Miller22c77262000-04-13 12:26:34 +1000410Default is
Damien Millere247cc42000-05-07 12:03:14 +1000411.Pa $HOME/.ssh/identity
Damien Miller7684ee12000-03-17 23:40:15 +1100412in the user's home directory.
413Identity files may also be specified on
414a per-host basis in the configuration file.
415It is possible to have multiple
Damien Miller32aa1441999-10-29 09:15:49 +1000416.Fl i
417options (and multiple identities specified in
418configuration files).
Damien Miller32aa1441999-10-29 09:15:49 +1000419.It Fl k
Damien Miller450a7a12000-03-26 13:04:51 +1000420Disables forwarding of Kerberos tickets and AFS tokens.
421This may also be specified on a per-host basis in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000422.It Fl l Ar login_name
Damien Miller7684ee12000-03-17 23:40:15 +1100423Specifies the user to log in as on the remote machine.
424This also may be specified on a per-host basis in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000425.It Fl n
426Redirects stdin from
427.Pa /dev/null
428(actually, prevents reading from stdin).
429This must be used when
430.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100431is run in the background.
432A common trick is to use this to run X11 programs on a remote machine.
433For example,
Damien Miller32aa1441999-10-29 09:15:49 +1000434.Ic ssh -n shadows.cs.hut.fi emacs &
435will start an emacs on shadows.cs.hut.fi, and the X11
436connection will be automatically forwarded over an encrypted channel.
437The
438.Nm
439program will be put in the background.
440(This does not work if
441.Nm
442needs to ask for a password or passphrase; see also the
443.Fl f
444option.)
Damien Millerdcb6ecd2000-05-17 22:34:22 +1000445.It Fl N
446Do not execute a remote command.
447This is usefull if you just want to forward ports
448(protocol version 2 only).
Damien Miller32aa1441999-10-29 09:15:49 +1000449.It Fl o Ar option
450Can be used to give options in the format used in the config file.
451This is useful for specifying options for which there is no separate
Damien Miller7684ee12000-03-17 23:40:15 +1100452command-line flag.
453The option has the same format as a line in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000454.It Fl p Ar port
Damien Miller7684ee12000-03-17 23:40:15 +1100455Port to connect to on the remote host.
456This can be specified on a
Damien Miller32aa1441999-10-29 09:15:49 +1000457per-host basis in the configuration file.
458.It Fl P
459Use a non-privileged port for outgoing connections.
460This can be used if your firewall does
461not permit connections from privileged ports.
Damien Millera34a28b1999-12-14 10:47:15 +1100462Note that this option turns off
Damien Miller32aa1441999-10-29 09:15:49 +1000463.Cm RhostsAuthentication
464and
465.Cm RhostsRSAAuthentication .
466.It Fl q
Damien Miller7684ee12000-03-17 23:40:15 +1100467Quiet mode.
468Causes all warning and diagnostic messages to be suppressed.
469Only fatal errors are displayed.
Damien Miller32aa1441999-10-29 09:15:49 +1000470.It Fl t
Damien Miller7684ee12000-03-17 23:40:15 +1100471Force pseudo-tty allocation.
Damien Miller450a7a12000-03-26 13:04:51 +1000472This can be used to execute arbitrary
Damien Miller7684ee12000-03-17 23:40:15 +1100473screen-based programs on a remote machine, which can be very useful,
474e.g., when implementing menu services.
Damien Millerdcb6ecd2000-05-17 22:34:22 +1000475.It Fl T
476Disable pseudo-tty allocation (protocol version 2 only).
Damien Miller32aa1441999-10-29 09:15:49 +1000477.It Fl v
Damien Miller7684ee12000-03-17 23:40:15 +1100478Verbose mode.
479Causes
Damien Miller32aa1441999-10-29 09:15:49 +1000480.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100481to print debugging messages about its progress.
482This is helpful in
Damien Miller32aa1441999-10-29 09:15:49 +1000483debugging connection, authentication, and configuration problems.
484The verbose mode is also used to display
485.Xr skey 1
486challenges, if the user entered "s/key" as password.
Damien Miller874d77b2000-10-14 16:23:11 +1100487Multiple -v options increases the verbosity.
488Maximum is 3.
Damien Miller32aa1441999-10-29 09:15:49 +1000489.It Fl x
Damien Miller7684ee12000-03-17 23:40:15 +1100490Disables X11 forwarding.
Damien Miller32aa1441999-10-29 09:15:49 +1000491.It Fl X
492Enables X11 forwarding.
Damien Millerb1715dc2000-05-30 13:44:51 +1000493This can also be specified on a per-host basis in a configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000494.It Fl C
495Requests compression of all data (including stdin, stdout, stderr, and
Damien Miller7684ee12000-03-17 23:40:15 +1100496data for forwarded X11 and TCP/IP connections).
497The compression algorithm is the same used by
Damien Miller396691a2000-01-20 22:44:08 +1100498.Xr gzip 1 ,
499and the
Damien Miller32aa1441999-10-29 09:15:49 +1000500.Dq level
501can be controlled by the
502.Cm CompressionLevel
Damien Miller7684ee12000-03-17 23:40:15 +1100503option (see below).
504Compression is desirable on modem lines and other
Damien Miller32aa1441999-10-29 09:15:49 +1000505slow 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
Damien Miller7684ee12000-03-17 23:40:15 +1100512forwarded to the given host and port on the remote side.
513This works by allocating a socket to listen to
Damien Miller32aa1441999-10-29 09:15:49 +1000514.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
Damien Miller34132e52000-01-14 15:45:46 +1100518.Ar host
519port
520.Ar hostport
Damien Miller7684ee12000-03-17 23:40:15 +1100521from the remote machine.
522Port forwardings can also be specified in the configuration file.
523Only root can forward privileged ports.
Damien Miller34132e52000-01-14 15:45:46 +1100524IPv6 addresses can be specified with an alternative syntax:
525.Ar port/host/hostport
Damien Miller32aa1441999-10-29 09:15:49 +1000526.It Fl R Ar port:host:hostport
527Specifies that the given port on the remote (server) host is to be
Damien Miller7684ee12000-03-17 23:40:15 +1100528forwarded to the given host and port on the local side.
529This works by allocating a socket to listen to
Damien Miller32aa1441999-10-29 09:15:49 +1000530.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
Damien Miller34132e52000-01-14 15:45:46 +1100534.Ar host
535port
536.Ar hostport
Damien Miller7684ee12000-03-17 23:40:15 +1100537from the local machine.
538Port forwardings can also be specified in the configuration file.
539Privileged ports can be forwarded only when
Damien Miller32aa1441999-10-29 09:15:49 +1000540logging in as root on the remote machine.
Damien Miller4af51302000-04-16 11:18:38 +1000541.It Fl 2
542Forces
543.Nm
Damien Millere247cc42000-05-07 12:03:14 +1000544to try protocol version 2 only.
Damien Miller34132e52000-01-14 15:45:46 +1100545.It Fl 4
546Forces
547.Nm
548to use IPv4 addresses only.
549.It Fl 6
550Forces
551.Nm
552to use IPv6 addresses only.
Damien Miller32aa1441999-10-29 09:15:49 +1000553.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
Damien Miller886c63a2000-01-20 23:13:36 +1100560.Pq Pa /etc/ssh_config .
Damien Miller32aa1441999-10-29 09:15:49 +1000561For each parameter, the first obtained value
Damien Miller7684ee12000-03-17 23:40:15 +1100562will 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.
Damien Miller32aa1441999-10-29 09:15:49 +1000568.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
Damien Miller7684ee12000-03-17 23:40:15 +1100594patterns.
595A single
Damien Miller32aa1441999-10-29 09:15:49 +1000596.Ql \&*
597as a pattern can be used to provide global
Damien Miller7684ee12000-03-17 23:40:15 +1100598defaults for all hosts.
599The host is the
Damien Miller32aa1441999-10-29 09:15:49 +1000600.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
Damien Miller450a7a12000-03-26 13:04:51 +1000604Specifies whether to pass AFS tokens to remote host.
605The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000606.Dq yes
607or
608.Dq no .
609.It Cm BatchMode
610If set to
611.Dq yes ,
Damien Miller7684ee12000-03-17 23:40:15 +1100612passphrase/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
Damien Miller32aa1441999-10-29 09:15:49 +1000616.Dq yes
617or
618.Dq no .
Damien Miller396691a2000-01-20 22:44:08 +1100619.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
Damien Miller450a7a12000-03-26 13:04:51 +1000624file.
625This allows ssh to detect if a host key changed due to DNS spoofing.
Damien Miller396691a2000-01-20 22:44:08 +1100626If the option is set to
627.Dq no ,
628the check will not be executed.
Damien Miller32aa1441999-10-29 09:15:49 +1000629.It Cm Cipher
Damien Miller50a41ed2000-10-16 12:14:42 +1100630Specifies the cipher to use for encrypting the session
631in protocol version 1
Damien Miller7684ee12000-03-17 23:40:15 +1100632Currently,
Damien Miller32aa1441999-10-29 09:15:49 +1000633.Dq blowfish ,
634and
635.Dq 3des
Damien Miller7684ee12000-03-17 23:40:15 +1100636are supported.
637The default is
Damien Miller32aa1441999-10-29 09:15:49 +1000638.Dq 3des .
Damien Miller22c77262000-04-13 12:26:34 +1000639.It Cm Ciphers
640Specifies the ciphers allowed for protocol version 2
641in order of preference.
642Multiple ciphers must be comma-separated.
643The default is
Damien Miller50a41ed2000-10-16 12:14:42 +1100644.Dq 3des-cbc,blowfish-cbc,cast128-cbc,arcfour .
Damien Miller32aa1441999-10-29 09:15:49 +1000645.It Cm Compression
Damien Miller7684ee12000-03-17 23:40:15 +1100646Specifies whether to use compression.
647The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000648.Dq yes
649or
650.Dq no .
651.It Cm CompressionLevel
Damien Miller7684ee12000-03-17 23:40:15 +1100652Specifies the compression level to use if compression is enable.
653The argument must be an integer from 1 (fast) to 9 (slow, best).
654The default level is 6, which is good for most applications.
655The meaning of the values is the same as in
Damien Miller396691a2000-01-20 22:44:08 +1100656.Xr gzip 1 .
Damien Miller32aa1441999-10-29 09:15:49 +1000657.It Cm ConnectionAttempts
658Specifies the number of tries (one per second) to make before falling
Damien Miller7684ee12000-03-17 23:40:15 +1100659back to rsh or exiting.
660The argument must be an integer.
661This may be useful in scripts if the connection sometimes fails.
Damien Millere247cc42000-05-07 12:03:14 +1000662.It Cm DSAAuthentication
663Specifies whether to try DSA authentication.
664The argument to this keyword must be
665.Dq yes
666or
667.Dq no .
668DSA authentication will only be
669attempted if a DSA identity file exists.
670Note that this option applies to protocol version 2 only.
Damien Miller32aa1441999-10-29 09:15:49 +1000671.It Cm EscapeChar
672Sets the escape character (default:
673.Ql ~ ) .
674The escape character can also
Damien Miller7684ee12000-03-17 23:40:15 +1100675be set on the command line.
676The argument should be a single character,
Damien Miller32aa1441999-10-29 09:15:49 +1000677.Ql ^
678followed by a letter, or
679.Dq none
680to disable the escape
681character entirely (making the connection transparent for binary
682data).
Damien Miller22c77262000-04-13 12:26:34 +1000683.It Cm FallBackToRsh
Damien Miller32aa1441999-10-29 09:15:49 +1000684Specifies that if connecting via
685.Nm
686fails due to a connection refused error (there is no
687.Xr sshd 8
Damien Miller22c77262000-04-13 12:26:34 +1000688listening on the remote host),
Damien Miller32aa1441999-10-29 09:15:49 +1000689.Xr rsh 1
690should automatically be used instead (after a suitable warning about
Damien Miller7684ee12000-03-17 23:40:15 +1100691the session being unencrypted).
692The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000693.Dq yes
694or
695.Dq no .
696.It Cm ForwardAgent
697Specifies whether the connection to the authentication agent (if any)
Damien Miller7684ee12000-03-17 23:40:15 +1100698will be forwarded to the remote machine.
699The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000700.Dq yes
701or
702.Dq no .
Damien Millerb1715dc2000-05-30 13:44:51 +1000703The default is
704.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000705.It Cm ForwardX11
706Specifies whether X11 connections will be automatically redirected
Damien Miller22c77262000-04-13 12:26:34 +1000707over the secure channel and
Damien Miller32aa1441999-10-29 09:15:49 +1000708.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +1100709set.
Damien Miller22c77262000-04-13 12:26:34 +1000710The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000711.Dq yes
712or
713.Dq no .
Damien Miller98c7ad62000-03-09 21:27:49 +1100714The default is
715.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000716.It Cm GatewayPorts
717Specifies whether remote hosts are allowed to connect to local
718forwarded ports.
719The argument must be
720.Dq yes
721or
722.Dq no .
723The default is
724.Dq no .
725.It Cm GlobalKnownHostsFile
Damien Miller22c77262000-04-13 12:26:34 +1000726Specifies a file to use instead of
Damien Miller886c63a2000-01-20 23:13:36 +1100727.Pa /etc/ssh_known_hosts .
Damien Miller32aa1441999-10-29 09:15:49 +1000728.It Cm HostName
Damien Miller7684ee12000-03-17 23:40:15 +1100729Specifies the real host name to log into.
730This can be used to specify nicknames or abbreviations for hosts.
731Default is the name given on the command line.
732Numeric IP addresses are also permitted (both on the command line and in
Damien Miller32aa1441999-10-29 09:15:49 +1000733.Cm HostName
734specifications).
735.It Cm IdentityFile
736Specifies the file from which the user's RSA authentication identity
737is read (default
Damien Millere247cc42000-05-07 12:03:14 +1000738.Pa $HOME/.ssh/identity
Damien Miller32aa1441999-10-29 09:15:49 +1000739in the user's home directory).
740Additionally, any identities represented by the authentication agent
Damien Miller7684ee12000-03-17 23:40:15 +1100741will be used for authentication.
742The file name may use the tilde
743syntax to refer to a user's home directory.
744It is possible to have
Damien Miller32aa1441999-10-29 09:15:49 +1000745multiple identity files specified in configuration files; all these
746identities will be tried in sequence.
Damien Millere247cc42000-05-07 12:03:14 +1000747.It Cm IdentityFile2
748Specifies the file from which the user's DSA authentication identity
749is read (default
750.Pa $HOME/.ssh/id_dsa
751in the user's home directory).
752The file name may use the tilde
753syntax to refer to a user's home directory.
754It is possible to have
755multiple identity files specified in configuration files; all these
756identities will be tried in sequence.
Damien Miller32aa1441999-10-29 09:15:49 +1000757.It Cm KeepAlive
758Specifies whether the system should send keepalive messages to the
Damien Miller7684ee12000-03-17 23:40:15 +1100759other side.
760If they are sent, death of the connection or crash of one
761of the machines will be properly noticed.
762However, this means that
Damien Miller32aa1441999-10-29 09:15:49 +1000763connections will die if the route is down temporarily, and some people
Damien Miller450a7a12000-03-26 13:04:51 +1000764find it annoying.
Damien Miller32aa1441999-10-29 09:15:49 +1000765.Pp
766The default is
767.Dq yes
768(to send keepalives), and the client will notice
Damien Miller7684ee12000-03-17 23:40:15 +1100769if the network goes down or the remote host dies.
770This is important in scripts, and many users want it too.
Damien Miller32aa1441999-10-29 09:15:49 +1000771.Pp
772To disable keepalives, the value should be set to
773.Dq no
774in both the server and the client configuration files.
775.It Cm KerberosAuthentication
Damien Miller450a7a12000-03-26 13:04:51 +1000776Specifies whether Kerberos authentication will be used.
777The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000778.Dq yes
779or
780.Dq no .
781.It Cm KerberosTgtPassing
Damien Miller450a7a12000-03-26 13:04:51 +1000782Specifies whether a Kerberos TGT will be forwarded to the server.
783This will only work if the Kerberos server is actually an AFS kaserver.
784The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000785.Dq yes
786or
787.Dq no .
788.It Cm LocalForward
789Specifies that a TCP/IP port on the local machine be forwarded over
Damien Miller7684ee12000-03-17 23:40:15 +1100790the secure channel to given host:port from the remote machine.
791The first argument must be a port number, and the second must be
792host:port.
793Multiple forwardings may be specified, and additional
794forwardings can be given on the command line.
795Only the superuser can forward privileged ports.
Damien Miller5ce662a1999-11-11 17:57:39 +1100796.It Cm LogLevel
797Gives the verbosity level that is used when logging messages from
798.Nm ssh .
799The possible values are:
Damien Miller00d4bb12000-03-03 22:48:49 +1100800QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
Damien Miller5ce662a1999-11-11 17:57:39 +1100801The default is INFO.
Damien Miller32aa1441999-10-29 09:15:49 +1000802.It Cm NumberOfPasswordPrompts
Damien Miller450a7a12000-03-26 13:04:51 +1000803Specifies the number of password prompts before giving up.
804The argument to this keyword must be an integer.
805Default is 3.
Damien Miller396691a2000-01-20 22:44:08 +1100806.It Cm PasswordAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100807Specifies whether to use password authentication.
808The argument to this keyword must be
Damien Miller396691a2000-01-20 22:44:08 +1100809.Dq yes
810or
811.Dq no .
Damien Millere247cc42000-05-07 12:03:14 +1000812Note that this option applies to both protocol version 1 and 2.
Damien Miller32aa1441999-10-29 09:15:49 +1000813.It Cm Port
Damien Miller7684ee12000-03-17 23:40:15 +1100814Specifies the port number to connect on the remote host.
815Default is 22.
Damien Miller22c77262000-04-13 12:26:34 +1000816.It Cm Protocol
817Specifies the protocol versions
818.Nm
819should support in order of preference.
820The possible values are
821.Dq 1
822and
823.Dq 2 .
824Multiple versions must be comma-separated.
825The default is
Damien Millere247cc42000-05-07 12:03:14 +1000826.Dq 1,2 .
827This means that
828.Nm
829tries version 1 and falls back to version 2
Damien Miller30c3d422000-05-09 11:02:59 +1000830if version 1 is not available.
Damien Miller32aa1441999-10-29 09:15:49 +1000831.It Cm ProxyCommand
Damien Miller7684ee12000-03-17 23:40:15 +1100832Specifies the command to use to connect to the server.
833The command
834string extends to the end of the line, and is executed with
835.Pa /bin/sh .
836In the command string,
837.Ql %h
838will be substituted by the host name to
839connect and
840.Ql %p
841by the port.
842The command can be basically anything,
843and should read from its standard input and write to its standard output.
844It should eventually connect an
Damien Miller32aa1441999-10-29 09:15:49 +1000845.Xr sshd 8
846server running on some machine, or execute
847.Ic sshd -i
Damien Miller7684ee12000-03-17 23:40:15 +1100848somewhere.
849Host key management will be done using the
Damien Miller32aa1441999-10-29 09:15:49 +1000850HostName of the host being connected (defaulting to the name typed by
851the user).
Damien Milleraae6c611999-12-06 11:47:28 +1100852Note that
853.Cm CheckHostIP
854is not available for connects with a proxy command.
Damien Miller32aa1441999-10-29 09:15:49 +1000855.Pp
856.It Cm RemoteForward
857Specifies that a TCP/IP port on the remote machine be forwarded over
Damien Miller7684ee12000-03-17 23:40:15 +1100858the secure channel to given host:port from the local machine.
859The first argument must be a port number, and the second must be
860host:port.
861Multiple forwardings may be specified, and additional
862forwardings can be given on the command line.
863Only the superuser can forward privileged ports.
Damien Miller32aa1441999-10-29 09:15:49 +1000864.It Cm RhostsAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100865Specifies whether to try rhosts based authentication.
866Note that this
Damien Miller32aa1441999-10-29 09:15:49 +1000867declaration only affects the client side and has no effect whatsoever
Damien Miller7684ee12000-03-17 23:40:15 +1100868on security.
869Disabling rhosts authentication may reduce
Damien Miller32aa1441999-10-29 09:15:49 +1000870authentication time on slow connections when rhosts authentication is
Damien Miller7684ee12000-03-17 23:40:15 +1100871not used.
872Most servers do not permit RhostsAuthentication because it
873is not secure (see RhostsRSAAuthentication).
874The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000875.Dq yes
876or
877.Dq no .
878.It Cm RhostsRSAAuthentication
879Specifies whether to try rhosts based authentication with RSA host
Damien Miller7684ee12000-03-17 23:40:15 +1100880authentication.
881This is the primary authentication method for most sites.
882The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000883.Dq yes
884or
885.Dq no .
886.It Cm RSAAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100887Specifies whether to try RSA authentication.
888The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000889.Dq yes
890or
891.Dq no .
892RSA authentication will only be
893attempted if the identity file exists, or an authentication agent is
894running.
Damien Millere247cc42000-05-07 12:03:14 +1000895Note that this option applies to protocol version 1 only.
Damien Miller95def091999-11-25 00:26:21 +1100896.It Cm SkeyAuthentication
897Specifies whether to use
898.Xr skey 1
Damien Miller7684ee12000-03-17 23:40:15 +1100899authentication.
900The argument to this keyword must be
Damien Miller95def091999-11-25 00:26:21 +1100901.Dq yes
902or
903.Dq no .
904The default is
905.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000906.It Cm StrictHostKeyChecking
907If this flag is set to
Damien Miller22c77262000-04-13 12:26:34 +1000908.Dq yes ,
Damien Miller32aa1441999-10-29 09:15:49 +1000909.Nm
910ssh will never automatically add host keys to the
911.Pa $HOME/.ssh/known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000912and
913.Pa $HOME/.ssh/known_hosts2
914files, and refuses to connect hosts whose host key has changed.
Damien Miller7684ee12000-03-17 23:40:15 +1100915This provides maximum protection against trojan horse attacks.
916However, it can be somewhat annoying if you don't have good
Damien Miller886c63a2000-01-20 23:13:36 +1100917.Pa /etc/ssh_known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000918and
919.Pa /etc/ssh_known_hosts2
Damien Miller32aa1441999-10-29 09:15:49 +1000920files installed and frequently
Damien Miller7684ee12000-03-17 23:40:15 +1100921connect new hosts.
922Basically this option forces the user to manually
923add any new hosts.
924Normally this option is disabled, and new hosts
925will automatically be added to the known host files.
926The host keys of
927known hosts will be verified automatically in either case.
928The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000929.Dq yes
930or
931.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000932.It Cm UsePrivilegedPort
933Specifies whether to use a privileged port for outgoing connections.
934The argument must be
935.Dq yes
936or
937.Dq no .
938The default is
939.Dq yes .
940Note that setting this option to
941.Dq no
Damien Millera34a28b1999-12-14 10:47:15 +1100942turns off
Damien Miller32aa1441999-10-29 09:15:49 +1000943.Cm RhostsAuthentication
944and
945.Cm RhostsRSAAuthentication .
Damien Miller396691a2000-01-20 22:44:08 +1100946.It Cm User
Damien Miller7684ee12000-03-17 23:40:15 +1100947Specifies the user to log in as.
948This can be useful if you have a different user name on different machines.
949This saves the trouble of
Damien Miller396691a2000-01-20 22:44:08 +1100950having to remember to give the user name on the command line.
951.It Cm UserKnownHostsFile
952Specifies a file to use instead of
953.Pa $HOME/.ssh/known_hosts .
Damien Miller32aa1441999-10-29 09:15:49 +1000954.It Cm UseRsh
Damien Miller7684ee12000-03-17 23:40:15 +1100955Specifies that rlogin/rsh should be used for this host.
956It is possible that the host does not at all support the
Damien Miller32aa1441999-10-29 09:15:49 +1000957.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100958protocol.
959This causes
Damien Miller32aa1441999-10-29 09:15:49 +1000960.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100961to immediately execute
Damien Miller32aa1441999-10-29 09:15:49 +1000962.Xr rsh 1 .
963All other options (except
964.Cm HostName )
Damien Miller7684ee12000-03-17 23:40:15 +1100965are ignored if this has been specified.
966The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000967.Dq yes
968or
969.Dq no .
Damien Millerd3a18572000-06-07 19:55:44 +1000970.It Cm XAuthLocation
971Specifies the location of the
972.Xr xauth 1
973program.
974The default is
975.Pa /usr/X11R6/bin/xauth .
Damien Miller7b28dc52000-09-05 13:34:53 +1100976.El
Damien Miller32aa1441999-10-29 09:15:49 +1000977.Sh ENVIRONMENT
978.Nm
979will normally set the following environment variables:
980.Bl -tag -width Ds
981.It Ev DISPLAY
982The
983.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +1100984variable indicates the location of the X11 server.
Damien Miller22c77262000-04-13 12:26:34 +1000985It is automatically set by
Damien Miller32aa1441999-10-29 09:15:49 +1000986.Nm
987to point to a value of the form
988.Dq hostname:n
989where hostname indicates
Damien Miller7684ee12000-03-17 23:40:15 +1100990the host where the shell runs, and n is an integer >= 1.
991.Nm
992uses this special value to forward X11 connections over the secure
993channel.
994The user should normally not set DISPLAY explicitly, as that
Damien Miller32aa1441999-10-29 09:15:49 +1000995will render the X11 connection insecure (and will require the user to
996manually copy any required authorization cookies).
997.It Ev HOME
998Set to the path of the user's home directory.
999.It Ev LOGNAME
1000Synonym for
1001.Ev USER ;
1002set for compatibility with systems that use this variable.
1003.It Ev MAIL
1004Set to point the user's mailbox.
Damien Miller7684ee12000-03-17 23:40:15 +11001005.It Ev PATH
Damien Miller32aa1441999-10-29 09:15:49 +10001006Set to the default
1007.Ev PATH ,
1008as specified when compiling
1009.Nm ssh .
1010.It Ev SSH_AUTH_SOCK
1011indicates the path of a unix-domain socket used to communicate with the
1012agent.
1013.It Ev SSH_CLIENT
Damien Miller7684ee12000-03-17 23:40:15 +11001014Identifies the client end of the connection.
1015The variable contains
Damien Miller32aa1441999-10-29 09:15:49 +10001016three space-separated values: client ip-address, client port number,
1017and server port number.
1018.It Ev SSH_TTY
1019This is set to the name of the tty (path to the device) associated
Damien Miller7684ee12000-03-17 23:40:15 +11001020with the current shell or command.
1021If the current session has no tty,
Damien Miller32aa1441999-10-29 09:15:49 +10001022this variable is not set.
1023.It Ev TZ
1024The timezone variable is set to indicate the present timezone if it
Damien Miller942da032000-08-18 13:59:06 +10001025was set when the daemon was started (i.e., the daemon passes the value
Damien Miller32aa1441999-10-29 09:15:49 +10001026on to new connections).
1027.It Ev USER
1028Set to the name of the user logging in.
1029.El
1030.Pp
Damien Miller22c77262000-04-13 12:26:34 +10001031Additionally,
Damien Miller32aa1441999-10-29 09:15:49 +10001032.Nm
Damien Miller22c77262000-04-13 12:26:34 +10001033reads
1034.Pa $HOME/.ssh/environment ,
Damien Miller32aa1441999-10-29 09:15:49 +10001035and adds lines of the format
1036.Dq VARNAME=value
1037to the environment.
1038.Sh FILES
Damien Miller98c7ad62000-03-09 21:27:49 +11001039.Bl -tag -width Ds
Damien Miller32aa1441999-10-29 09:15:49 +10001040.It Pa $HOME/.ssh/known_hosts
1041Records host keys for all hosts the user has logged into (that are not
1042in
Damien Miller886c63a2000-01-20 23:13:36 +11001043.Pa /etc/ssh_known_hosts ) .
Damien Miller32aa1441999-10-29 09:15:49 +10001044See
1045.Xr sshd 8 .
Damien Millere247cc42000-05-07 12:03:14 +10001046.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa
1047Contains the RSA and the DSA authentication identity of the user.
1048These files
1049contain sensitive data and should be readable by the user but not
Damien Miller32aa1441999-10-29 09:15:49 +10001050accessible by others (read/write/execute).
1051Note that
1052.Nm
Damien Millere247cc42000-05-07 12:03:14 +10001053ignores a private key file if it is accessible by others.
Damien Miller32aa1441999-10-29 09:15:49 +10001054It is possible to specify a passphrase when
1055generating the key; the passphrase will be used to encrypt the
1056sensitive part of this file using 3DES.
Damien Millere247cc42000-05-07 12:03:14 +10001057.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub
Damien Miller32aa1441999-10-29 09:15:49 +10001058Contains the public key for authentication (public part of the
Damien Miller7684ee12000-03-17 23:40:15 +11001059identity file in human-readable form).
Damien Millere247cc42000-05-07 12:03:14 +10001060The contents of the
1061.Pa $HOME/.ssh/identity.pub
1062file should be added to
Damien Miller32aa1441999-10-29 09:15:49 +10001063.Pa $HOME/.ssh/authorized_keys
1064on all machines
Damien Miller7684ee12000-03-17 23:40:15 +11001065where you wish to log in using RSA authentication.
Damien Millere247cc42000-05-07 12:03:14 +10001066The contents of the
1067.Pa $HOME/.ssh/id_dsa.pub
1068file should be added to
1069.Pa $HOME/.ssh/authorized_keys2
1070on all machines
1071where you wish to log in using DSA authentication.
1072These files are not
Damien Miller7684ee12000-03-17 23:40:15 +11001073sensitive and can (but need not) be readable by anyone.
Damien Millere247cc42000-05-07 12:03:14 +10001074These files are
1075never used automatically and are not necessary; they is only provided for
Damien Miller32aa1441999-10-29 09:15:49 +10001076the convenience of the user.
1077.It Pa $HOME/.ssh/config
Damien Miller7684ee12000-03-17 23:40:15 +11001078This is the per-user configuration file.
1079The format of this file is described above.
1080This file is used by the
Damien Miller32aa1441999-10-29 09:15:49 +10001081.Nm
Damien Miller7684ee12000-03-17 23:40:15 +11001082client.
1083This file does not usually contain any sensitive information,
Damien Miller32aa1441999-10-29 09:15:49 +10001084but the recommended permissions are read/write for the user, and not
1085accessible by others.
1086.It Pa $HOME/.ssh/authorized_keys
Damien Miller7684ee12000-03-17 23:40:15 +11001087Lists the RSA keys that can be used for logging in as this user.
1088The format of this file is described in the
Damien Miller32aa1441999-10-29 09:15:49 +10001089.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001090manual page.
1091In the simplest form the format is the same as the .pub
Damien Miller32aa1441999-10-29 09:15:49 +10001092identity files (that is, each line contains the number of bits in
1093modulus, public exponent, modulus, and comment fields, separated by
Damien Miller7684ee12000-03-17 23:40:15 +11001094spaces).
1095This file is not highly sensitive, but the recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001096permissions are read/write for the user, and not accessible by others.
Damien Millere247cc42000-05-07 12:03:14 +10001097.It Pa $HOME/.ssh/authorized_keys2
1098Lists the DSA keys that can be used for logging in as this user.
1099This file is not highly sensitive, but the recommended
1100permissions are read/write for the user, and not accessible by others.
1101.It Pa /etc/ssh_known_hosts, /etc/ssh_known_hosts2
Damien Miller7684ee12000-03-17 23:40:15 +11001102Systemwide list of known host keys.
Damien Millere247cc42000-05-07 12:03:14 +10001103.Pa /etc/ssh_known_hosts
1104contains RSA and
1105.Pa /etc/ssh_known_hosts2
1106contains DSA keys.
1107These files should be prepared by the
Damien Miller32aa1441999-10-29 09:15:49 +10001108system administrator to contain the public host keys of all machines in the
Damien Miller7684ee12000-03-17 23:40:15 +11001109organization.
1110This file should be world-readable.
1111This file contains
Damien Miller32aa1441999-10-29 09:15:49 +10001112public keys, one per line, in the following format (fields separated
1113by spaces): system name, number of bits in modulus, public exponent,
Damien Miller7684ee12000-03-17 23:40:15 +11001114modulus, and optional comment field.
1115When different names are used
Damien Miller32aa1441999-10-29 09:15:49 +10001116for the same machine, all such names should be listed, separated by
Damien Miller7684ee12000-03-17 23:40:15 +11001117commas.
1118The format is described on the
Damien Miller32aa1441999-10-29 09:15:49 +10001119.Xr sshd 8
1120manual page.
1121.Pp
1122The canonical system name (as returned by name servers) is used by
1123.Xr sshd 8
1124to verify the client host when logging in; other names are needed because
1125.Nm
1126does not convert the user-supplied name to a canonical name before
1127checking the key, because someone with access to the name servers
1128would then be able to fool host authentication.
Damien Miller886c63a2000-01-20 23:13:36 +11001129.It Pa /etc/ssh_config
Damien Miller7684ee12000-03-17 23:40:15 +11001130Systemwide configuration file.
1131This file provides defaults for those
Damien Miller32aa1441999-10-29 09:15:49 +10001132values that are not specified in the user's configuration file, and
Damien Miller7684ee12000-03-17 23:40:15 +11001133for those users who do not have a configuration file.
1134This file must be world-readable.
Damien Miller32aa1441999-10-29 09:15:49 +10001135.It Pa $HOME/.rhosts
1136This file is used in
1137.Pa \&.rhosts
1138authentication to list the
Damien Miller7684ee12000-03-17 23:40:15 +11001139host/user pairs that are permitted to log in.
1140(Note that this file is
Damien Miller32aa1441999-10-29 09:15:49 +10001141also used by rlogin and rsh, which makes using this file insecure.)
1142Each line of the file contains a host name (in the canonical form
1143returned by name servers), and then a user name on that host,
Damien Miller7684ee12000-03-17 23:40:15 +11001144separated by a space.
1145One some machines this file may need to be
Damien Miller32aa1441999-10-29 09:15:49 +10001146world-readable if the user's home directory is on a NFS partition,
1147because
1148.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001149reads it as root.
1150Additionally, this file must be owned by the user,
1151and must not have write permissions for anyone else.
1152The recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001153permission for most machines is read/write for the user, and not
1154accessible by others.
1155.Pp
1156Note that by default
1157.Xr sshd 8
1158will be installed so that it requires successful RSA host
Damien Miller7684ee12000-03-17 23:40:15 +11001159authentication before permitting \s+2.\s0rhosts authentication.
1160If your server machine does not have the client's host key in
Damien Miller886c63a2000-01-20 23:13:36 +11001161.Pa /etc/ssh_known_hosts ,
Damien Miller32aa1441999-10-29 09:15:49 +10001162you can store it in
1163.Pa $HOME/.ssh/known_hosts .
1164The easiest way to do this is to
1165connect back to the client from the server machine using ssh; this
Damien Millere247cc42000-05-07 12:03:14 +10001166will automatically add the host key to
Damien Miller32aa1441999-10-29 09:15:49 +10001167.Pa $HOME/.ssh/known_hosts .
1168.It Pa $HOME/.shosts
1169This file is used exactly the same way as
1170.Pa \&.rhosts .
1171The purpose for
1172having this file is to be able to use rhosts authentication with
1173.Nm
1174without permitting login with
1175.Xr rlogin 1
1176or
1177.Xr rsh 1 .
1178.It Pa /etc/hosts.equiv
1179This file is used during
Damien Miller7684ee12000-03-17 23:40:15 +11001180.Pa \&.rhosts authentication.
1181It contains
Damien Miller32aa1441999-10-29 09:15:49 +10001182canonical hosts names, one per line (the full format is described on
1183the
1184.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001185manual page).
1186If the client host is found in this file, login is
Damien Miller32aa1441999-10-29 09:15:49 +10001187automatically permitted provided client and server user names are the
Damien Miller7684ee12000-03-17 23:40:15 +11001188same.
1189Additionally, successful RSA host authentication is normally
1190required.
1191This file should only be writable by root.
Damien Miller886c63a2000-01-20 23:13:36 +11001192.It Pa /etc/shosts.equiv
Damien Miller22c77262000-04-13 12:26:34 +10001193This file is processed exactly as
Damien Miller32aa1441999-10-29 09:15:49 +10001194.Pa /etc/hosts.equiv .
1195This file may be useful to permit logins using
1196.Nm
1197but not using rsh/rlogin.
Damien Miller886c63a2000-01-20 23:13:36 +11001198.It Pa /etc/sshrc
Damien Miller32aa1441999-10-29 09:15:49 +10001199Commands 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.
Damien Miller22c77262000-04-13 12:26:34 +10001210See the
Damien Miller32aa1441999-10-29 09:15:49 +10001211.Xr sshd 8
1212manual page for more information.
Damien Miller4f0fa561999-12-26 14:24:41 +11001213.It Pa $HOME/.ssh/environment
1214Contains additional definitions for environment variables, see section
1215.Sx ENVIRONMENT
1216above.
Damien Miller32aa1441999-10-29 09:15:49 +10001217.It Pa libcrypto.so.X.1
1218A version of this library which includes support for the RSA algorithm
1219is required for proper operation.
Damien Miller7b28dc52000-09-05 13:34:53 +11001220.El
Damien Miller32aa1441999-10-29 09:15:49 +10001221.Sh AUTHOR
Damien Miller32aa1441999-10-29 09:15:49 +10001222OpenSSH
Damien Miller98c7ad62000-03-09 21:27:49 +11001223is a derivative of the original (free) ssh 1.2.12 release by Tatu Ylonen,
Damien Miller7684ee12000-03-17 23:40:15 +11001224but with bugs removed and newer features re-added.
1225Rapidly after the
Damien Miller98c7ad62000-03-09 21:27:49 +110012261.2.12 release, newer versions of the original ssh bore successively
1227more restrictive licenses, and thus demand for a free version was born.
Damien Millere247cc42000-05-07 12:03:14 +10001228.Pp
Damien Miller98c7ad62000-03-09 21:27:49 +11001229This version of OpenSSH
Damien Miller32aa1441999-10-29 09:15:49 +10001230.Bl -bullet
1231.It
Damien Millere4340be2000-09-16 13:29:08 +11001232has all components of a restrictive nature (i.e., patents, see
1233.Xr crypto 3 )
Damien Miller32aa1441999-10-29 09:15:49 +10001234directly removed from the source code; any licensed or patented components
1235are chosen from
1236external libraries.
1237.It
Damien Millere247cc42000-05-07 12:03:14 +10001238has been updated to support SSH protocol 1.5 and 2, making it compatible with
1239all other SSH clients and servers.
Damien Miller32aa1441999-10-29 09:15:49 +10001240.It
Damien Miller22c77262000-04-13 12:26:34 +10001241contains added support for
Damien Miller32aa1441999-10-29 09:15:49 +10001242.Xr kerberos 8
1243authentication and ticket passing.
1244.It
1245supports one-time password authentication with
1246.Xr skey 1 .
1247.El
1248.Pp
Damien Miller6ee95641999-11-18 11:35:13 +11001249OpenSSH has been created by Aaron Campbell, Bob Beck, Markus Friedl,
Damien Miller10f6f6b1999-11-17 17:29:08 +11001250Niels Provos, Theo de Raadt, and Dug Song.
Damien Millere247cc42000-05-07 12:03:14 +10001251.Pp
1252The support for SSH protocol 2 was written by Markus Friedl.
Damien Miller32aa1441999-10-29 09:15:49 +10001253.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 ,
Damien Millere4340be2000-09-16 13:29:08 +11001262.Xr crypto 3