blob: a4738e63f238b46a094c0a8b0b2a14c6eb295611 [file] [log] [blame]
Damien Miller32aa1441999-10-29 09:15:49 +10001.\" -*- nroff -*-
2.\"
3.\" ssh.1.in
4.\"
5.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
6.\"
7.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8.\" All rights reserved
9.\"
10.\" Created: Sat Apr 22 21:55:14 1995 ylo
11.\"
Damien Millere247cc42000-05-07 12:03:14 +100012.\" $Id: ssh.1,v 1.24 2000/05/07 02:03:19 damien Exp $
Damien Miller32aa1441999-10-29 09:15:49 +100013.\"
14.Dd September 25, 1999
15.Dt SSH 1
16.Os
17.Sh NAME
18.Nm ssh
19.Nd OpenSSH secure shell client (remote login program)
20.Sh SYNOPSIS
21.Nm ssh
22.Op Fl l Ar login_name
23.Op Ar hostname | user@hostname
24.Op Ar command
25.Pp
26.Nm ssh
Damien Miller4af51302000-04-16 11:18:38 +100027.Op Fl afgknqtvxCPX246
Damien Miller32aa1441999-10-29 09:15:49 +100028.Op Fl c Ar blowfish | 3des
29.Op Fl e Ar escape_char
30.Op Fl i Ar identity_file
31.Op Fl l Ar login_name
32.Op Fl o Ar option
33.Op Fl p Ar port
34.Oo Fl L Xo
35.Sm off
Damien Miller32aa1441999-10-29 09:15:49 +100036.Ar port :
Damien Miller396691a2000-01-20 22:44:08 +110037.Ar host :
Damien Miller32aa1441999-10-29 09:15:49 +100038.Ar hostport
39.Sm on
40.Xc
41.Oc
42.Oo Fl R Xo
43.Sm off
Damien Miller32aa1441999-10-29 09:15:49 +100044.Ar port :
Damien Miller396691a2000-01-20 22:44:08 +110045.Ar host :
Damien Miller32aa1441999-10-29 09:15:49 +100046.Ar hostport
47.Sm on
48.Xc
49.Oc
50.Op Ar hostname | user@hostname
51.Op Ar command
Damien Miller22c77262000-04-13 12:26:34 +100052.Sh DESCRIPTION
Damien Miller32aa1441999-10-29 09:15:49 +100053.Nm
54(Secure Shell) is a program for logging into a remote machine and for
Damien Miller7684ee12000-03-17 23:40:15 +110055executing commands on a remote machine.
56It is intended to replace
Damien Miller32aa1441999-10-29 09:15:49 +100057rlogin and rsh, and provide secure encrypted communications between
Damien Miller7684ee12000-03-17 23:40:15 +110058two untrusted hosts over an insecure network.
59X11 connections and
Damien Miller32aa1441999-10-29 09:15:49 +100060arbitrary TCP/IP ports can also be forwarded over the secure channel.
61.Pp
62.Nm
Damien Miller22c77262000-04-13 12:26:34 +100063connects and logs into the specified
Damien Miller32aa1441999-10-29 09:15:49 +100064.Ar hostname .
65The user must prove
Damien Millere247cc42000-05-07 12:03:14 +100066his/her identity to the remote machine using one of several methods
67depending on the protocol version used:
68.Pp
69.Ss SSH protocol version 1
Damien Miller32aa1441999-10-29 09:15:49 +100070.Pp
71First, if the machine the user logs in from is listed in
72.Pa /etc/hosts.equiv
73or
Damien Miller886c63a2000-01-20 23:13:36 +110074.Pa /etc/shosts.equiv
Damien Miller32aa1441999-10-29 09:15:49 +100075on the remote machine, and the user names are
76the same on both sides, the user is immediately permitted to log in.
Damien Miller22c77262000-04-13 12:26:34 +100077Second, if
Damien Miller32aa1441999-10-29 09:15:49 +100078.Pa \&.rhosts
79or
80.Pa \&.shosts
81exists in the user's home directory on the
82remote machine and contains a line containing the name of the client
83machine and the name of the user on that machine, the user is
Damien Miller7684ee12000-03-17 23:40:15 +110084permitted to log in.
85This form of authentication alone is normally not
Damien Miller32aa1441999-10-29 09:15:49 +100086allowed by the server because it is not secure.
87.Pp
88The second (and primary) authentication method is the
89.Pa rhosts
90or
91.Pa hosts.equiv
Damien Miller7684ee12000-03-17 23:40:15 +110092method combined with RSA-based host authentication.
93It means that if the login would be permitted by
Damien Millere247cc42000-05-07 12:03:14 +100094.Pa $HOME/.rhosts ,
95.Pa $HOME/.shosts ,
Damien Miller32aa1441999-10-29 09:15:49 +100096.Pa /etc/hosts.equiv ,
97or
Damien Miller886c63a2000-01-20 23:13:36 +110098.Pa /etc/shosts.equiv ,
Damien Miller32aa1441999-10-29 09:15:49 +100099and if additionally the server can verify the client's
Damien Miller22c77262000-04-13 12:26:34 +1000100host key (see
Damien Miller886c63a2000-01-20 23:13:36 +1100101.Pa /etc/ssh_known_hosts
Damien Miller33e511e1999-11-11 11:43:13 +1100102and
103.Pa $HOME/.ssh/known_hosts
Damien Miller32aa1441999-10-29 09:15:49 +1000104in the
105.Sx FILES
Damien Miller7684ee12000-03-17 23:40:15 +1100106section), only then login is permitted.
107This authentication method closes security holes due to IP
108spoofing, DNS spoofing and routing spoofing.
109[Note to the administrator:
Damien Miller32aa1441999-10-29 09:15:49 +1000110.Pa /etc/hosts.equiv ,
Damien Millere247cc42000-05-07 12:03:14 +1000111.Pa $HOME/.rhosts ,
Damien Miller32aa1441999-10-29 09:15:49 +1000112and the rlogin/rsh protocol in general, are inherently insecure and should be
113disabled if security is desired.]
114.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000115As a third authentication method,
Damien Miller32aa1441999-10-29 09:15:49 +1000116.Nm
117supports RSA based authentication.
118The scheme is based on public-key cryptography: there are cryptosystems
119where encryption and decryption are done using separate keys, and it
120is not possible to derive the decryption key from the encryption key.
Damien Miller7684ee12000-03-17 23:40:15 +1100121RSA is one such system.
Damien Miller22c77262000-04-13 12:26:34 +1000122The idea is that each user creates a public/private
Damien Miller7684ee12000-03-17 23:40:15 +1100123key pair for authentication purposes.
124The server knows the public key, and only the user knows the private key.
Damien Miller22c77262000-04-13 12:26:34 +1000125The file
Damien Miller32aa1441999-10-29 09:15:49 +1000126.Pa $HOME/.ssh/authorized_keys
127lists the public keys that are permitted for logging
Damien Miller7684ee12000-03-17 23:40:15 +1100128in.
129When the user logs in, the
Damien Miller32aa1441999-10-29 09:15:49 +1000130.Nm
131program tells the server which key pair it would like to use for
Damien Miller7684ee12000-03-17 23:40:15 +1100132authentication.
133The server checks if this key is permitted, and if
Damien Miller32aa1441999-10-29 09:15:49 +1000134so, sends the user (actually the
135.Nm
136program running on behalf of the user) a challenge, a random number,
Damien Miller7684ee12000-03-17 23:40:15 +1100137encrypted by the user's public key.
138The challenge can only be
139decrypted using the proper private key.
140The user's client then decrypts the
Damien Miller32aa1441999-10-29 09:15:49 +1000141challenge using the private key, proving that he/she knows the private
142key but without disclosing it to the server.
143.Pp
144.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100145implements the RSA authentication protocol automatically.
146The user creates his/her RSA key pair by running
Damien Miller32aa1441999-10-29 09:15:49 +1000147.Xr ssh-keygen 1 .
Damien Miller22c77262000-04-13 12:26:34 +1000148This stores the private key in
Damien Millere247cc42000-05-07 12:03:14 +1000149.Pa $HOME/.ssh/identity
Damien Miller32aa1441999-10-29 09:15:49 +1000150and the public key in
Damien Millere247cc42000-05-07 12:03:14 +1000151.Pa $HOME/.ssh/identity.pub
Damien Miller7684ee12000-03-17 23:40:15 +1100152in the user's home directory.
153The user should then copy the
Damien Miller32aa1441999-10-29 09:15:49 +1000154.Pa identity.pub
Damien Miller22c77262000-04-13 12:26:34 +1000155to
Damien Millere247cc42000-05-07 12:03:14 +1000156.Pa $HOME/.ssh/authorized_keys
Damien Miller22c77262000-04-13 12:26:34 +1000157in his/her home directory on the remote machine (the
Damien Miller32aa1441999-10-29 09:15:49 +1000158.Pa authorized_keys
Damien Miller22c77262000-04-13 12:26:34 +1000159file corresponds to the conventional
Damien Millere247cc42000-05-07 12:03:14 +1000160.Pa $HOME/.rhosts
Damien Miller32aa1441999-10-29 09:15:49 +1000161file, and has one key
Damien Miller7684ee12000-03-17 23:40:15 +1100162per line, though the lines can be very long).
163After this, the user can log in without giving the password.
164RSA authentication is much
Damien Miller32aa1441999-10-29 09:15:49 +1000165more secure than rhosts authentication.
166.Pp
167The most convenient way to use RSA authentication may be with an
Damien Miller7684ee12000-03-17 23:40:15 +1100168authentication agent.
169See
Damien Miller32aa1441999-10-29 09:15:49 +1000170.Xr ssh-agent 1
171for more information.
172.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000173If other authentication methods fail,
Damien Miller32aa1441999-10-29 09:15:49 +1000174.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100175prompts the user for a password.
176The password is sent to the remote
Damien Miller32aa1441999-10-29 09:15:49 +1000177host for checking; however, since all communications are encrypted,
178the password cannot be seen by someone listening on the network.
179.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000180.Ss SSH protocol version 2
181.Pp
182When a user connects using the protocol version 2
183different authentication methods are available:
184At first, the client attempts to authenticate using the public key method.
185If this method fails password authentication is tried.
186.Pp
187The public key method is similar to RSA authentication described
188in the previous section except that the DSA algorithm is used
189instead of the patented RSA algorithm.
190The client uses his private DSA key
191.Pa $HOME/.ssh/id_dsa
192to sign the session identifier and sends the result to the server.
193The server checks whether the matching public key is listed in
194.Pa $HOME/.ssh/authorized_keys2
195and grants access if both the key is found and the signature is correct.
196The session identifier is derived from a shared Diffie-Hellman value
197and is only known to the client and the server.
198.Pp
199If public key authentication fails or is not available a password
200can be sent encrypted to the remote host for proving the user's identity.
201This protocol 2 implementation does not yet support Kerberos or
202S/Key authentication.
203.Pp
204Protocol 2 provides additional mechanisms for confidentiality
205(the traffic is encrypted using 3DES, blowfish, cast128 or arcfour)
206and integrity (hmac-sha1, hmac-md5).
207Note that protocol 1 lacks a strong mechanism for ensuring the
208integrity of the connection.
209.Pp
210.Ss Login session and remote execution
211.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000212When the user's identity has been accepted by the server, the server
213either executes the given command, or logs into the machine and gives
Damien Miller7684ee12000-03-17 23:40:15 +1100214the user a normal shell on the remote machine.
215All communication with
Damien Miller32aa1441999-10-29 09:15:49 +1000216the remote command or shell will be automatically encrypted.
217.Pp
218If a pseudo-terminal has been allocated (normal login session), the
219user can disconnect with
220.Ic ~. ,
221and suspend
222.Nm
223with
224.Ic ~^Z .
225All forwarded connections can be listed with
Damien Miller22c77262000-04-13 12:26:34 +1000226.Ic ~#
Damien Miller32aa1441999-10-29 09:15:49 +1000227and if
228the session blocks waiting for forwarded X11 or TCP/IP
229connections to terminate, it can be backgrounded with
230.Ic ~&
231(this should not be used while the user shell is active, as it can cause the
Damien Miller7684ee12000-03-17 23:40:15 +1100232shell to hang).
233All available escapes can be listed with
Damien Miller32aa1441999-10-29 09:15:49 +1000234.Ic ~? .
235.Pp
236A single tilde character can be sent as
237.Ic ~~
238(or by following the tilde by a character other than those described above).
239The escape character must always follow a newline to be interpreted as
Damien Miller7684ee12000-03-17 23:40:15 +1100240special.
241The escape character can be changed in configuration files
242or on the command line.
Damien Miller32aa1441999-10-29 09:15:49 +1000243.Pp
244If no pseudo tty has been allocated, the
245session is transparent and can be used to reliably transfer binary
Damien Miller7684ee12000-03-17 23:40:15 +1100246data.
247On most systems, setting the escape character to
Damien Miller32aa1441999-10-29 09:15:49 +1000248.Dq none
249will also make the session transparent even if a tty is used.
250.Pp
251The session terminates when the command or shell in on the remote
252machine exists and all X11 and TCP/IP connections have been closed.
253The exit status of the remote program is returned as the exit status
254of
255.Nm ssh .
256.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000257.Ss X11 and TCP forwarding
258.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000259If the user is using X11 (the
260.Ev DISPLAY
261environment variable is set), the connection to the X11 display is
262automatically forwarded to the remote side in such a way that any X11
263programs started from the shell (or command) will go through the
264encrypted channel, and the connection to the real X server will be made
Damien Miller7684ee12000-03-17 23:40:15 +1100265from the local machine.
266The user should not manually set
Damien Miller32aa1441999-10-29 09:15:49 +1000267.Ev DISPLAY .
268Forwarding of X11 connections can be
269configured on the command line or in configuration files.
270.Pp
271The
Damien Miller22c77262000-04-13 12:26:34 +1000272.Ev DISPLAY
Damien Miller32aa1441999-10-29 09:15:49 +1000273value set by
274.Nm
275will point to the server machine, but with a display number greater
Damien Miller7684ee12000-03-17 23:40:15 +1100276than zero.
277This is normal, and happens because
Damien Miller32aa1441999-10-29 09:15:49 +1000278.Nm
279creates a
280.Dq proxy
281X server on the server machine for forwarding the
282connections over the encrypted channel.
283.Pp
284.Nm
285will also automatically set up Xauthority data on the server machine.
286For this purpose, it will generate a random authorization cookie,
287store it in Xauthority on the server, and verify that any forwarded
288connections carry this cookie and replace it by the real cookie when
Damien Miller7684ee12000-03-17 23:40:15 +1100289the connection is opened.
290The real authentication cookie is never
Damien Miller32aa1441999-10-29 09:15:49 +1000291sent to the server machine (and no cookies are sent in the plain).
292.Pp
293If the user is using an authentication agent, the connection to the agent
294is automatically forwarded to the remote side unless disabled on
295command line or in a configuration file.
296.Pp
297Forwarding of arbitrary TCP/IP connections over the secure channel can
Damien Miller7684ee12000-03-17 23:40:15 +1100298be specified either on command line or in a configuration file.
299One possible application of TCP/IP forwarding is a secure connection to an
Damien Miller32aa1441999-10-29 09:15:49 +1000300electronic purse; another is going trough firewalls.
301.Pp
Damien Millere247cc42000-05-07 12:03:14 +1000302.Ss Server authentication
303.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000304.Nm
Damien Millere247cc42000-05-07 12:03:14 +1000305automatically maintains and checks a database containing
Damien Miller7684ee12000-03-17 23:40:15 +1100306identifications for all hosts it has ever been used with.
Damien Millere247cc42000-05-07 12:03:14 +1000307RSA host keys are stored in
308.Pa $HOME/.ssh/known_hosts
309and
310DSA host keys are stored in
311.Pa $HOME/.ssh/known_hosts2
Damien Miller7684ee12000-03-17 23:40:15 +1100312in the user's home directory.
Damien Millere247cc42000-05-07 12:03:14 +1000313Additionally, the files
Damien Miller886c63a2000-01-20 23:13:36 +1100314.Pa /etc/ssh_known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000315and
316.Pa /etc/ssh_known_hosts2
317are automatically checked for known hosts.
Damien Miller7684ee12000-03-17 23:40:15 +1100318Any new hosts are automatically added to the user's file.
319If a host's identification
Damien Miller32aa1441999-10-29 09:15:49 +1000320ever changes,
321.Nm
322warns about this and disables password authentication to prevent a
Damien Miller7684ee12000-03-17 23:40:15 +1100323trojan horse from getting the user's password.
324Another purpose of
Damien Miller32aa1441999-10-29 09:15:49 +1000325this mechanism is to prevent man-in-the-middle attacks which could
Damien Miller7684ee12000-03-17 23:40:15 +1100326otherwise be used to circumvent the encryption.
327The
Damien Miller32aa1441999-10-29 09:15:49 +1000328.Cm StrictHostKeyChecking
329option (see below) can be used to prevent logins to machines whose
330host key is not known or has changed.
331.Sh OPTIONS
332.Bl -tag -width Ds
333.It Fl a
Damien Miller450a7a12000-03-26 13:04:51 +1000334Disables forwarding of the authentication agent connection.
335This may also be specified on a per-host basis in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000336.It Fl c Ar blowfish|3des
Damien Miller22c77262000-04-13 12:26:34 +1000337Selects the cipher to use for encrypting the session.
Damien Miller32aa1441999-10-29 09:15:49 +1000338.Ar 3des
Damien Miller7684ee12000-03-17 23:40:15 +1100339is used by default.
Damien Miller22c77262000-04-13 12:26:34 +1000340It is believed to be secure.
Damien Miller32aa1441999-10-29 09:15:49 +1000341.Ar 3des
342(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
343It is presumably more secure than the
344.Ar des
345cipher which is no longer supported in ssh.
346.Ar blowfish
347is a fast block cipher, it appears very secure and is much faster than
Damien Miller7684ee12000-03-17 23:40:15 +1100348.Ar 3des .
Damien Miller32aa1441999-10-29 09:15:49 +1000349.It Fl e Ar ch|^ch|none
350Sets the escape character for sessions with a pty (default:
351.Ql ~ ) .
Damien Miller7684ee12000-03-17 23:40:15 +1100352The escape character is only recognized at the beginning of a line.
353The escape character followed by a dot
Damien Miller32aa1441999-10-29 09:15:49 +1000354.Pq Ql \&.
355closes the connection, followed
356by control-Z suspends the connection, and followed by itself sends the
Damien Miller7684ee12000-03-17 23:40:15 +1100357escape character once.
358Setting the character to
Damien Miller32aa1441999-10-29 09:15:49 +1000359.Dq none
360disables any escapes and makes the session fully transparent.
361.It Fl f
362Requests
363.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100364to go to background just before command execution.
365This is useful if
Damien Miller32aa1441999-10-29 09:15:49 +1000366.Nm
367is going to ask for passwords or passphrases, but the user
Damien Miller7684ee12000-03-17 23:40:15 +1100368wants it in the background.
Damien Miller22c77262000-04-13 12:26:34 +1000369This implies
Damien Miller32aa1441999-10-29 09:15:49 +1000370.Fl n .
371The recommended way to start X11 programs at a remote site is with
372something like
373.Ic ssh -f host xterm .
Damien Miller396691a2000-01-20 22:44:08 +1100374.It Fl g
375Allows remote hosts to connect to local forwarded ports.
Damien Miller32aa1441999-10-29 09:15:49 +1000376.It Fl i Ar identity_file
Damien Miller22c77262000-04-13 12:26:34 +1000377Selects the file from which the identity (private key) for
Damien Miller7684ee12000-03-17 23:40:15 +1100378RSA authentication is read.
Damien Miller22c77262000-04-13 12:26:34 +1000379Default is
Damien Millere247cc42000-05-07 12:03:14 +1000380.Pa $HOME/.ssh/identity
Damien Miller7684ee12000-03-17 23:40:15 +1100381in the user's home directory.
382Identity files may also be specified on
383a per-host basis in the configuration file.
384It is possible to have multiple
Damien Miller32aa1441999-10-29 09:15:49 +1000385.Fl i
386options (and multiple identities specified in
387configuration files).
Damien Miller32aa1441999-10-29 09:15:49 +1000388.It Fl k
Damien Miller450a7a12000-03-26 13:04:51 +1000389Disables forwarding of Kerberos tickets and AFS tokens.
390This may also be specified on a per-host basis in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000391.It Fl l Ar login_name
Damien Miller7684ee12000-03-17 23:40:15 +1100392Specifies the user to log in as on the remote machine.
393This also may be specified on a per-host basis in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000394.It Fl n
395Redirects stdin from
396.Pa /dev/null
397(actually, prevents reading from stdin).
398This must be used when
399.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100400is run in the background.
401A common trick is to use this to run X11 programs on a remote machine.
402For example,
Damien Miller32aa1441999-10-29 09:15:49 +1000403.Ic ssh -n shadows.cs.hut.fi emacs &
404will start an emacs on shadows.cs.hut.fi, and the X11
405connection will be automatically forwarded over an encrypted channel.
406The
407.Nm
408program will be put in the background.
409(This does not work if
410.Nm
411needs to ask for a password or passphrase; see also the
412.Fl f
413option.)
414.It Fl o Ar option
415Can be used to give options in the format used in the config file.
416This is useful for specifying options for which there is no separate
Damien Miller7684ee12000-03-17 23:40:15 +1100417command-line flag.
418The option has the same format as a line in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000419.It Fl p Ar port
Damien Miller7684ee12000-03-17 23:40:15 +1100420Port to connect to on the remote host.
421This can be specified on a
Damien Miller32aa1441999-10-29 09:15:49 +1000422per-host basis in the configuration file.
423.It Fl P
424Use a non-privileged port for outgoing connections.
425This can be used if your firewall does
426not permit connections from privileged ports.
Damien Millera34a28b1999-12-14 10:47:15 +1100427Note that this option turns off
Damien Miller32aa1441999-10-29 09:15:49 +1000428.Cm RhostsAuthentication
429and
430.Cm RhostsRSAAuthentication .
431.It Fl q
Damien Miller7684ee12000-03-17 23:40:15 +1100432Quiet mode.
433Causes all warning and diagnostic messages to be suppressed.
434Only fatal errors are displayed.
Damien Miller32aa1441999-10-29 09:15:49 +1000435.It Fl t
Damien Miller7684ee12000-03-17 23:40:15 +1100436Force pseudo-tty allocation.
Damien Miller450a7a12000-03-26 13:04:51 +1000437This can be used to execute arbitrary
Damien Miller7684ee12000-03-17 23:40:15 +1100438screen-based programs on a remote machine, which can be very useful,
439e.g., when implementing menu services.
Damien Miller32aa1441999-10-29 09:15:49 +1000440.It Fl v
Damien Miller7684ee12000-03-17 23:40:15 +1100441Verbose mode.
442Causes
Damien Miller32aa1441999-10-29 09:15:49 +1000443.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100444to print debugging messages about its progress.
445This is helpful in
Damien Miller32aa1441999-10-29 09:15:49 +1000446debugging connection, authentication, and configuration problems.
447The verbose mode is also used to display
448.Xr skey 1
449challenges, if the user entered "s/key" as password.
450.It Fl x
Damien Miller7684ee12000-03-17 23:40:15 +1100451Disables X11 forwarding.
452This can also be specified on a per-host basis in a configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000453.It Fl X
454Enables X11 forwarding.
455.It Fl C
456Requests compression of all data (including stdin, stdout, stderr, and
Damien Miller7684ee12000-03-17 23:40:15 +1100457data for forwarded X11 and TCP/IP connections).
458The compression algorithm is the same used by
Damien Miller396691a2000-01-20 22:44:08 +1100459.Xr gzip 1 ,
460and the
Damien Miller32aa1441999-10-29 09:15:49 +1000461.Dq level
462can be controlled by the
463.Cm CompressionLevel
Damien Miller7684ee12000-03-17 23:40:15 +1100464option (see below).
465Compression is desirable on modem lines and other
Damien Miller32aa1441999-10-29 09:15:49 +1000466slow connections, but will only slow down things on fast networks.
467The default value can be set on a host-by-host basis in the
468configuration files; see the
469.Cm Compress
470option below.
471.It Fl L Ar port:host:hostport
472Specifies that the given port on the local (client) host is to be
Damien Miller7684ee12000-03-17 23:40:15 +1100473forwarded to the given host and port on the remote side.
474This works by allocating a socket to listen to
Damien Miller32aa1441999-10-29 09:15:49 +1000475.Ar port
476on the local side, and whenever a connection is made to this port, the
477connection is forwarded over the secure channel, and a connection is
478made to
Damien Miller34132e52000-01-14 15:45:46 +1100479.Ar host
480port
481.Ar hostport
Damien Miller7684ee12000-03-17 23:40:15 +1100482from the remote machine.
483Port forwardings can also be specified in the configuration file.
484Only root can forward privileged ports.
Damien Miller34132e52000-01-14 15:45:46 +1100485IPv6 addresses can be specified with an alternative syntax:
486.Ar port/host/hostport
Damien Miller32aa1441999-10-29 09:15:49 +1000487.It Fl R Ar port:host:hostport
488Specifies that the given port on the remote (server) host is to be
Damien Miller7684ee12000-03-17 23:40:15 +1100489forwarded to the given host and port on the local side.
490This works by allocating a socket to listen to
Damien Miller32aa1441999-10-29 09:15:49 +1000491.Ar port
492on the remote side, and whenever a connection is made to this port, the
493connection is forwarded over the secure channel, and a connection is
494made to
Damien Miller34132e52000-01-14 15:45:46 +1100495.Ar host
496port
497.Ar hostport
Damien Miller7684ee12000-03-17 23:40:15 +1100498from the local machine.
499Port forwardings can also be specified in the configuration file.
500Privileged ports can be forwarded only when
Damien Miller32aa1441999-10-29 09:15:49 +1000501logging in as root on the remote machine.
Damien Miller4af51302000-04-16 11:18:38 +1000502.It Fl 2
503Forces
504.Nm
Damien Millere247cc42000-05-07 12:03:14 +1000505to try protocol version 2 only.
Damien Miller34132e52000-01-14 15:45:46 +1100506.It Fl 4
507Forces
508.Nm
509to use IPv4 addresses only.
510.It Fl 6
511Forces
512.Nm
513to use IPv6 addresses only.
Damien Miller32aa1441999-10-29 09:15:49 +1000514.El
515.Sh CONFIGURATION FILES
516.Nm
517obtains configuration data from the following sources (in this order):
518command line options, user's configuration file
519.Pq Pa $HOME/.ssh/config ,
520and system-wide configuration file
Damien Miller886c63a2000-01-20 23:13:36 +1100521.Pq Pa /etc/ssh_config .
Damien Miller32aa1441999-10-29 09:15:49 +1000522For each parameter, the first obtained value
Damien Miller7684ee12000-03-17 23:40:15 +1100523will be used.
524The configuration files contain sections bracketed by
525.Dq Host
526specifications, and that section is only applied for hosts that
527match one of the patterns given in the specification.
528The matched host name is the one given on the command line.
Damien Miller32aa1441999-10-29 09:15:49 +1000529.Pp
530Since the first obtained value for each parameter is used, more
531host-specific declarations should be given near the beginning of the
532file, and general defaults at the end.
533.Pp
534The configuration file has the following format:
535.Pp
536Empty lines and lines starting with
537.Ql #
538are comments.
539.Pp
540Otherwise a line is of the format
541.Dq keyword arguments .
542The possible
543keywords and their meanings are as follows (note that the
544configuration files are case-sensitive):
545.Bl -tag -width Ds
546.It Cm Host
547Restricts the following declarations (up to the next
548.Cm Host
549keyword) to be only for those hosts that match one of the patterns
550given after the keyword.
551.Ql \&*
552and
553.Ql ?
554can be used as wildcards in the
Damien Miller7684ee12000-03-17 23:40:15 +1100555patterns.
556A single
Damien Miller32aa1441999-10-29 09:15:49 +1000557.Ql \&*
558as a pattern can be used to provide global
Damien Miller7684ee12000-03-17 23:40:15 +1100559defaults for all hosts.
560The host is the
Damien Miller32aa1441999-10-29 09:15:49 +1000561.Ar hostname
562argument given on the command line (i.e., the name is not converted to
563a canonicalized host name before matching).
564.It Cm AFSTokenPassing
Damien Miller450a7a12000-03-26 13:04:51 +1000565Specifies whether to pass AFS tokens to remote host.
566The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000567.Dq yes
568or
569.Dq no .
570.It Cm BatchMode
571If set to
572.Dq yes ,
Damien Miller7684ee12000-03-17 23:40:15 +1100573passphrase/password querying will be disabled.
574This option is useful in scripts and other batch jobs where you have no
575user to supply the password.
576The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000577.Dq yes
578or
579.Dq no .
Damien Miller396691a2000-01-20 22:44:08 +1100580.It Cm CheckHostIP
581If this flag is set to
582.Dq yes ,
583ssh will additionally check the host ip address in the
584.Pa known_hosts
Damien Miller450a7a12000-03-26 13:04:51 +1000585file.
586This allows ssh to detect if a host key changed due to DNS spoofing.
Damien Miller396691a2000-01-20 22:44:08 +1100587If the option is set to
588.Dq no ,
589the check will not be executed.
Damien Miller32aa1441999-10-29 09:15:49 +1000590.It Cm Cipher
Damien Miller7684ee12000-03-17 23:40:15 +1100591Specifies the cipher to use for encrypting the session.
592Currently,
Damien Miller32aa1441999-10-29 09:15:49 +1000593.Dq blowfish ,
594and
595.Dq 3des
Damien Miller7684ee12000-03-17 23:40:15 +1100596are supported.
597The default is
Damien Miller32aa1441999-10-29 09:15:49 +1000598.Dq 3des .
Damien Miller22c77262000-04-13 12:26:34 +1000599.It Cm Ciphers
600Specifies the ciphers allowed for protocol version 2
601in order of preference.
602Multiple ciphers must be comma-separated.
603The default is
604.Dq blowfish-cbc,3des-cbc,arcfour,cast128-cbc .
Damien Miller32aa1441999-10-29 09:15:49 +1000605.It Cm Compression
Damien Miller7684ee12000-03-17 23:40:15 +1100606Specifies whether to use compression.
607The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000608.Dq yes
609or
610.Dq no .
611.It Cm CompressionLevel
Damien Miller7684ee12000-03-17 23:40:15 +1100612Specifies the compression level to use if compression is enable.
613The argument must be an integer from 1 (fast) to 9 (slow, best).
614The default level is 6, which is good for most applications.
615The meaning of the values is the same as in
Damien Miller396691a2000-01-20 22:44:08 +1100616.Xr gzip 1 .
Damien Miller32aa1441999-10-29 09:15:49 +1000617.It Cm ConnectionAttempts
618Specifies the number of tries (one per second) to make before falling
Damien Miller7684ee12000-03-17 23:40:15 +1100619back to rsh or exiting.
620The argument must be an integer.
621This may be useful in scripts if the connection sometimes fails.
Damien Millere247cc42000-05-07 12:03:14 +1000622.It Cm DSAAuthentication
623Specifies whether to try DSA authentication.
624The argument to this keyword must be
625.Dq yes
626or
627.Dq no .
628DSA authentication will only be
629attempted if a DSA identity file exists.
630Note that this option applies to protocol version 2 only.
Damien Miller32aa1441999-10-29 09:15:49 +1000631.It Cm EscapeChar
632Sets the escape character (default:
633.Ql ~ ) .
634The escape character can also
Damien Miller7684ee12000-03-17 23:40:15 +1100635be set on the command line.
636The argument should be a single character,
Damien Miller32aa1441999-10-29 09:15:49 +1000637.Ql ^
638followed by a letter, or
639.Dq none
640to disable the escape
641character entirely (making the connection transparent for binary
642data).
Damien Miller22c77262000-04-13 12:26:34 +1000643.It Cm FallBackToRsh
Damien Miller32aa1441999-10-29 09:15:49 +1000644Specifies that if connecting via
645.Nm
646fails due to a connection refused error (there is no
647.Xr sshd 8
Damien Miller22c77262000-04-13 12:26:34 +1000648listening on the remote host),
Damien Miller32aa1441999-10-29 09:15:49 +1000649.Xr rsh 1
650should automatically be used instead (after a suitable warning about
Damien Miller7684ee12000-03-17 23:40:15 +1100651the session being unencrypted).
652The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000653.Dq yes
654or
655.Dq no .
656.It Cm ForwardAgent
657Specifies whether the connection to the authentication agent (if any)
Damien Miller7684ee12000-03-17 23:40:15 +1100658will be forwarded to the remote machine.
659The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000660.Dq yes
661or
662.Dq no .
663.It Cm ForwardX11
664Specifies whether X11 connections will be automatically redirected
Damien Miller22c77262000-04-13 12:26:34 +1000665over the secure channel and
Damien Miller32aa1441999-10-29 09:15:49 +1000666.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +1100667set.
Damien Miller22c77262000-04-13 12:26:34 +1000668The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000669.Dq yes
670or
671.Dq no .
Damien Miller98c7ad62000-03-09 21:27:49 +1100672The default is
673.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000674.It Cm GatewayPorts
675Specifies whether remote hosts are allowed to connect to local
676forwarded ports.
677The argument must be
678.Dq yes
679or
680.Dq no .
681The default is
682.Dq no .
683.It Cm GlobalKnownHostsFile
Damien Miller22c77262000-04-13 12:26:34 +1000684Specifies a file to use instead of
Damien Miller886c63a2000-01-20 23:13:36 +1100685.Pa /etc/ssh_known_hosts .
Damien Miller32aa1441999-10-29 09:15:49 +1000686.It Cm HostName
Damien Miller7684ee12000-03-17 23:40:15 +1100687Specifies the real host name to log into.
688This can be used to specify nicknames or abbreviations for hosts.
689Default is the name given on the command line.
690Numeric IP addresses are also permitted (both on the command line and in
Damien Miller32aa1441999-10-29 09:15:49 +1000691.Cm HostName
692specifications).
693.It Cm IdentityFile
694Specifies the file from which the user's RSA authentication identity
695is read (default
Damien Millere247cc42000-05-07 12:03:14 +1000696.Pa $HOME/.ssh/identity
Damien Miller32aa1441999-10-29 09:15:49 +1000697in the user's home directory).
698Additionally, any identities represented by the authentication agent
Damien Miller7684ee12000-03-17 23:40:15 +1100699will be used for authentication.
700The file name may use the tilde
701syntax to refer to a user's home directory.
702It is possible to have
Damien Miller32aa1441999-10-29 09:15:49 +1000703multiple identity files specified in configuration files; all these
704identities will be tried in sequence.
Damien Millere247cc42000-05-07 12:03:14 +1000705.It Cm IdentityFile2
706Specifies the file from which the user's DSA authentication identity
707is read (default
708.Pa $HOME/.ssh/id_dsa
709in the user's home directory).
710The file name may use the tilde
711syntax to refer to a user's home directory.
712It is possible to have
713multiple identity files specified in configuration files; all these
714identities will be tried in sequence.
Damien Miller32aa1441999-10-29 09:15:49 +1000715.It Cm KeepAlive
716Specifies whether the system should send keepalive messages to the
Damien Miller7684ee12000-03-17 23:40:15 +1100717other side.
718If they are sent, death of the connection or crash of one
719of the machines will be properly noticed.
720However, this means that
Damien Miller32aa1441999-10-29 09:15:49 +1000721connections will die if the route is down temporarily, and some people
Damien Miller450a7a12000-03-26 13:04:51 +1000722find it annoying.
Damien Miller32aa1441999-10-29 09:15:49 +1000723.Pp
724The default is
725.Dq yes
726(to send keepalives), and the client will notice
Damien Miller7684ee12000-03-17 23:40:15 +1100727if the network goes down or the remote host dies.
728This is important in scripts, and many users want it too.
Damien Miller32aa1441999-10-29 09:15:49 +1000729.Pp
730To disable keepalives, the value should be set to
731.Dq no
732in both the server and the client configuration files.
733.It Cm KerberosAuthentication
Damien Miller450a7a12000-03-26 13:04:51 +1000734Specifies whether Kerberos authentication will be used.
735The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000736.Dq yes
737or
738.Dq no .
739.It Cm KerberosTgtPassing
Damien Miller450a7a12000-03-26 13:04:51 +1000740Specifies whether a Kerberos TGT will be forwarded to the server.
741This will only work if the Kerberos server is actually an AFS kaserver.
742The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000743.Dq yes
744or
745.Dq no .
746.It Cm LocalForward
747Specifies that a TCP/IP port on the local machine be forwarded over
Damien Miller7684ee12000-03-17 23:40:15 +1100748the secure channel to given host:port from the remote machine.
749The first argument must be a port number, and the second must be
750host:port.
751Multiple forwardings may be specified, and additional
752forwardings can be given on the command line.
753Only the superuser can forward privileged ports.
Damien Miller5ce662a1999-11-11 17:57:39 +1100754.It Cm LogLevel
755Gives the verbosity level that is used when logging messages from
756.Nm ssh .
757The possible values are:
Damien Miller00d4bb12000-03-03 22:48:49 +1100758QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
Damien Miller5ce662a1999-11-11 17:57:39 +1100759The default is INFO.
Damien Miller32aa1441999-10-29 09:15:49 +1000760.It Cm NumberOfPasswordPrompts
Damien Miller450a7a12000-03-26 13:04:51 +1000761Specifies the number of password prompts before giving up.
762The argument to this keyword must be an integer.
763Default is 3.
Damien Miller396691a2000-01-20 22:44:08 +1100764.It Cm PasswordAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100765Specifies whether to use password authentication.
766The argument to this keyword must be
Damien Miller396691a2000-01-20 22:44:08 +1100767.Dq yes
768or
769.Dq no .
Damien Millere247cc42000-05-07 12:03:14 +1000770Note that this option applies to both protocol version 1 and 2.
Damien Miller32aa1441999-10-29 09:15:49 +1000771.It Cm Port
Damien Miller7684ee12000-03-17 23:40:15 +1100772Specifies the port number to connect on the remote host.
773Default is 22.
Damien Miller22c77262000-04-13 12:26:34 +1000774.It Cm Protocol
775Specifies the protocol versions
776.Nm
777should support in order of preference.
778The possible values are
779.Dq 1
780and
781.Dq 2 .
782Multiple versions must be comma-separated.
783The default is
Damien Millere247cc42000-05-07 12:03:14 +1000784.Dq 1,2 .
785This means that
786.Nm
787tries version 1 and falls back to version 2
788if version 1 is no available.
Damien Miller32aa1441999-10-29 09:15:49 +1000789.It Cm ProxyCommand
Damien Miller7684ee12000-03-17 23:40:15 +1100790Specifies the command to use to connect to the server.
791The command
792string extends to the end of the line, and is executed with
793.Pa /bin/sh .
794In the command string,
795.Ql %h
796will be substituted by the host name to
797connect and
798.Ql %p
799by the port.
800The command can be basically anything,
801and should read from its standard input and write to its standard output.
802It should eventually connect an
Damien Miller32aa1441999-10-29 09:15:49 +1000803.Xr sshd 8
804server running on some machine, or execute
805.Ic sshd -i
Damien Miller7684ee12000-03-17 23:40:15 +1100806somewhere.
807Host key management will be done using the
Damien Miller32aa1441999-10-29 09:15:49 +1000808HostName of the host being connected (defaulting to the name typed by
809the user).
Damien Milleraae6c611999-12-06 11:47:28 +1100810Note that
811.Cm CheckHostIP
812is not available for connects with a proxy command.
Damien Miller32aa1441999-10-29 09:15:49 +1000813.Pp
814.It Cm RemoteForward
815Specifies that a TCP/IP port on the remote machine be forwarded over
Damien Miller7684ee12000-03-17 23:40:15 +1100816the secure channel to given host:port from the local machine.
817The first argument must be a port number, and the second must be
818host:port.
819Multiple forwardings may be specified, and additional
820forwardings can be given on the command line.
821Only the superuser can forward privileged ports.
Damien Miller32aa1441999-10-29 09:15:49 +1000822.It Cm RhostsAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100823Specifies whether to try rhosts based authentication.
824Note that this
Damien Miller32aa1441999-10-29 09:15:49 +1000825declaration only affects the client side and has no effect whatsoever
Damien Miller7684ee12000-03-17 23:40:15 +1100826on security.
827Disabling rhosts authentication may reduce
Damien Miller32aa1441999-10-29 09:15:49 +1000828authentication time on slow connections when rhosts authentication is
Damien Miller7684ee12000-03-17 23:40:15 +1100829not used.
830Most servers do not permit RhostsAuthentication because it
831is not secure (see RhostsRSAAuthentication).
832The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000833.Dq yes
834or
835.Dq no .
836.It Cm RhostsRSAAuthentication
837Specifies whether to try rhosts based authentication with RSA host
Damien Miller7684ee12000-03-17 23:40:15 +1100838authentication.
839This is the primary authentication method for most sites.
840The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000841.Dq yes
842or
843.Dq no .
844.It Cm RSAAuthentication
Damien Miller7684ee12000-03-17 23:40:15 +1100845Specifies whether to try RSA authentication.
846The argument to this keyword must be
Damien Miller32aa1441999-10-29 09:15:49 +1000847.Dq yes
848or
849.Dq no .
850RSA authentication will only be
851attempted if the identity file exists, or an authentication agent is
852running.
Damien Millere247cc42000-05-07 12:03:14 +1000853Note that this option applies to protocol version 1 only.
Damien Miller95def091999-11-25 00:26:21 +1100854.It Cm SkeyAuthentication
855Specifies whether to use
856.Xr skey 1
Damien Miller7684ee12000-03-17 23:40:15 +1100857authentication.
858The argument to this keyword must be
Damien Miller95def091999-11-25 00:26:21 +1100859.Dq yes
860or
861.Dq no .
862The default is
863.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000864.It Cm StrictHostKeyChecking
865If this flag is set to
Damien Miller22c77262000-04-13 12:26:34 +1000866.Dq yes ,
Damien Miller32aa1441999-10-29 09:15:49 +1000867.Nm
868ssh will never automatically add host keys to the
869.Pa $HOME/.ssh/known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000870and
871.Pa $HOME/.ssh/known_hosts2
872files, and refuses to connect hosts whose host key has changed.
Damien Miller7684ee12000-03-17 23:40:15 +1100873This provides maximum protection against trojan horse attacks.
874However, it can be somewhat annoying if you don't have good
Damien Miller886c63a2000-01-20 23:13:36 +1100875.Pa /etc/ssh_known_hosts
Damien Millere247cc42000-05-07 12:03:14 +1000876and
877.Pa /etc/ssh_known_hosts2
Damien Miller32aa1441999-10-29 09:15:49 +1000878files installed and frequently
Damien Miller7684ee12000-03-17 23:40:15 +1100879connect new hosts.
880Basically this option forces the user to manually
881add any new hosts.
882Normally this option is disabled, and new hosts
883will automatically be added to the known host files.
884The host keys of
885known hosts will be verified automatically in either case.
886The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000887.Dq yes
888or
889.Dq no .
Damien Miller32aa1441999-10-29 09:15:49 +1000890.It Cm UsePrivilegedPort
891Specifies whether to use a privileged port for outgoing connections.
892The argument must be
893.Dq yes
894or
895.Dq no .
896The default is
897.Dq yes .
898Note that setting this option to
899.Dq no
Damien Millera34a28b1999-12-14 10:47:15 +1100900turns off
Damien Miller32aa1441999-10-29 09:15:49 +1000901.Cm RhostsAuthentication
902and
903.Cm RhostsRSAAuthentication .
Damien Miller396691a2000-01-20 22:44:08 +1100904.It Cm User
Damien Miller7684ee12000-03-17 23:40:15 +1100905Specifies the user to log in as.
906This can be useful if you have a different user name on different machines.
907This saves the trouble of
Damien Miller396691a2000-01-20 22:44:08 +1100908having to remember to give the user name on the command line.
909.It Cm UserKnownHostsFile
910Specifies a file to use instead of
911.Pa $HOME/.ssh/known_hosts .
Damien Miller32aa1441999-10-29 09:15:49 +1000912.It Cm UseRsh
Damien Miller7684ee12000-03-17 23:40:15 +1100913Specifies that rlogin/rsh should be used for this host.
914It is possible that the host does not at all support the
Damien Miller32aa1441999-10-29 09:15:49 +1000915.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100916protocol.
917This causes
Damien Miller32aa1441999-10-29 09:15:49 +1000918.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100919to immediately execute
Damien Miller32aa1441999-10-29 09:15:49 +1000920.Xr rsh 1 .
921All other options (except
922.Cm HostName )
Damien Miller7684ee12000-03-17 23:40:15 +1100923are ignored if this has been specified.
924The argument must be
Damien Miller32aa1441999-10-29 09:15:49 +1000925.Dq yes
926or
927.Dq no .
928.Sh ENVIRONMENT
929.Nm
930will normally set the following environment variables:
931.Bl -tag -width Ds
932.It Ev DISPLAY
933The
934.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +1100935variable indicates the location of the X11 server.
Damien Miller22c77262000-04-13 12:26:34 +1000936It is automatically set by
Damien Miller32aa1441999-10-29 09:15:49 +1000937.Nm
938to point to a value of the form
939.Dq hostname:n
940where hostname indicates
Damien Miller7684ee12000-03-17 23:40:15 +1100941the host where the shell runs, and n is an integer >= 1.
942.Nm
943uses this special value to forward X11 connections over the secure
944channel.
945The user should normally not set DISPLAY explicitly, as that
Damien Miller32aa1441999-10-29 09:15:49 +1000946will render the X11 connection insecure (and will require the user to
947manually copy any required authorization cookies).
948.It Ev HOME
949Set to the path of the user's home directory.
950.It Ev LOGNAME
951Synonym for
952.Ev USER ;
953set for compatibility with systems that use this variable.
954.It Ev MAIL
955Set to point the user's mailbox.
Damien Miller7684ee12000-03-17 23:40:15 +1100956.It Ev PATH
Damien Miller32aa1441999-10-29 09:15:49 +1000957Set to the default
958.Ev PATH ,
959as specified when compiling
960.Nm ssh .
961.It Ev SSH_AUTH_SOCK
962indicates the path of a unix-domain socket used to communicate with the
963agent.
964.It Ev SSH_CLIENT
Damien Miller7684ee12000-03-17 23:40:15 +1100965Identifies the client end of the connection.
966The variable contains
Damien Miller32aa1441999-10-29 09:15:49 +1000967three space-separated values: client ip-address, client port number,
968and server port number.
969.It Ev SSH_TTY
970This is set to the name of the tty (path to the device) associated
Damien Miller7684ee12000-03-17 23:40:15 +1100971with the current shell or command.
972If the current session has no tty,
Damien Miller32aa1441999-10-29 09:15:49 +1000973this variable is not set.
974.It Ev TZ
975The timezone variable is set to indicate the present timezone if it
976was set when the daemon was started (e.i., the daemon passes the value
977on to new connections).
978.It Ev USER
979Set to the name of the user logging in.
980.El
981.Pp
Damien Miller22c77262000-04-13 12:26:34 +1000982Additionally,
Damien Miller32aa1441999-10-29 09:15:49 +1000983.Nm
Damien Miller22c77262000-04-13 12:26:34 +1000984reads
985.Pa $HOME/.ssh/environment ,
Damien Miller32aa1441999-10-29 09:15:49 +1000986and adds lines of the format
987.Dq VARNAME=value
988to the environment.
989.Sh FILES
Damien Miller98c7ad62000-03-09 21:27:49 +1100990.Bl -tag -width Ds
Damien Miller32aa1441999-10-29 09:15:49 +1000991.It Pa $HOME/.ssh/known_hosts
992Records host keys for all hosts the user has logged into (that are not
993in
Damien Miller886c63a2000-01-20 23:13:36 +1100994.Pa /etc/ssh_known_hosts ) .
Damien Miller32aa1441999-10-29 09:15:49 +1000995See
996.Xr sshd 8 .
Damien Millere247cc42000-05-07 12:03:14 +1000997.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa
998Contains the RSA and the DSA authentication identity of the user.
999These files
1000contain sensitive data and should be readable by the user but not
Damien Miller32aa1441999-10-29 09:15:49 +10001001accessible by others (read/write/execute).
1002Note that
1003.Nm
Damien Millere247cc42000-05-07 12:03:14 +10001004ignores a private key file if it is accessible by others.
Damien Miller32aa1441999-10-29 09:15:49 +10001005It is possible to specify a passphrase when
1006generating the key; the passphrase will be used to encrypt the
1007sensitive part of this file using 3DES.
Damien Millere247cc42000-05-07 12:03:14 +10001008.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub
Damien Miller32aa1441999-10-29 09:15:49 +10001009Contains the public key for authentication (public part of the
Damien Miller7684ee12000-03-17 23:40:15 +11001010identity file in human-readable form).
Damien Millere247cc42000-05-07 12:03:14 +10001011The contents of the
1012.Pa $HOME/.ssh/identity.pub
1013file should be added to
Damien Miller32aa1441999-10-29 09:15:49 +10001014.Pa $HOME/.ssh/authorized_keys
1015on all machines
Damien Miller7684ee12000-03-17 23:40:15 +11001016where you wish to log in using RSA authentication.
Damien Millere247cc42000-05-07 12:03:14 +10001017The contents of the
1018.Pa $HOME/.ssh/id_dsa.pub
1019file should be added to
1020.Pa $HOME/.ssh/authorized_keys2
1021on all machines
1022where you wish to log in using DSA authentication.
1023These files are not
Damien Miller7684ee12000-03-17 23:40:15 +11001024sensitive and can (but need not) be readable by anyone.
Damien Millere247cc42000-05-07 12:03:14 +10001025These files are
1026never used automatically and are not necessary; they is only provided for
Damien Miller32aa1441999-10-29 09:15:49 +10001027the convenience of the user.
1028.It Pa $HOME/.ssh/config
Damien Miller7684ee12000-03-17 23:40:15 +11001029This is the per-user configuration file.
1030The format of this file is described above.
1031This file is used by the
Damien Miller32aa1441999-10-29 09:15:49 +10001032.Nm
Damien Miller7684ee12000-03-17 23:40:15 +11001033client.
1034This file does not usually contain any sensitive information,
Damien Miller32aa1441999-10-29 09:15:49 +10001035but the recommended permissions are read/write for the user, and not
1036accessible by others.
1037.It Pa $HOME/.ssh/authorized_keys
Damien Miller7684ee12000-03-17 23:40:15 +11001038Lists the RSA keys that can be used for logging in as this user.
1039The format of this file is described in the
Damien Miller32aa1441999-10-29 09:15:49 +10001040.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001041manual page.
1042In the simplest form the format is the same as the .pub
Damien Miller32aa1441999-10-29 09:15:49 +10001043identity files (that is, each line contains the number of bits in
1044modulus, public exponent, modulus, and comment fields, separated by
Damien Miller7684ee12000-03-17 23:40:15 +11001045spaces).
1046This file is not highly sensitive, but the recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001047permissions are read/write for the user, and not accessible by others.
Damien Millere247cc42000-05-07 12:03:14 +10001048.It Pa $HOME/.ssh/authorized_keys2
1049Lists the DSA keys that can be used for logging in as this user.
1050This file is not highly sensitive, but the recommended
1051permissions are read/write for the user, and not accessible by others.
1052.It Pa /etc/ssh_known_hosts, /etc/ssh_known_hosts2
Damien Miller7684ee12000-03-17 23:40:15 +11001053Systemwide list of known host keys.
Damien Millere247cc42000-05-07 12:03:14 +10001054.Pa /etc/ssh_known_hosts
1055contains RSA and
1056.Pa /etc/ssh_known_hosts2
1057contains DSA keys.
1058These files should be prepared by the
Damien Miller32aa1441999-10-29 09:15:49 +10001059system administrator to contain the public host keys of all machines in the
Damien Miller7684ee12000-03-17 23:40:15 +11001060organization.
1061This file should be world-readable.
1062This file contains
Damien Miller32aa1441999-10-29 09:15:49 +10001063public keys, one per line, in the following format (fields separated
1064by spaces): system name, number of bits in modulus, public exponent,
Damien Miller7684ee12000-03-17 23:40:15 +11001065modulus, and optional comment field.
1066When different names are used
Damien Miller32aa1441999-10-29 09:15:49 +10001067for the same machine, all such names should be listed, separated by
Damien Miller7684ee12000-03-17 23:40:15 +11001068commas.
1069The format is described on the
Damien Miller32aa1441999-10-29 09:15:49 +10001070.Xr sshd 8
1071manual page.
1072.Pp
1073The canonical system name (as returned by name servers) is used by
1074.Xr sshd 8
1075to verify the client host when logging in; other names are needed because
1076.Nm
1077does not convert the user-supplied name to a canonical name before
1078checking the key, because someone with access to the name servers
1079would then be able to fool host authentication.
Damien Miller886c63a2000-01-20 23:13:36 +11001080.It Pa /etc/ssh_config
Damien Miller7684ee12000-03-17 23:40:15 +11001081Systemwide configuration file.
1082This file provides defaults for those
Damien Miller32aa1441999-10-29 09:15:49 +10001083values that are not specified in the user's configuration file, and
Damien Miller7684ee12000-03-17 23:40:15 +11001084for those users who do not have a configuration file.
1085This file must be world-readable.
Damien Miller32aa1441999-10-29 09:15:49 +10001086.It Pa $HOME/.rhosts
1087This file is used in
1088.Pa \&.rhosts
1089authentication to list the
Damien Miller7684ee12000-03-17 23:40:15 +11001090host/user pairs that are permitted to log in.
1091(Note that this file is
Damien Miller32aa1441999-10-29 09:15:49 +10001092also used by rlogin and rsh, which makes using this file insecure.)
1093Each line of the file contains a host name (in the canonical form
1094returned by name servers), and then a user name on that host,
Damien Miller7684ee12000-03-17 23:40:15 +11001095separated by a space.
1096One some machines this file may need to be
Damien Miller32aa1441999-10-29 09:15:49 +10001097world-readable if the user's home directory is on a NFS partition,
1098because
1099.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001100reads it as root.
1101Additionally, this file must be owned by the user,
1102and must not have write permissions for anyone else.
1103The recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001104permission for most machines is read/write for the user, and not
1105accessible by others.
1106.Pp
1107Note that by default
1108.Xr sshd 8
1109will be installed so that it requires successful RSA host
Damien Miller7684ee12000-03-17 23:40:15 +11001110authentication before permitting \s+2.\s0rhosts authentication.
1111If your server machine does not have the client's host key in
Damien Miller886c63a2000-01-20 23:13:36 +11001112.Pa /etc/ssh_known_hosts ,
Damien Miller32aa1441999-10-29 09:15:49 +10001113you can store it in
1114.Pa $HOME/.ssh/known_hosts .
1115The easiest way to do this is to
1116connect back to the client from the server machine using ssh; this
Damien Millere247cc42000-05-07 12:03:14 +10001117will automatically add the host key to
Damien Miller32aa1441999-10-29 09:15:49 +10001118.Pa $HOME/.ssh/known_hosts .
1119.It Pa $HOME/.shosts
1120This file is used exactly the same way as
1121.Pa \&.rhosts .
1122The purpose for
1123having this file is to be able to use rhosts authentication with
1124.Nm
1125without permitting login with
1126.Xr rlogin 1
1127or
1128.Xr rsh 1 .
1129.It Pa /etc/hosts.equiv
1130This file is used during
Damien Miller7684ee12000-03-17 23:40:15 +11001131.Pa \&.rhosts authentication.
1132It contains
Damien Miller32aa1441999-10-29 09:15:49 +10001133canonical hosts names, one per line (the full format is described on
1134the
1135.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001136manual page).
1137If the client host is found in this file, login is
Damien Miller32aa1441999-10-29 09:15:49 +10001138automatically permitted provided client and server user names are the
Damien Miller7684ee12000-03-17 23:40:15 +11001139same.
1140Additionally, successful RSA host authentication is normally
1141required.
1142This file should only be writable by root.
Damien Miller886c63a2000-01-20 23:13:36 +11001143.It Pa /etc/shosts.equiv
Damien Miller22c77262000-04-13 12:26:34 +10001144This file is processed exactly as
Damien Miller32aa1441999-10-29 09:15:49 +10001145.Pa /etc/hosts.equiv .
1146This file may be useful to permit logins using
1147.Nm
1148but not using rsh/rlogin.
Damien Miller886c63a2000-01-20 23:13:36 +11001149.It Pa /etc/sshrc
Damien Miller32aa1441999-10-29 09:15:49 +10001150Commands in this file are executed by
1151.Nm
1152when the user logs in just before the user's shell (or command) is started.
1153See the
1154.Xr sshd 8
1155manual page for more information.
1156.It Pa $HOME/.ssh/rc
1157Commands in this file are executed by
1158.Nm
1159when the user logs in just before the user's shell (or command) is
1160started.
Damien Miller22c77262000-04-13 12:26:34 +10001161See the
Damien Miller32aa1441999-10-29 09:15:49 +10001162.Xr sshd 8
1163manual page for more information.
Damien Miller4f0fa561999-12-26 14:24:41 +11001164.It Pa $HOME/.ssh/environment
1165Contains additional definitions for environment variables, see section
1166.Sx ENVIRONMENT
1167above.
Damien Miller32aa1441999-10-29 09:15:49 +10001168.It Pa libcrypto.so.X.1
1169A version of this library which includes support for the RSA algorithm
1170is required for proper operation.
1171.Sh AUTHOR
Damien Miller32aa1441999-10-29 09:15:49 +10001172OpenSSH
Damien Miller98c7ad62000-03-09 21:27:49 +11001173is a derivative of the original (free) ssh 1.2.12 release by Tatu Ylonen,
Damien Miller7684ee12000-03-17 23:40:15 +11001174but with bugs removed and newer features re-added.
1175Rapidly after the
Damien Miller98c7ad62000-03-09 21:27:49 +110011761.2.12 release, newer versions of the original ssh bore successively
1177more restrictive licenses, and thus demand for a free version was born.
Damien Millere247cc42000-05-07 12:03:14 +10001178.Pp
Damien Miller98c7ad62000-03-09 21:27:49 +11001179This version of OpenSSH
Damien Miller32aa1441999-10-29 09:15:49 +10001180.Bl -bullet
1181.It
Damien Millercfabe862000-04-20 23:27:27 +10001182has all components of a restrictive nature (i.e., patents)
Damien Miller32aa1441999-10-29 09:15:49 +10001183directly removed from the source code; any licensed or patented components
1184are chosen from
1185external libraries.
1186.It
Damien Millere247cc42000-05-07 12:03:14 +10001187has been updated to support SSH protocol 1.5 and 2, making it compatible with
1188all other SSH clients and servers.
Damien Miller32aa1441999-10-29 09:15:49 +10001189.It
Damien Miller22c77262000-04-13 12:26:34 +10001190contains added support for
Damien Miller32aa1441999-10-29 09:15:49 +10001191.Xr kerberos 8
1192authentication and ticket passing.
1193.It
1194supports one-time password authentication with
1195.Xr skey 1 .
1196.El
1197.Pp
Damien Miller6ee95641999-11-18 11:35:13 +11001198OpenSSH has been created by Aaron Campbell, Bob Beck, Markus Friedl,
Damien Miller10f6f6b1999-11-17 17:29:08 +11001199Niels Provos, Theo de Raadt, and Dug Song.
Damien Millere247cc42000-05-07 12:03:14 +10001200.Pp
1201The support for SSH protocol 2 was written by Markus Friedl.
Damien Miller32aa1441999-10-29 09:15:49 +10001202.Sh SEE ALSO
1203.Xr rlogin 1 ,
1204.Xr rsh 1 ,
1205.Xr scp 1 ,
1206.Xr ssh-add 1 ,
1207.Xr ssh-agent 1 ,
1208.Xr ssh-keygen 1 ,
1209.Xr telnet 1 ,
1210.Xr sshd 8 ,