]> andersk Git - openssh.git/blame - ssh.1
- stevesk@cvs.openbsd.org 2001/08/29 23:39:40
[openssh.git] / ssh.1
CommitLineData
bf740959 1.\" -*- nroff -*-
2.\"
bf740959 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
bf740959 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5.\" All rights reserved
6.\"
bcbf86ec 7.\" As far as I am concerned, the code I have written for this software
8.\" can be used freely for any purpose. Any derived versions of this
9.\" software must be clearly marked as such, and if the derived work is
10.\" incompatible with the protocol description in the RFC file, it must be
11.\" called by a name other than "ssh" or "Secure Shell".
12.\"
f3c7c613 13.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
14.\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
15.\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
bcbf86ec 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.
bf740959 25.\"
bcbf86ec 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.
bf740959 36.\"
70068acc 37.\" $OpenBSD: ssh.1,v 1.134 2001/08/29 23:39:40 stevesk Exp $
bf740959 38.Dd September 25, 1999
39.Dt SSH 1
40.Os
41.Sh NAME
42.Nm ssh
2c86906e 43.Nd OpenSSH SSH client (remote login program)
bf740959 44.Sh SYNOPSIS
45.Nm ssh
46.Op Fl l Ar login_name
c78e5800 47.Ar hostname | user@hostname
bf740959 48.Op Ar command
49.Pp
50.Nm ssh
9afadca8 51.Op Fl afgknqstvxACNPTX1246
3435f5a6 52.Op Fl b Ar bind_address
d0c832f3 53.Op Fl c Ar cipher_spec
bf740959 54.Op Fl e Ar escape_char
55.Op Fl i Ar identity_file
56.Op Fl l Ar login_name
b2552997 57.Op Fl m Ar mac_spec
bf740959 58.Op Fl o Ar option
59.Op Fl p Ar port
e591b98a 60.Op Fl F Ar configfile
bf740959 61.Oo Fl L Xo
62.Sm off
bf740959 63.Ar port :
7b2ea3a1 64.Ar host :
bf740959 65.Ar hostport
66.Sm on
67.Xc
68.Oc
69.Oo Fl R Xo
70.Sm off
bf740959 71.Ar port :
7b2ea3a1 72.Ar host :
bf740959 73.Ar hostport
74.Sm on
75.Xc
76.Oc
c78e5800 77.Ar hostname | user@hostname
bf740959 78.Op Ar command
f54651ce 79.Sh DESCRIPTION
bf740959 80.Nm
2c86906e 81(SSH client) is a program for logging into a remote machine and for
610cd5c6 82executing commands on a remote machine.
83It is intended to replace
bf740959 84rlogin and rsh, and provide secure encrypted communications between
610cd5c6 85two untrusted hosts over an insecure network.
86X11 connections and
bf740959 87arbitrary TCP/IP ports can also be forwarded over the secure channel.
88.Pp
89.Nm
f54651ce 90connects and logs into the specified
bf740959 91.Ar hostname .
92The user must prove
1d1ffb87 93his/her identity to the remote machine using one of several methods
94depending on the protocol version used:
95.Pp
96.Ss SSH protocol version 1
bf740959 97.Pp
98First, if the machine the user logs in from is listed in
99.Pa /etc/hosts.equiv
100or
5f4fdfae 101.Pa /etc/shosts.equiv
bf740959 102on the remote machine, and the user names are
103the same on both sides, the user is immediately permitted to log in.
f54651ce 104Second, if
bf740959 105.Pa \&.rhosts
106or
107.Pa \&.shosts
108exists in the user's home directory on the
109remote machine and contains a line containing the name of the client
110machine and the name of the user on that machine, the user is
610cd5c6 111permitted to log in.
112This form of authentication alone is normally not
bf740959 113allowed by the server because it is not secure.
114.Pp
da89cf4d 115The second authentication method is the
bf740959 116.Pa rhosts
117or
118.Pa hosts.equiv
610cd5c6 119method combined with RSA-based host authentication.
120It means that if the login would be permitted by
1d1ffb87 121.Pa $HOME/.rhosts ,
122.Pa $HOME/.shosts ,
bf740959 123.Pa /etc/hosts.equiv ,
124or
5f4fdfae 125.Pa /etc/shosts.equiv ,
bf740959 126and if additionally the server can verify the client's
f54651ce 127host key (see
5f4fdfae 128.Pa /etc/ssh_known_hosts
5bbb5681 129and
130.Pa $HOME/.ssh/known_hosts
bf740959 131in the
132.Sx FILES
610cd5c6 133section), only then login is permitted.
134This authentication method closes security holes due to IP
135spoofing, DNS spoofing and routing spoofing.
136[Note to the administrator:
bf740959 137.Pa /etc/hosts.equiv ,
1d1ffb87 138.Pa $HOME/.rhosts ,
bf740959 139and the rlogin/rsh protocol in general, are inherently insecure and should be
140disabled if security is desired.]
141.Pp
f54651ce 142As a third authentication method,
bf740959 143.Nm
144supports RSA based authentication.
145The scheme is based on public-key cryptography: there are cryptosystems
146where encryption and decryption are done using separate keys, and it
147is not possible to derive the decryption key from the encryption key.
610cd5c6 148RSA is one such system.
f54651ce 149The idea is that each user creates a public/private
610cd5c6 150key pair for authentication purposes.
151The server knows the public key, and only the user knows the private key.
f54651ce 152The file
bf740959 153.Pa $HOME/.ssh/authorized_keys
154lists the public keys that are permitted for logging
610cd5c6 155in.
156When the user logs in, the
bf740959 157.Nm
158program tells the server which key pair it would like to use for
610cd5c6 159authentication.
160The server checks if this key is permitted, and if
bf740959 161so, sends the user (actually the
162.Nm
163program running on behalf of the user) a challenge, a random number,
610cd5c6 164encrypted by the user's public key.
165The challenge can only be
166decrypted using the proper private key.
167The user's client then decrypts the
bf740959 168challenge using the private key, proving that he/she knows the private
169key but without disclosing it to the server.
170.Pp
171.Nm
610cd5c6 172implements the RSA authentication protocol automatically.
173The user creates his/her RSA key pair by running
bf740959 174.Xr ssh-keygen 1 .
f54651ce 175This stores the private key in
1d1ffb87 176.Pa $HOME/.ssh/identity
bf740959 177and the public key in
1d1ffb87 178.Pa $HOME/.ssh/identity.pub
610cd5c6 179in the user's home directory.
180The user should then copy the
bf740959 181.Pa identity.pub
f54651ce 182to
1d1ffb87 183.Pa $HOME/.ssh/authorized_keys
f54651ce 184in his/her home directory on the remote machine (the
bf740959 185.Pa authorized_keys
f54651ce 186file corresponds to the conventional
1d1ffb87 187.Pa $HOME/.rhosts
bf740959 188file, and has one key
610cd5c6 189per line, though the lines can be very long).
190After this, the user can log in without giving the password.
191RSA authentication is much
bf740959 192more secure than rhosts authentication.
193.Pp
194The most convenient way to use RSA authentication may be with an
610cd5c6 195authentication agent.
196See
bf740959 197.Xr ssh-agent 1
198for more information.
199.Pp
f54651ce 200If other authentication methods fail,
bf740959 201.Nm
610cd5c6 202prompts the user for a password.
203The password is sent to the remote
bf740959 204host for checking; however, since all communications are encrypted,
205the password cannot be seen by someone listening on the network.
206.Pp
1d1ffb87 207.Ss SSH protocol version 2
208.Pp
209When a user connects using the protocol version 2
da89cf4d 210different authentication methods are available.
211Using the default values for
212.Cm PreferredAuthentications ,
29c440a0 213the client will try to authenticate first using the hostbased method;
214if this method fails public key authentication is attempted,
215and finally if this method fails keyboard-interactive and
216password authentication are tried.
1d1ffb87 217.Pp
218The public key method is similar to RSA authentication described
da89cf4d 219in the previous section and allows the RSA or DSA algorithm to be used:
c0ecc314 220The client uses his private key,
1d1ffb87 221.Pa $HOME/.ssh/id_dsa
c0ecc314 222or
223.Pa $HOME/.ssh/id_rsa ,
1d1ffb87 224to sign the session identifier and sends the result to the server.
225The server checks whether the matching public key is listed in
96a7b0cc 226.Pa $HOME/.ssh/authorized_keys
1d1ffb87 227and grants access if both the key is found and the signature is correct.
228The session identifier is derived from a shared Diffie-Hellman value
229and is only known to the client and the server.
230.Pp
231If public key authentication fails or is not available a password
232can be sent encrypted to the remote host for proving the user's identity.
da89cf4d 233.Pp
234Additionally,
235.Nm
236supports hostbased or challenge response authentication.
1d1ffb87 237.Pp
238Protocol 2 provides additional mechanisms for confidentiality
d0c832f3 239(the traffic is encrypted using 3DES, Blowfish, CAST128 or Arcfour)
f2ba0775 240and integrity (hmac-md5, hmac-sha1).
1d1ffb87 241Note that protocol 1 lacks a strong mechanism for ensuring the
242integrity of the connection.
243.Pp
244.Ss Login session and remote execution
245.Pp
bf740959 246When the user's identity has been accepted by the server, the server
247either executes the given command, or logs into the machine and gives
610cd5c6 248the user a normal shell on the remote machine.
249All communication with
bf740959 250the remote command or shell will be automatically encrypted.
251.Pp
252If a pseudo-terminal has been allocated (normal login session), the
df841692 253user may use the escape characters noted below.
bf740959 254.Pp
255If no pseudo tty has been allocated, the
256session is transparent and can be used to reliably transfer binary
610cd5c6 257data.
258On most systems, setting the escape character to
bf740959 259.Dq none
260will also make the session transparent even if a tty is used.
261.Pp
ce9c0b75 262The session terminates when the command or shell on the remote
e91c60f2 263machine exits and all X11 and TCP/IP connections have been closed.
bf740959 264The exit status of the remote program is returned as the exit status
265of
266.Nm ssh .
267.Pp
df841692 268.Ss Escape Characters
269.Pp
270When a pseudo terminal has been requested, ssh supports a number of functions
3730bb22 271through the use of an escape character.
df841692 272.Pp
273A single tilde character can be sent as
274.Ic ~~
5bef3c35 275or by following the tilde by a character other than those described below.
df841692 276The escape character must always follow a newline to be interpreted as
277special.
278The escape character can be changed in configuration files using the
279.Cm EscapeChar
3730bb22 280configuration directive or on the command line by the
df841692 281.Fl e
282option.
283.Pp
284The supported escapes (assuming the default
285.Ql ~ )
286are:
287.Bl -tag -width Ds
288.It Cm ~.
289Disconnect
290.It Cm ~^Z
291Background ssh
292.It Cm ~#
293List forwarded connections
294.It Cm ~&
295Background ssh at logout when waiting for forwarded connection / X11 sessions
da89cf4d 296to terminate (protocol version 1 only)
df841692 297.It Cm ~?
298Display a list of escape characters
299.It Cm ~R
67b964a1 300Request rekeying of the connection (only useful for SSH protocol version 2
301and if the peer supports it)
df841692 302.El
303.Pp
1d1ffb87 304.Ss X11 and TCP forwarding
305.Pp
6efa3d14 306If the
307.Cm ForwardX11
308variable is set to
309.Dq yes
310(or, see the description of the
311.Fl X
312and
313.Fl x
314options described later)
315and the user is using X11 (the
bf740959 316.Ev DISPLAY
317environment variable is set), the connection to the X11 display is
318automatically forwarded to the remote side in such a way that any X11
319programs started from the shell (or command) will go through the
320encrypted channel, and the connection to the real X server will be made
610cd5c6 321from the local machine.
322The user should not manually set
bf740959 323.Ev DISPLAY .
324Forwarding of X11 connections can be
325configured on the command line or in configuration files.
326.Pp
327The
f54651ce 328.Ev DISPLAY
bf740959 329value set by
330.Nm
331will point to the server machine, but with a display number greater
610cd5c6 332than zero.
333This is normal, and happens because
bf740959 334.Nm
335creates a
336.Dq proxy
337X server on the server machine for forwarding the
338connections over the encrypted channel.
339.Pp
340.Nm
341will also automatically set up Xauthority data on the server machine.
342For this purpose, it will generate a random authorization cookie,
343store it in Xauthority on the server, and verify that any forwarded
344connections carry this cookie and replace it by the real cookie when
610cd5c6 345the connection is opened.
346The real authentication cookie is never
bf740959 347sent to the server machine (and no cookies are sent in the plain).
348.Pp
349If the user is using an authentication agent, the connection to the agent
350is automatically forwarded to the remote side unless disabled on
491f5f7b 351the command line or in a configuration file.
bf740959 352.Pp
353Forwarding of arbitrary TCP/IP connections over the secure channel can
491f5f7b 354be specified either on the command line or in a configuration file.
610cd5c6 355One possible application of TCP/IP forwarding is a secure connection to an
e91c60f2 356electronic purse; another is going through firewalls.
bf740959 357.Pp
1d1ffb87 358.Ss Server authentication
359.Pp
bf740959 360.Nm
1d1ffb87 361automatically maintains and checks a database containing
610cd5c6 362identifications for all hosts it has ever been used with.
f49bc4f7 363Host keys are stored in
1d1ffb87 364.Pa $HOME/.ssh/known_hosts
610cd5c6 365in the user's home directory.
f49bc4f7 366Additionally, the file
5f4fdfae 367.Pa /etc/ssh_known_hosts
f49bc4f7 368is automatically checked for known hosts.
610cd5c6 369Any new hosts are automatically added to the user's file.
370If a host's identification
bf740959 371ever changes,
372.Nm
373warns about this and disables password authentication to prevent a
610cd5c6 374trojan horse from getting the user's password.
375Another purpose of
bf740959 376this mechanism is to prevent man-in-the-middle attacks which could
610cd5c6 377otherwise be used to circumvent the encryption.
378The
bf740959 379.Cm StrictHostKeyChecking
380option (see below) can be used to prevent logins to machines whose
381host key is not known or has changed.
fa08c86b 382.Pp
383The options are as follows:
bf740959 384.Bl -tag -width Ds
385.It Fl a
4fe2af09 386Disables forwarding of the authentication agent connection.
71276795 387.It Fl A
388Enables forwarding of the authentication agent connection.
389This can also be specified on a per-host basis in a configuration file.
3435f5a6 390.It Fl b Ar bind_address
391Specify the interface to transmit from on machines with multiple
392interfaces or aliased addresses.
29999e54 393.It Fl c Ar blowfish|3des|des
f54651ce 394Selects the cipher to use for encrypting the session.
bf740959 395.Ar 3des
610cd5c6 396is used by default.
f54651ce 397It is believed to be secure.
bf740959 398.Ar 3des
399(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
bf740959 400.Ar blowfish
401is a fast block cipher, it appears very secure and is much faster than
610cd5c6 402.Ar 3des .
29999e54 403.Ar des
404is only supported in the
405.Nm
406client for interoperability with legacy protocol 1 implementations
407that do not support the
408.Ar 3des
409cipher. Its use is strongly discouraged due to cryptographic
410weaknesses.
9afadca8 411.It Fl c Ar cipher_spec
d0c832f3 412Additionally, for protocol version 2 a comma-separated list of ciphers can
94ec8c6b 413be specified in order of preference.
9afadca8 414See
415.Cm Ciphers
416for more information.
bf740959 417.It Fl e Ar ch|^ch|none
418Sets the escape character for sessions with a pty (default:
419.Ql ~ ) .
610cd5c6 420The escape character is only recognized at the beginning of a line.
421The escape character followed by a dot
bf740959 422.Pq Ql \&.
423closes the connection, followed
424by control-Z suspends the connection, and followed by itself sends the
610cd5c6 425escape character once.
426Setting the character to
bf740959 427.Dq none
428disables any escapes and makes the session fully transparent.
429.It Fl f
430Requests
431.Nm
610cd5c6 432to go to background just before command execution.
433This is useful if
bf740959 434.Nm
435is going to ask for passwords or passphrases, but the user
610cd5c6 436wants it in the background.
f54651ce 437This implies
bf740959 438.Fl n .
439The recommended way to start X11 programs at a remote site is with
440something like
441.Ic ssh -f host xterm .
7b2ea3a1 442.It Fl g
443Allows remote hosts to connect to local forwarded ports.
bf740959 444.It Fl i Ar identity_file
f54651ce 445Selects the file from which the identity (private key) for
fa08c86b 446RSA or DSA authentication is read.
f54651ce 447Default is
1d1ffb87 448.Pa $HOME/.ssh/identity
610cd5c6 449in the user's home directory.
450Identity files may also be specified on
451a per-host basis in the configuration file.
452It is possible to have multiple
bf740959 453.Fl i
454options (and multiple identities specified in
455configuration files).
eea098a3 456.It Fl I Ar smartcard_device
457Specifies which smartcard device to use. The argument is
458the device
459.Nm
460should use to communicate with a smartcard used for storing the user's
461private RSA key.
bf740959 462.It Fl k
4fe2af09 463Disables forwarding of Kerberos tickets and AFS tokens.
464This may also be specified on a per-host basis in the configuration file.
bf740959 465.It Fl l Ar login_name
610cd5c6 466Specifies the user to log in as on the remote machine.
467This also may be specified on a per-host basis in the configuration file.
b2552997 468.It Fl m Ar mac_spec
469Additionally, for protocol version 2 a comma-separated list of MAC
470(message authentication code) algorithms can
471be specified in order of preference.
472See the
473.Cm MACs
474keyword for more information.
bf740959 475.It Fl n
476Redirects stdin from
477.Pa /dev/null
478(actually, prevents reading from stdin).
479This must be used when
480.Nm
610cd5c6 481is run in the background.
482A common trick is to use this to run X11 programs on a remote machine.
483For example,
bf740959 484.Ic ssh -n shadows.cs.hut.fi emacs &
485will start an emacs on shadows.cs.hut.fi, and the X11
486connection will be automatically forwarded over an encrypted channel.
487The
488.Nm
489program will be put in the background.
490(This does not work if
491.Nm
492needs to ask for a password or passphrase; see also the
493.Fl f
494option.)
0e73cc53 495.It Fl N
496Do not execute a remote command.
0b6fbf03 497This is useful if you just want to forward ports
0e73cc53 498(protocol version 2 only).
bf740959 499.It Fl o Ar option
38539909 500Can be used to give options in the format used in the configuration file.
bf740959 501This is useful for specifying options for which there is no separate
610cd5c6 502command-line flag.
bf740959 503.It Fl p Ar port
610cd5c6 504Port to connect to on the remote host.
505This can be specified on a
bf740959 506per-host basis in the configuration file.
507.It Fl P
508Use a non-privileged port for outgoing connections.
509This can be used if your firewall does
510not permit connections from privileged ports.
95f1eccc 511Note that this option turns off
bf740959 512.Cm RhostsAuthentication
513and
6ffc9c88 514.Cm RhostsRSAAuthentication
515for older servers.
bf740959 516.It Fl q
610cd5c6 517Quiet mode.
518Causes all warning and diagnostic messages to be suppressed.
519Only fatal errors are displayed.
ae810de7 520.It Fl s
3730bb22 521May be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the use
522of SSH as a secure transport for other applications (eg. sftp). The
ae810de7 523subsystem is specified as the remote command.
bf740959 524.It Fl t
610cd5c6 525Force pseudo-tty allocation.
4fe2af09 526This can be used to execute arbitrary
610cd5c6 527screen-based programs on a remote machine, which can be very useful,
528e.g., when implementing menu services.
8abcdba4 529Multiple
530.Fl t
531options force tty allocation, even if
532.Nm
533has no local tty.
0e73cc53 534.It Fl T
0b6fbf03 535Disable pseudo-tty allocation.
bf740959 536.It Fl v
610cd5c6 537Verbose mode.
538Causes
bf740959 539.Nm
610cd5c6 540to print debugging messages about its progress.
541This is helpful in
bf740959 542debugging connection, authentication, and configuration problems.
8abcdba4 543Multiple
544.Fl v
545options increases the verbosity.
94ec8c6b 546Maximum is 3.
bf740959 547.It Fl x
610cd5c6 548Disables X11 forwarding.
bf740959 549.It Fl X
550Enables X11 forwarding.
71276795 551This can also be specified on a per-host basis in a configuration file.
bf740959 552.It Fl C
553Requests compression of all data (including stdin, stdout, stderr, and
610cd5c6 554data for forwarded X11 and TCP/IP connections).
555The compression algorithm is the same used by
7b2ea3a1 556.Xr gzip 1 ,
557and the
bf740959 558.Dq level
559can be controlled by the
560.Cm CompressionLevel
610cd5c6 561option (see below).
562Compression is desirable on modem lines and other
bf740959 563slow connections, but will only slow down things on fast networks.
564The default value can be set on a host-by-host basis in the
565configuration files; see the
0aea6c59 566.Cm Compression
bf740959 567option below.
e591b98a 568.It Fl F Ar configfile
569Specifies an alternative per-user configuration file.
570If a configuration file is given on the command line,
571the system-wide configuration file
572.Pq Pa /etc/ssh_config
573will be ignored.
574The default for the per-user configuration file is
575.Pa $HOME/.ssh/config .
bf740959 576.It Fl L Ar port:host:hostport
577Specifies that the given port on the local (client) host is to be
610cd5c6 578forwarded to the given host and port on the remote side.
579This works by allocating a socket to listen to
bf740959 580.Ar port
581on the local side, and whenever a connection is made to this port, the
582connection is forwarded over the secure channel, and a connection is
583made to
48e671d5 584.Ar host
585port
586.Ar hostport
610cd5c6 587from the remote machine.
588Port forwardings can also be specified in the configuration file.
589Only root can forward privileged ports.
48e671d5 590IPv6 addresses can be specified with an alternative syntax:
591.Ar port/host/hostport
bf740959 592.It Fl R Ar port:host:hostport
593Specifies that the given port on the remote (server) host is to be
610cd5c6 594forwarded to the given host and port on the local side.
595This works by allocating a socket to listen to
bf740959 596.Ar port
597on the remote side, and whenever a connection is made to this port, the
598connection is forwarded over the secure channel, and a connection is
599made to
48e671d5 600.Ar host
601port
602.Ar hostport
610cd5c6 603from the local machine.
604Port forwardings can also be specified in the configuration file.
605Privileged ports can be forwarded only when
bf740959 606logging in as root on the remote machine.
da89cf4d 607IPv6 addresses can be specified with an alternative syntax:
608.Ar port/host/hostport
4c780c2a 609.It Fl D Ar port
610Specifies a local
611.Dq dynamic
612application-level port forwarding.
613This works by allocating a socket to listen to
614.Ar port
615on the local side, and whenever a connection is made to this port, the
616connection is forwarded over the secure channel, and the application
617protocol is then used to determine where to connect to from the
618remote machine. Currently the SOCKS4 protocol is supported, and
619.Nm
620will act as a SOCKS4 server.
621Only root can forward privileged ports.
622Dynamic port forwardings can also be specified in the configuration file.
9afadca8 623.It Fl 1
624Forces
625.Nm
626to try protocol version 1 only.
6ae2364d 627.It Fl 2
628Forces
629.Nm
1d1ffb87 630to try protocol version 2 only.
48e671d5 631.It Fl 4
632Forces
633.Nm
634to use IPv4 addresses only.
635.It Fl 6
636Forces
637.Nm
638to use IPv6 addresses only.
bf740959 639.El
640.Sh CONFIGURATION FILES
641.Nm
38539909 642obtains configuration data from the following sources in
643the following order:
bf740959 644command line options, user's configuration file
645.Pq Pa $HOME/.ssh/config ,
646and system-wide configuration file
5f4fdfae 647.Pq Pa /etc/ssh_config .
bf740959 648For each parameter, the first obtained value
610cd5c6 649will be used.
650The configuration files contain sections bracketed by
651.Dq Host
652specifications, and that section is only applied for hosts that
653match one of the patterns given in the specification.
654The matched host name is the one given on the command line.
bf740959 655.Pp
656Since the first obtained value for each parameter is used, more
657host-specific declarations should be given near the beginning of the
658file, and general defaults at the end.
659.Pp
660The configuration file has the following format:
661.Pp
662Empty lines and lines starting with
663.Ql #
664are comments.
665.Pp
666Otherwise a line is of the format
667.Dq keyword arguments .
38539909 668Configuration options may be separated by whitespace or
669optional whitespace and exactly one
670.Ql = ;
671the latter format is useful to avoid the need to quote whitespace
672when specifying configuration options using the
673.Nm ssh ,
674.Nm scp
675and
676.Nm sftp
677.Fl o
678option.
679.Pp
bf740959 680The possible
54bf768d 681keywords and their meanings are as follows (note that
682keywords are case-insensitive and arguments are case-sensitive):
bf740959 683.Bl -tag -width Ds
684.It Cm Host
685Restricts the following declarations (up to the next
686.Cm Host
687keyword) to be only for those hosts that match one of the patterns
688given after the keyword.
689.Ql \&*
690and
691.Ql ?
692can be used as wildcards in the
610cd5c6 693patterns.
694A single
bf740959 695.Ql \&*
696as a pattern can be used to provide global
610cd5c6 697defaults for all hosts.
698The host is the
bf740959 699.Ar hostname
700argument given on the command line (i.e., the name is not converted to
701a canonicalized host name before matching).
702.It Cm AFSTokenPassing
4fe2af09 703Specifies whether to pass AFS tokens to remote host.
704The argument to this keyword must be
bf740959 705.Dq yes
706or
707.Dq no .
da89cf4d 708This option applies to protocol version 1 only.
bf740959 709.It Cm BatchMode
710If set to
711.Dq yes ,
610cd5c6 712passphrase/password querying will be disabled.
713This option is useful in scripts and other batch jobs where you have no
714user to supply the password.
715The argument must be
bf740959 716.Dq yes
717or
718.Dq no .
01ce749f 719The default is
720.Dq no .
3435f5a6 721.It Cm BindAddress
722Specify the interface to transmit from on machines with multiple
723interfaces or aliased addresses.
724Note that this option does not work if
725.Cm UsePrivilegedPort
726is set to
727.Dq yes .
7b2ea3a1 728.It Cm CheckHostIP
729If this flag is set to
730.Dq yes ,
01ce749f 731ssh will additionally check the host IP address in the
7b2ea3a1 732.Pa known_hosts
4fe2af09 733file.
734This allows ssh to detect if a host key changed due to DNS spoofing.
7b2ea3a1 735If the option is set to
736.Dq no ,
737the check will not be executed.
01ce749f 738The default is
739.Dq yes .
bf740959 740.It Cm Cipher
33de75a3 741Specifies the cipher to use for encrypting the session
a22aff1f 742in protocol version 1.
610cd5c6 743Currently,
29999e54 744.Dq blowfish ,
745.Dq 3des ,
bf740959 746and
29999e54 747.Dq des
610cd5c6 748are supported.
29999e54 749.Ar des
750is only supported in the
751.Nm
752client for interoperability with legacy protocol 1 implementations
753that do not support the
754.Ar 3des
755cipher. Its use is strongly discouraged due to cryptographic
756weaknesses.
610cd5c6 757The default is
bf740959 758.Dq 3des .
f54651ce 759.It Cm Ciphers
760Specifies the ciphers allowed for protocol version 2
761in order of preference.
762Multiple ciphers must be comma-separated.
763The default is
9afadca8 764.Pp
765.Bd -literal
f2ba0775 766 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
da89cf4d 767 aes192-cbc,aes256-cbc''
9afadca8 768.Ed
bf740959 769.It Cm Compression
610cd5c6 770Specifies whether to use compression.
771The argument must be
bf740959 772.Dq yes
773or
774.Dq no .
01ce749f 775The default is
776.Dq no .
bf740959 777.It Cm CompressionLevel
01ce749f 778Specifies the compression level to use if compression is enabled.
610cd5c6 779The argument must be an integer from 1 (fast) to 9 (slow, best).
780The default level is 6, which is good for most applications.
781The meaning of the values is the same as in
7b2ea3a1 782.Xr gzip 1 .
da89cf4d 783Note that this option applies to protocol version 1 only.
bf740959 784.It Cm ConnectionAttempts
785Specifies the number of tries (one per second) to make before falling
610cd5c6 786back to rsh or exiting.
787The argument must be an integer.
788This may be useful in scripts if the connection sometimes fails.
ce773142 789The default is 1.
4c780c2a 790.It Cm DynamicForward
791Specifies that a TCP/IP port on the local machine be forwarded
792over the secure channel, and the application
793protocol is then used to determine where to connect to from the
794remote machine. The argument must be a port number.
795Currently the SOCKS4 protocol is supported, and
796.Nm
797will act as a SOCKS4 server.
798Multiple forwardings may be specified, and
799additional forwardings can be given on the command line. Only
800the superuser can forward privileged ports.
bf740959 801.It Cm EscapeChar
802Sets the escape character (default:
803.Ql ~ ) .
804The escape character can also
610cd5c6 805be set on the command line.
806The argument should be a single character,
bf740959 807.Ql ^
808followed by a letter, or
809.Dq none
810to disable the escape
811character entirely (making the connection transparent for binary
812data).
f54651ce 813.It Cm FallBackToRsh
bf740959 814Specifies that if connecting via
815.Nm
816fails due to a connection refused error (there is no
817.Xr sshd 8
f54651ce 818listening on the remote host),
bf740959 819.Xr rsh 1
820should automatically be used instead (after a suitable warning about
610cd5c6 821the session being unencrypted).
822The argument must be
bf740959 823.Dq yes
824or
825.Dq no .
01ce749f 826The default is
827.Dq no .
bf740959 828.It Cm ForwardAgent
829Specifies whether the connection to the authentication agent (if any)
610cd5c6 830will be forwarded to the remote machine.
831The argument must be
bf740959 832.Dq yes
833or
834.Dq no .
71276795 835The default is
836.Dq no .
bf740959 837.It Cm ForwardX11
838Specifies whether X11 connections will be automatically redirected
f54651ce 839over the secure channel and
bf740959 840.Ev DISPLAY
610cd5c6 841set.
f54651ce 842The argument must be
bf740959 843.Dq yes
844or
845.Dq no .
c8d54615 846The default is
847.Dq no .
bf740959 848.It Cm GatewayPorts
849Specifies whether remote hosts are allowed to connect to local
850forwarded ports.
70068acc 851By default,
852.Nm
853binds local port forwardings to the loopback addresss. This
854prevents other remote hosts from connecting to forwarded ports.
855.Cm GatewayPorts
856can be used to specify that
857.Nm
858should bind local port forwardings to the wildcard address,
859thus allowing remote hosts to connect to forwarded ports.
bf740959 860The argument must be
861.Dq yes
862or
863.Dq no .
864The default is
865.Dq no .
866.It Cm GlobalKnownHostsFile
f49bc4f7 867Specifies a file to use for the global
a5df12e9 868host key database instead of
5f4fdfae 869.Pa /etc/ssh_known_hosts .
da89cf4d 870.It Cm HostbasedAuthentication
871Specifies whether to try rhosts based authentication with public key
872authentication.
873The argument must be
874.Dq yes
875or
876.Dq no .
877The default is
3398dda9 878.Dq no .
da89cf4d 879This option applies to protocol version 2 only and
880is similar to
881.Cm RhostsRSAAuthentication .
e961a8f9 882.It Cm HostKeyAlgorithms
98143cfc 883Specifies the protocol version 2 host key algorithms
e961a8f9 884that the client wants to use in order of preference.
885The default for this option is:
886.Dq ssh-rsa,ssh-dss
da89cf4d 887.It Cm HostKeyAlias
888Specifies an alias that should be used instead of the
889real host name when looking up or saving the host key
890in the host key database files.
891This option is useful for tunneling ssh connections
892or if you have multiple servers running on a single host.
bf740959 893.It Cm HostName
610cd5c6 894Specifies the real host name to log into.
895This can be used to specify nicknames or abbreviations for hosts.
896Default is the name given on the command line.
897Numeric IP addresses are also permitted (both on the command line and in
bf740959 898.Cm HostName
899specifications).
900.It Cm IdentityFile
da89cf4d 901Specifies the file from which the user's RSA or DSA authentication identity
bf740959 902is read (default
1d1ffb87 903.Pa $HOME/.ssh/identity
bf740959 904in the user's home directory).
905Additionally, any identities represented by the authentication agent
610cd5c6 906will be used for authentication.
907The file name may use the tilde
908syntax to refer to a user's home directory.
909It is possible to have
bf740959 910multiple identity files specified in configuration files; all these
911identities will be tried in sequence.
912.It Cm KeepAlive
913Specifies whether the system should send keepalive messages to the
610cd5c6 914other side.
915If they are sent, death of the connection or crash of one
916of the machines will be properly noticed.
917However, this means that
bf740959 918connections will die if the route is down temporarily, and some people
4fe2af09 919find it annoying.
bf740959 920.Pp
921The default is
922.Dq yes
923(to send keepalives), and the client will notice
610cd5c6 924if the network goes down or the remote host dies.
925This is important in scripts, and many users want it too.
bf740959 926.Pp
927To disable keepalives, the value should be set to
928.Dq no
929in both the server and the client configuration files.
930.It Cm KerberosAuthentication
4fe2af09 931Specifies whether Kerberos authentication will be used.
932The argument to this keyword must be
bf740959 933.Dq yes
934or
935.Dq no .
936.It Cm KerberosTgtPassing
4fe2af09 937Specifies whether a Kerberos TGT will be forwarded to the server.
938This will only work if the Kerberos server is actually an AFS kaserver.
939The argument to this keyword must be
bf740959 940.Dq yes
941or
942.Dq no .
943.It Cm LocalForward
944Specifies that a TCP/IP port on the local machine be forwarded over
610cd5c6 945the secure channel to given host:port from the remote machine.
946The first argument must be a port number, and the second must be
947host:port.
948Multiple forwardings may be specified, and additional
949forwardings can be given on the command line.
950Only the superuser can forward privileged ports.
6a17f9c2 951.It Cm LogLevel
952Gives the verbosity level that is used when logging messages from
953.Nm ssh .
954The possible values are:
59c97189 955QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
956The default is INFO.
b2552997 957.It Cm MACs
3730bb22 958Specifies the MAC (message authentication code) algorithms
b2552997 959in order of preference.
960The MAC algorithm is used in protocol version 2
961for data integrity protection.
962Multiple algorithms must be comma-separated.
963The default is
47bf6266 964.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
bf740959 965.It Cm NumberOfPasswordPrompts
4fe2af09 966Specifies the number of password prompts before giving up.
967The argument to this keyword must be an integer.
968Default is 3.
7b2ea3a1 969.It Cm PasswordAuthentication
610cd5c6 970Specifies whether to use password authentication.
971The argument to this keyword must be
7b2ea3a1 972.Dq yes
973or
974.Dq no .
01ce749f 975The default is
976.Dq yes .
bf740959 977.It Cm Port
610cd5c6 978Specifies the port number to connect on the remote host.
979Default is 22.
babd91d4 980.It Cm PreferredAuthentications
3730bb22 981Specifies the order in which the client should try protocol 2
982authentication methods. This allows a client to prefer one method (e.g.
babd91d4 983.Cm keyboard-interactive )
984over another method (e.g.
985.Cm password )
986The default for this option is:
29c440a0 987.Dq hostbased,publickey,keyboard-interactive,password
f54651ce 988.It Cm Protocol
989Specifies the protocol versions
990.Nm
991should support in order of preference.
992The possible values are
993.Dq 1
994and
995.Dq 2 .
996Multiple versions must be comma-separated.
997The default is
b4a19d21 998.Dq 2,1 .
1d1ffb87 999This means that
1000.Nm
b4a19d21 1001tries version 2 and falls back to version 1
1002if version 2 is not available.
bf740959 1003.It Cm ProxyCommand
610cd5c6 1004Specifies the command to use to connect to the server.
1005The command
1006string extends to the end of the line, and is executed with
1007.Pa /bin/sh .
1008In the command string,
1009.Ql %h
1010will be substituted by the host name to
1011connect and
1012.Ql %p
1013by the port.
1014The command can be basically anything,
1015and should read from its standard input and write to its standard output.
1016It should eventually connect an
bf740959 1017.Xr sshd 8
1018server running on some machine, or execute
1019.Ic sshd -i
610cd5c6 1020somewhere.
1021Host key management will be done using the
bf740959 1022HostName of the host being connected (defaulting to the name typed by
1023the user).
57112b5a 1024Note that
1025.Cm CheckHostIP
1026is not available for connects with a proxy command.
bf740959 1027.Pp
da89cf4d 1028.It Cm PubkeyAuthentication
1029Specifies whether to try public key authentication.
1030The argument to this keyword must be
1031.Dq yes
1032or
1033.Dq no .
1034The default is
1035.Dq yes .
1036This option applies to protocol version 2 only.
bf740959 1037.It Cm RemoteForward
1038Specifies that a TCP/IP port on the remote machine be forwarded over
610cd5c6 1039the secure channel to given host:port from the local machine.
1040The first argument must be a port number, and the second must be
1041host:port.
1042Multiple forwardings may be specified, and additional
1043forwardings can be given on the command line.
1044Only the superuser can forward privileged ports.
bf740959 1045.It Cm RhostsAuthentication
610cd5c6 1046Specifies whether to try rhosts based authentication.
1047Note that this
bf740959 1048declaration only affects the client side and has no effect whatsoever
610cd5c6 1049on security.
1050Disabling rhosts authentication may reduce
bf740959 1051authentication time on slow connections when rhosts authentication is
610cd5c6 1052not used.
1053Most servers do not permit RhostsAuthentication because it
3730bb22 1054is not secure (see
a5a2da3b 1055.Cm RhostsRSAAuthentication ) .
610cd5c6 1056The argument to this keyword must be
bf740959 1057.Dq yes
1058or
1059.Dq no .
01ce749f 1060The default is
1061.Dq yes .
da89cf4d 1062This option applies to protocol version 1 only.
bf740959 1063.It Cm RhostsRSAAuthentication
1064Specifies whether to try rhosts based authentication with RSA host
610cd5c6 1065authentication.
610cd5c6 1066The argument must be
bf740959 1067.Dq yes
1068or
1069.Dq no .
01ce749f 1070The default is
1071.Dq yes .
da89cf4d 1072This option applies to protocol version 1 only.
bf740959 1073.It Cm RSAAuthentication
610cd5c6 1074Specifies whether to try RSA authentication.
1075The argument to this keyword must be
bf740959 1076.Dq yes
1077or
1078.Dq no .
1079RSA authentication will only be
1080attempted if the identity file exists, or an authentication agent is
1081running.
01ce749f 1082The default is
1083.Dq yes .
1d1ffb87 1084Note that this option applies to protocol version 1 only.
61e96248 1085.It Cm ChallengeResponseAuthentication
1086Specifies whether to use challenge response authentication.
610cd5c6 1087The argument to this keyword must be
5260325f 1088.Dq yes
1089or
1090.Dq no .
1091The default is
10a2cbef 1092.Dq yes .
eea098a3 1093.It Cm SmartcardDevice
1094Specifies which smartcard device to use. The argument to this keyword is
1095the device
1096.Nm
1097should use to communicate with a smartcard used for storing the user's
1098private RSA key. By default, no device is specified and smartcard support
1099is not activated.
bf740959 1100.It Cm StrictHostKeyChecking
1101If this flag is set to
f54651ce 1102.Dq yes ,
bf740959 1103.Nm
a877488a 1104will never automatically add host keys to the
bf740959 1105.Pa $HOME/.ssh/known_hosts
f49bc4f7 1106file, and refuses to connect to hosts whose host key has changed.
610cd5c6 1107This provides maximum protection against trojan horse attacks.
1108However, it can be somewhat annoying if you don't have good
5f4fdfae 1109.Pa /etc/ssh_known_hosts
bf740959 1110files installed and frequently
a877488a 1111connect to new hosts.
1112This option forces the user to manually
1113add all new hosts.
1114If this flag is set to
1115.Dq no ,
1116.Nm
1117will automatically add new host keys to the
1118user known hosts files.
1119If this flag is set to
1120.Dq ask ,
1121new host keys
1122will be added to the user known host files only after the user
1123has confirmed that is what they really want to do, and
1124.Nm
1125will refuse to connect to hosts whose host key has changed.
610cd5c6 1126The host keys of
a877488a 1127known hosts will be verified automatically in all cases.
610cd5c6 1128The argument must be
a877488a 1129.Dq yes ,
1130.Dq no
bf740959 1131or
a877488a 1132.Dq ask .
1133The default is
1134.Dq ask .
bf740959 1135.It Cm UsePrivilegedPort
1136Specifies whether to use a privileged port for outgoing connections.
1137The argument must be
1138.Dq yes
1139or
1140.Dq no .
1141The default is
d5ebca2b 1142.Dq no .
da89cf4d 1143Note that you need to set this option to
1144.Dq yes
1145if you want to use
bf740959 1146.Cm RhostsAuthentication
1147and
6ffc9c88 1148.Cm RhostsRSAAuthentication
da89cf4d 1149with older servers.
7b2ea3a1 1150.It Cm User
610cd5c6 1151Specifies the user to log in as.
1152This can be useful if you have a different user name on different machines.
1153This saves the trouble of
7b2ea3a1 1154having to remember to give the user name on the command line.
1155.It Cm UserKnownHostsFile
f49bc4f7 1156Specifies a file to use for the user
a5df12e9 1157host key database instead of
7b2ea3a1 1158.Pa $HOME/.ssh/known_hosts .
bf740959 1159.It Cm UseRsh
610cd5c6 1160Specifies that rlogin/rsh should be used for this host.
1161It is possible that the host does not at all support the
bf740959 1162.Nm
610cd5c6 1163protocol.
1164This causes
bf740959 1165.Nm
610cd5c6 1166to immediately execute
bf740959 1167.Xr rsh 1 .
1168All other options (except
1169.Cm HostName )
610cd5c6 1170are ignored if this has been specified.
1171The argument must be
bf740959 1172.Dq yes
1173or
1174.Dq no .
fa649821 1175.It Cm XAuthLocation
1176Specifies the location of the
1177.Xr xauth 1
1178program.
1179The default is
1180.Pa /usr/X11R6/bin/xauth .
b5e300c2 1181.El
bf740959 1182.Sh ENVIRONMENT
1183.Nm
1184will normally set the following environment variables:
1185.Bl -tag -width Ds
1186.It Ev DISPLAY
1187The
1188.Ev DISPLAY
610cd5c6 1189variable indicates the location of the X11 server.
f54651ce 1190It is automatically set by
bf740959 1191.Nm
1192to point to a value of the form
1193.Dq hostname:n
1194where hostname indicates
610cd5c6 1195the host where the shell runs, and n is an integer >= 1.
1196.Nm
1197uses this special value to forward X11 connections over the secure
1198channel.
da89cf4d 1199The user should normally not set
1200.Ev DISPLAY
1201explicitly, as that
bf740959 1202will render the X11 connection insecure (and will require the user to
1203manually copy any required authorization cookies).
1204.It Ev HOME
1205Set to the path of the user's home directory.
1206.It Ev LOGNAME
1207Synonym for
1208.Ev USER ;
1209set for compatibility with systems that use this variable.
1210.It Ev MAIL
ae897d7c 1211Set to the path of the user's mailbox.
610cd5c6 1212.It Ev PATH
bf740959 1213Set to the default
1214.Ev PATH ,
1215as specified when compiling
1216.Nm ssh .
3474b2b4 1217.It Ev SSH_ASKPASS
1218If
1219.Nm
1220needs a passphrase, it will read the passphrase from the current
1221terminal if it was run from a terminal.
1222If
1223.Nm
1224does not have a terminal associated with it but
1225.Ev DISPLAY
1226and
1227.Ev SSH_ASKPASS
1228are set, it will execute the program specified by
1229.Ev SSH_ASKPASS
1230and open an X11 window to read the passphrase.
1231This is particularly useful when calling
1232.Nm
1233from a
1234.Pa .Xsession
1235or related script.
1236(Note that on some machines it
1237may be necessary to redirect the input from
1238.Pa /dev/null
1239to make this work.)
bf740959 1240.It Ev SSH_AUTH_SOCK
ae897d7c 1241Identifies the path of a unix-domain socket used to communicate with the
bf740959 1242agent.
1243.It Ev SSH_CLIENT
610cd5c6 1244Identifies the client end of the connection.
1245The variable contains
bf740959 1246three space-separated values: client ip-address, client port number,
1247and server port number.
8abcdba4 1248.It Ev SSH_ORIGINAL_COMMAND
1249The variable contains the original command line if a forced command
1250is executed.
1251It can be used to extract the original arguments.
bf740959 1252.It Ev SSH_TTY
1253This is set to the name of the tty (path to the device) associated
610cd5c6 1254with the current shell or command.
1255If the current session has no tty,
bf740959 1256this variable is not set.
1257.It Ev TZ
1258The timezone variable is set to indicate the present timezone if it
c345cf9d 1259was set when the daemon was started (i.e., the daemon passes the value
bf740959 1260on to new connections).
1261.It Ev USER
1262Set to the name of the user logging in.
1263.El
1264.Pp
f54651ce 1265Additionally,
bf740959 1266.Nm
f54651ce 1267reads
1268.Pa $HOME/.ssh/environment ,
bf740959 1269and adds lines of the format
1270.Dq VARNAME=value
1271to the environment.
1272.Sh FILES
c8d54615 1273.Bl -tag -width Ds
f49bc4f7 1274.It Pa $HOME/.ssh/known_hosts
ae897d7c 1275Records host keys for all hosts the user has logged into that are not
bf740959 1276in
f49bc4f7 1277.Pa /etc/ssh_known_hosts .
bf740959 1278See
1279.Xr sshd 8 .
c0ecc314 1280.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa
1281Contains the authentication identity of the user.
1282They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively.
1d1ffb87 1283These files
1284contain sensitive data and should be readable by the user but not
bf740959 1285accessible by others (read/write/execute).
1286Note that
1287.Nm
1d1ffb87 1288ignores a private key file if it is accessible by others.
bf740959 1289It is possible to specify a passphrase when
1290generating the key; the passphrase will be used to encrypt the
1291sensitive part of this file using 3DES.
c0ecc314 1292.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub
bf740959 1293Contains the public key for authentication (public part of the
610cd5c6 1294identity file in human-readable form).
1d1ffb87 1295The contents of the
1296.Pa $HOME/.ssh/identity.pub
1297file should be added to
bf740959 1298.Pa $HOME/.ssh/authorized_keys
1299on all machines
c0ecc314 1300where you wish to log in using protocol version 1 RSA authentication.
1d1ffb87 1301The contents of the
1302.Pa $HOME/.ssh/id_dsa.pub
c0ecc314 1303and
1304.Pa $HOME/.ssh/id_rsa.pub
1d1ffb87 1305file should be added to
96a7b0cc 1306.Pa $HOME/.ssh/authorized_keys
1d1ffb87 1307on all machines
c0ecc314 1308where you wish to log in using protocol version 2 DSA/RSA authentication.
1d1ffb87 1309These files are not
610cd5c6 1310sensitive and can (but need not) be readable by anyone.
1d1ffb87 1311These files are
c44559d2 1312never used automatically and are not necessary; they are only provided for
bf740959 1313the convenience of the user.
1314.It Pa $HOME/.ssh/config
610cd5c6 1315This is the per-user configuration file.
1316The format of this file is described above.
1317This file is used by the
bf740959 1318.Nm
610cd5c6 1319client.
1320This file does not usually contain any sensitive information,
bf740959 1321but the recommended permissions are read/write for the user, and not
1322accessible by others.
1323.It Pa $HOME/.ssh/authorized_keys
96a7b0cc 1324Lists the public keys (RSA/DSA) that can be used for logging in as this user.
610cd5c6 1325The format of this file is described in the
bf740959 1326.Xr sshd 8
610cd5c6 1327manual page.
f49bc4f7 1328In the simplest form the format is the same as the .pub
1329identity files.
1d1ffb87 1330This file is not highly sensitive, but the recommended
1331permissions are read/write for the user, and not accessible by others.
f49bc4f7 1332.It Pa /etc/ssh_known_hosts
610cd5c6 1333Systemwide list of known host keys.
f49bc4f7 1334This file should be prepared by the
bf740959 1335system administrator to contain the public host keys of all machines in the
610cd5c6 1336organization.
1337This file should be world-readable.
1338This file contains
bf740959 1339public keys, one per line, in the following format (fields separated
f49bc4f7 1340by spaces): system name, public key and optional comment field.
610cd5c6 1341When different names are used
bf740959 1342for the same machine, all such names should be listed, separated by
610cd5c6 1343commas.
1344The format is described on the
bf740959 1345.Xr sshd 8
1346manual page.
1347.Pp
1348The canonical system name (as returned by name servers) is used by
1349.Xr sshd 8
1350to verify the client host when logging in; other names are needed because
1351.Nm
1352does not convert the user-supplied name to a canonical name before
1353checking the key, because someone with access to the name servers
1354would then be able to fool host authentication.
5f4fdfae 1355.It Pa /etc/ssh_config
610cd5c6 1356Systemwide configuration file.
1357This file provides defaults for those
bf740959 1358values that are not specified in the user's configuration file, and
610cd5c6 1359for those users who do not have a configuration file.
1360This file must be world-readable.
bf740959 1361.It Pa $HOME/.rhosts
1362This file is used in
1363.Pa \&.rhosts
1364authentication to list the
610cd5c6 1365host/user pairs that are permitted to log in.
1366(Note that this file is
bf740959 1367also used by rlogin and rsh, which makes using this file insecure.)
1368Each line of the file contains a host name (in the canonical form
1369returned by name servers), and then a user name on that host,
610cd5c6 1370separated by a space.
e91c60f2 1371On some machines this file may need to be
bf740959 1372world-readable if the user's home directory is on a NFS partition,
1373because
1374.Xr sshd 8
610cd5c6 1375reads it as root.
1376Additionally, this file must be owned by the user,
1377and must not have write permissions for anyone else.
1378The recommended
bf740959 1379permission for most machines is read/write for the user, and not
1380accessible by others.
1381.Pp
1382Note that by default
1383.Xr sshd 8
1384will be installed so that it requires successful RSA host
610cd5c6 1385authentication before permitting \s+2.\s0rhosts authentication.
1386If your server machine does not have the client's host key in
5f4fdfae 1387.Pa /etc/ssh_known_hosts ,
bf740959 1388you can store it in
1389.Pa $HOME/.ssh/known_hosts .
1390The easiest way to do this is to
1391connect back to the client from the server machine using ssh; this
1d1ffb87 1392will automatically add the host key to
bf740959 1393.Pa $HOME/.ssh/known_hosts .
1394.It Pa $HOME/.shosts
1395This file is used exactly the same way as
1396.Pa \&.rhosts .
1397The purpose for
1398having this file is to be able to use rhosts authentication with
1399.Nm
1400without permitting login with
1401.Xr rlogin 1
1402or
1403.Xr rsh 1 .
1404.It Pa /etc/hosts.equiv
1405This file is used during
610cd5c6 1406.Pa \&.rhosts authentication.
1407It contains
bf740959 1408canonical hosts names, one per line (the full format is described on
1409the
1410.Xr sshd 8
610cd5c6 1411manual page).
1412If the client host is found in this file, login is
bf740959 1413automatically permitted provided client and server user names are the
610cd5c6 1414same.
1415Additionally, successful RSA host authentication is normally
1416required.
1417This file should only be writable by root.
5f4fdfae 1418.It Pa /etc/shosts.equiv
f54651ce 1419This file is processed exactly as
bf740959 1420.Pa /etc/hosts.equiv .
1421This file may be useful to permit logins using
1422.Nm
1423but not using rsh/rlogin.
5f4fdfae 1424.It Pa /etc/sshrc
bf740959 1425Commands in this file are executed by
1426.Nm
1427when the user logs in just before the user's shell (or command) is started.
1428See the
1429.Xr sshd 8
1430manual page for more information.
1431.It Pa $HOME/.ssh/rc
1432Commands in this file are executed by
1433.Nm
1434when the user logs in just before the user's shell (or command) is
1435started.
f54651ce 1436See the
bf740959 1437.Xr sshd 8
1438manual page for more information.
83b7f649 1439.It Pa $HOME/.ssh/environment
1440Contains additional definitions for environment variables, see section
1441.Sx ENVIRONMENT
1442above.
b5e300c2 1443.El
fa08c86b 1444.Sh AUTHORS
5fb622e4 1445OpenSSH is a derivative of the original and free
1446ssh 1.2.12 release by Tatu Ylonen.
1447Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1448Theo de Raadt and Dug Song
1449removed many bugs, re-added newer features and
1450created OpenSSH.
1451Markus Friedl contributed the support for SSH
1452protocol versions 1.5 and 2.0.
bf740959 1453.Sh SEE ALSO
1454.Xr rlogin 1 ,
1455.Xr rsh 1 ,
1456.Xr scp 1 ,
61e96248 1457.Xr sftp 1 ,
bf740959 1458.Xr ssh-add 1 ,
1459.Xr ssh-agent 1 ,
1460.Xr ssh-keygen 1 ,
1461.Xr telnet 1 ,
9afadca8 1462.Xr sshd 8
2cad6cef 1463.Rs
1464.%A T. Ylonen
1465.%A T. Kivinen
1466.%A M. Saarinen
1467.%A T. Rinne
1468.%A S. Lehtinen
1469.%T "SSH Protocol Architecture"
1930af48 1470.%N draft-ietf-secsh-architecture-09.txt
1471.%D July 2001
2cad6cef 1472.%O work in progress material
1473.Re
This page took 0.385765 seconds and 5 git commands to generate.