]> andersk Git - openssh.git/blame - ssh.1
- (tim) [regress/try-ciphers.sh] "if ! some_command" is not portable.
[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.\"
4598add7 37.\" $OpenBSD: ssh.1,v 1.192 2004/06/18 10:55:43 markus 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
0e19494c 46.Op Fl 1246AaCfgkMNnqsTtVvXxY
3435f5a6 47.Op Fl b Ar bind_address
d0c832f3 48.Op Fl c Ar cipher_spec
5f4a0c58 49.Op Fl D Ar port
bf740959 50.Op Fl e Ar escape_char
e591b98a 51.Op Fl F Ar configfile
5f4a0c58 52.Op Fl i Ar identity_file
53.Bk -words
bf740959 54.Oo Fl L Xo
55.Sm off
bf740959 56.Ar port :
7b2ea3a1 57.Ar host :
bf740959 58.Ar hostport
59.Sm on
60.Xc
61.Oc
a4e5acef 62.Ek
5f4a0c58 63.Op Fl l Ar login_name
64.Op Fl m Ar mac_spec
65.Op Fl o Ar option
a4e5acef 66.Bk -words
5f4a0c58 67.Op Fl p Ar port
68.Ek
bf740959 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
4598add7 77.Op Fl S Ar ctl
5f4a0c58 78.Oo Ar user Ns @ Oc Ns Ar hostname
bf740959 79.Op Ar command
f54651ce 80.Sh DESCRIPTION
bf740959 81.Nm
2c86906e 82(SSH client) is a program for logging into a remote machine and for
610cd5c6 83executing commands on a remote machine.
5f4a0c58 84It is intended to replace rlogin and rsh,
85and provide secure encrypted communications between
610cd5c6 86two untrusted hosts over an insecure network.
5f4a0c58 87X11 connections and arbitrary TCP/IP ports
88can also be forwarded over the secure channel.
bf740959 89.Pp
90.Nm
f54651ce 91connects and logs into the specified
5f4a0c58 92.Ar hostname
93(with optional
94.Ar user
95name).
bf740959 96The user must prove
1d1ffb87 97his/her identity to the remote machine using one of several methods
5f4a0c58 98depending on the protocol version used.
1d1ffb87 99.Pp
5f4a0c58 100If
101.Ar command
102is specified,
103.Ar command
104is executed on the remote host instead of a login shell.
1d1ffb87 105.Ss SSH protocol version 1
bf740959 106First, if the machine the user logs in from is listed in
107.Pa /etc/hosts.equiv
108or
5f4fdfae 109.Pa /etc/shosts.equiv
bf740959 110on the remote machine, and the user names are
111the same on both sides, the user is immediately permitted to log in.
f54651ce 112Second, if
5f4a0c58 113.Pa .rhosts
bf740959 114or
5f4a0c58 115.Pa .shosts
bf740959 116exists in the user's home directory on the
117remote machine and contains a line containing the name of the client
118machine and the name of the user on that machine, the user is
610cd5c6 119permitted to log in.
120This form of authentication alone is normally not
bf740959 121allowed by the server because it is not secure.
122.Pp
da89cf4d 123The second authentication method is the
5f4a0c58 124.Em rhosts
bf740959 125or
5f4a0c58 126.Em hosts.equiv
610cd5c6 127method combined with RSA-based host authentication.
128It means that if the login would be permitted by
1d1ffb87 129.Pa $HOME/.rhosts ,
130.Pa $HOME/.shosts ,
bf740959 131.Pa /etc/hosts.equiv ,
132or
5f4fdfae 133.Pa /etc/shosts.equiv ,
bf740959 134and if additionally the server can verify the client's
f54651ce 135host key (see
2a8a6488 136.Pa /etc/ssh/ssh_known_hosts
5bbb5681 137and
138.Pa $HOME/.ssh/known_hosts
bf740959 139in the
140.Sx FILES
5f4a0c58 141section), only then is login permitted.
610cd5c6 142This authentication method closes security holes due to IP
143spoofing, DNS spoofing and routing spoofing.
144[Note to the administrator:
bf740959 145.Pa /etc/hosts.equiv ,
1d1ffb87 146.Pa $HOME/.rhosts ,
bf740959 147and the rlogin/rsh protocol in general, are inherently insecure and should be
148disabled if security is desired.]
149.Pp
f54651ce 150As a third authentication method,
bf740959 151.Nm
152supports RSA based authentication.
153The scheme is based on public-key cryptography: there are cryptosystems
154where encryption and decryption are done using separate keys, and it
155is not possible to derive the decryption key from the encryption key.
610cd5c6 156RSA is one such system.
f54651ce 157The idea is that each user creates a public/private
610cd5c6 158key pair for authentication purposes.
159The server knows the public key, and only the user knows the private key.
5f4a0c58 160.Pp
f54651ce 161The file
bf740959 162.Pa $HOME/.ssh/authorized_keys
5f4a0c58 163lists the public keys that are permitted for logging in.
610cd5c6 164When the user logs in, the
bf740959 165.Nm
166program tells the server which key pair it would like to use for
610cd5c6 167authentication.
5f4a0c58 168The server checks if this key is permitted, and if so,
169sends the user (actually the
bf740959 170.Nm
171program running on behalf of the user) a challenge, a random number,
610cd5c6 172encrypted by the user's public key.
5f4a0c58 173The challenge can only be decrypted using the proper private key.
174The user's client then decrypts the challenge using the private key,
175proving that he/she knows the private key
176but without disclosing it to the server.
bf740959 177.Pp
178.Nm
610cd5c6 179implements the RSA authentication protocol automatically.
180The user creates his/her RSA key pair by running
bf740959 181.Xr ssh-keygen 1 .
f54651ce 182This stores the private key in
1d1ffb87 183.Pa $HOME/.ssh/identity
5f4a0c58 184and stores the public key in
1d1ffb87 185.Pa $HOME/.ssh/identity.pub
610cd5c6 186in the user's home directory.
187The user should then copy the
bf740959 188.Pa identity.pub
f54651ce 189to
1d1ffb87 190.Pa $HOME/.ssh/authorized_keys
f54651ce 191in his/her home directory on the remote machine (the
bf740959 192.Pa authorized_keys
f54651ce 193file corresponds to the conventional
1d1ffb87 194.Pa $HOME/.rhosts
bf740959 195file, and has one key
610cd5c6 196per line, though the lines can be very long).
197After this, the user can log in without giving the password.
5f4a0c58 198RSA authentication is much more secure than
199.Em rhosts
200authentication.
bf740959 201.Pp
202The most convenient way to use RSA authentication may be with an
610cd5c6 203authentication agent.
204See
bf740959 205.Xr ssh-agent 1
206for more information.
207.Pp
f54651ce 208If other authentication methods fail,
bf740959 209.Nm
610cd5c6 210prompts the user for a password.
211The password is sent to the remote
bf740959 212host for checking; however, since all communications are encrypted,
213the password cannot be seen by someone listening on the network.
1d1ffb87 214.Ss SSH protocol version 2
5f4a0c58 215When a user connects using protocol version 2,
16210ef7 216similar authentication methods are available.
da89cf4d 217Using the default values for
218.Cm PreferredAuthentications ,
29c440a0 219the client will try to authenticate first using the hostbased method;
5f4a0c58 220if this method fails, public key authentication is attempted,
221and finally if this method fails, keyboard-interactive and
29c440a0 222password authentication are tried.
1d1ffb87 223.Pp
224The public key method is similar to RSA authentication described
da89cf4d 225in the previous section and allows the RSA or DSA algorithm to be used:
c0ecc314 226The client uses his private key,
1d1ffb87 227.Pa $HOME/.ssh/id_dsa
c0ecc314 228or
229.Pa $HOME/.ssh/id_rsa ,
1d1ffb87 230to sign the session identifier and sends the result to the server.
231The server checks whether the matching public key is listed in
96a7b0cc 232.Pa $HOME/.ssh/authorized_keys
1d1ffb87 233and grants access if both the key is found and the signature is correct.
234The session identifier is derived from a shared Diffie-Hellman value
235and is only known to the client and the server.
236.Pp
5f4a0c58 237If public key authentication fails or is not available, a password
238can be sent encrypted to the remote host to prove the user's identity.
da89cf4d 239.Pp
240Additionally,
241.Nm
242supports hostbased or challenge response authentication.
1d1ffb87 243.Pp
244Protocol 2 provides additional mechanisms for confidentiality
3b9baa7b 245(the traffic is encrypted using AES, 3DES, Blowfish, CAST128 or Arcfour)
246and integrity (hmac-md5, hmac-sha1, hmac-ripemd160).
1d1ffb87 247Note that protocol 1 lacks a strong mechanism for ensuring the
248integrity of the connection.
1d1ffb87 249.Ss Login session and remote execution
bf740959 250When the user's identity has been accepted by the server, the server
251either executes the given command, or logs into the machine and gives
610cd5c6 252the user a normal shell on the remote machine.
253All communication with
bf740959 254the remote command or shell will be automatically encrypted.
255.Pp
256If a pseudo-terminal has been allocated (normal login session), the
df841692 257user may use the escape characters noted below.
bf740959 258.Pp
5f4a0c58 259If no pseudo-tty has been allocated,
260the session is transparent and can be used to reliably transfer binary data.
610cd5c6 261On most systems, setting the escape character to
bf740959 262.Dq none
263will also make the session transparent even if a tty is used.
264.Pp
ce9c0b75 265The session terminates when the command or shell on the remote
e91c60f2 266machine exits and all X11 and TCP/IP connections have been closed.
5f4a0c58 267The exit status of the remote program is returned as the exit status of
bf740959 268.Nm ssh .
df841692 269.Ss Escape Characters
5f4a0c58 270When a pseudo-terminal has been requested,
271.Nm
272supports a number of functions through the use of an escape character.
df841692 273.Pp
274A single tilde character can be sent as
275.Ic ~~
5bef3c35 276or by following the tilde by a character other than those described below.
df841692 277The escape character must always follow a newline to be interpreted as
278special.
279The escape character can be changed in configuration files using the
280.Cm EscapeChar
3730bb22 281configuration directive or on the command line by the
df841692 282.Fl e
283option.
284.Pp
285The supported escapes (assuming the default
286.Ql ~ )
287are:
288.Bl -tag -width Ds
289.It Cm ~.
5f4a0c58 290Disconnect.
df841692 291.It Cm ~^Z
5f4a0c58 292Background
293.Nm ssh .
df841692 294.It Cm ~#
5f4a0c58 295List forwarded connections.
df841692 296.It Cm ~&
5f4a0c58 297Background
298.Nm
299at logout when waiting for forwarded connection / X11 sessions to terminate.
df841692 300.It Cm ~?
5f4a0c58 301Display a list of escape characters.
16a79097 302.It Cm ~B
5f4a0c58 303Send a BREAK to the remote system
304(only useful for SSH protocol version 2 and if the peer supports it).
c53c54c2 305.It Cm ~C
d740ec16 306Open command line.
307Currently this allows the addition of port forwardings using the
c53c54c2 308.Fl L
309and
310.Fl R
d740ec16 311options (see below).
790029d9 312It also allows the cancellation of existing remote port-forwardings
d740ec16 313using
314.Fl KR Ar hostport .
7069a5e2 315Basic help is available, using the
316.Fl h
d740ec16 317option.
df841692 318.It Cm ~R
5f4a0c58 319Request rekeying of the connection
320(only useful for SSH protocol version 2 and if the peer supports it).
df841692 321.El
1d1ffb87 322.Ss X11 and TCP forwarding
6efa3d14 323If the
324.Cm ForwardX11
325variable is set to
326.Dq yes
5f4a0c58 327(or see the description of the
6efa3d14 328.Fl X
329and
330.Fl x
331options described later)
332and the user is using X11 (the
bf740959 333.Ev DISPLAY
334environment variable is set), the connection to the X11 display is
335automatically forwarded to the remote side in such a way that any X11
336programs started from the shell (or command) will go through the
337encrypted channel, and the connection to the real X server will be made
610cd5c6 338from the local machine.
339The user should not manually set
bf740959 340.Ev DISPLAY .
341Forwarding of X11 connections can be
342configured on the command line or in configuration files.
343.Pp
344The
f54651ce 345.Ev DISPLAY
bf740959 346value set by
347.Nm
5f4a0c58 348will point to the server machine, but with a display number greater than zero.
610cd5c6 349This is normal, and happens because
bf740959 350.Nm
351creates a
352.Dq proxy
353X server on the server machine for forwarding the
354connections over the encrypted channel.
355.Pp
356.Nm
357will also automatically set up Xauthority data on the server machine.
358For this purpose, it will generate a random authorization cookie,
359store it in Xauthority on the server, and verify that any forwarded
360connections carry this cookie and replace it by the real cookie when
610cd5c6 361the connection is opened.
362The real authentication cookie is never
bf740959 363sent to the server machine (and no cookies are sent in the plain).
364.Pp
24794905 365If the
366.Cm ForwardAgent
367variable is set to
368.Dq yes
5f4a0c58 369(or see the description of the
24794905 370.Fl A
371and
372.Fl a
a4e5acef 373options described later) and
24794905 374the user is using an authentication agent, the connection to the agent
375is automatically forwarded to the remote side.
bf740959 376.Pp
377Forwarding of arbitrary TCP/IP connections over the secure channel can
491f5f7b 378be specified either on the command line or in a configuration file.
610cd5c6 379One possible application of TCP/IP forwarding is a secure connection to an
e91c60f2 380electronic purse; another is going through firewalls.
1d1ffb87 381.Ss Server authentication
bf740959 382.Nm
1d1ffb87 383automatically maintains and checks a database containing
610cd5c6 384identifications for all hosts it has ever been used with.
f49bc4f7 385Host keys are stored in
1d1ffb87 386.Pa $HOME/.ssh/known_hosts
610cd5c6 387in the user's home directory.
f49bc4f7 388Additionally, the file
2a8a6488 389.Pa /etc/ssh/ssh_known_hosts
f49bc4f7 390is automatically checked for known hosts.
610cd5c6 391Any new hosts are automatically added to the user's file.
5f4a0c58 392If a host's identification ever changes,
bf740959 393.Nm
394warns about this and disables password authentication to prevent a
610cd5c6 395trojan horse from getting the user's password.
5f4a0c58 396Another purpose of this mechanism is to prevent man-in-the-middle attacks
397which could otherwise be used to circumvent the encryption.
610cd5c6 398The
bf740959 399.Cm StrictHostKeyChecking
588df31a 400option can be used to prevent logins to machines whose
bf740959 401host key is not known or has changed.
fa08c86b 402.Pp
403The options are as follows:
bf740959 404.Bl -tag -width Ds
5f4a0c58 405.It Fl 1
406Forces
407.Nm
408to try protocol version 1 only.
409.It Fl 2
410Forces
411.Nm
412to try protocol version 2 only.
413.It Fl 4
414Forces
415.Nm
416to use IPv4 addresses only.
417.It Fl 6
418Forces
419.Nm
420to use IPv6 addresses only.
71276795 421.It Fl A
422Enables forwarding of the authentication agent connection.
423This can also be specified on a per-host basis in a configuration file.
07d688d5 424.Pp
a4e5acef 425Agent forwarding should be enabled with caution.
426Users with the ability to bypass file permissions on the remote host
427(for the agent's Unix-domain socket)
428can access the local agent through the forwarded connection.
429An attacker cannot obtain key material from the agent,
07d688d5 430however they can perform operations on the keys that enable them to
431authenticate using the identities loaded into the agent.
5f4a0c58 432.It Fl a
433Disables forwarding of the authentication agent connection.
3435f5a6 434.It Fl b Ar bind_address
435Specify the interface to transmit from on machines with multiple
436interfaces or aliased addresses.
5f4a0c58 437.It Fl C
438Requests compression of all data (including stdin, stdout, stderr, and
439data for forwarded X11 and TCP/IP connections).
440The compression algorithm is the same used by
441.Xr gzip 1 ,
442and the
443.Dq level
444can be controlled by the
445.Cm CompressionLevel
446option for protocol version 1.
447Compression is desirable on modem lines and other
448slow connections, but will only slow down things on fast networks.
449The default value can be set on a host-by-host basis in the
450configuration files; see the
451.Cm Compression
452option.
3b9baa7b 453.It Fl c Ar cipher_spec
454Selects the cipher specification for encrypting the session.
455.Pp
456Protocol version 1 allows specification of a single cipher.
457The suported values are
458.Dq 3des ,
459.Dq blowfish
460and
461.Dq des .
bf740959 462.Ar 3des
463(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
3b9baa7b 464It is believed to be secure.
bf740959 465.Ar blowfish
5f4a0c58 466is a fast block cipher; it appears very secure and is much faster than
610cd5c6 467.Ar 3des .
29999e54 468.Ar des
469is only supported in the
470.Nm
471client for interoperability with legacy protocol 1 implementations
472that do not support the
473.Ar 3des
a4e5acef 474cipher.
475Its use is strongly discouraged due to cryptographic weaknesses.
3b9baa7b 476The default is
477.Dq 3des .
478.Pp
479For protocol version 2
480.Ar cipher_spec
481is a comma-separated list of ciphers
482listed in order of preference.
483The supported ciphers are
484.Dq 3des-cbc ,
485.Dq aes128-cbc ,
486.Dq aes192-cbc ,
487.Dq aes256-cbc ,
488.Dq aes128-ctr ,
489.Dq aes192-ctr ,
490.Dq aes256-ctr ,
491.Dq arcfour ,
492.Dq blowfish-cbc ,
493and
494.Dq cast128-cbc .
495The default is
496.Bd -literal
497 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
498 aes192-cbc,aes256-cbc''
499.Ed
5f4a0c58 500.It Fl D Ar port
501Specifies a local
502.Dq dynamic
503application-level port forwarding.
504This works by allocating a socket to listen to
505.Ar port
506on the local side, and whenever a connection is made to this port, the
507connection is forwarded over the secure channel, and the application
508protocol is then used to determine where to connect to from the
509remote machine.
510Currently the SOCKS4 and SOCKS5 protocols are supported, and
511.Nm
512will act as a SOCKS server.
513Only root can forward privileged ports.
514Dynamic port forwardings can also be specified in the configuration file.
515.It Fl e Ar ch | ^ch | none
bf740959 516Sets the escape character for sessions with a pty (default:
517.Ql ~ ) .
610cd5c6 518The escape character is only recognized at the beginning of a line.
519The escape character followed by a dot
bf740959 520.Pq Ql \&.
5f4a0c58 521closes the connection;
522followed by control-Z suspends the connection;
523and followed by itself sends the escape character once.
610cd5c6 524Setting the character to
bf740959 525.Dq none
526disables any escapes and makes the session fully transparent.
5f4a0c58 527.It Fl F Ar configfile
528Specifies an alternative per-user configuration file.
529If a configuration file is given on the command line,
530the system-wide configuration file
531.Pq Pa /etc/ssh/ssh_config
532will be ignored.
533The default for the per-user configuration file is
534.Pa $HOME/.ssh/config .
bf740959 535.It Fl f
536Requests
537.Nm
610cd5c6 538to go to background just before command execution.
539This is useful if
bf740959 540.Nm
541is going to ask for passwords or passphrases, but the user
610cd5c6 542wants it in the background.
f54651ce 543This implies
bf740959 544.Fl n .
545The recommended way to start X11 programs at a remote site is with
546something like
547.Ic ssh -f host xterm .
7b2ea3a1 548.It Fl g
549Allows remote hosts to connect to local forwarded ports.
5f4a0c58 550.It Fl I Ar smartcard_device
551Specifies which smartcard device to use.
552The argument is the device
553.Nm
554should use to communicate with a smartcard used for storing the user's
555private RSA key.
bf740959 556.It Fl i Ar identity_file
cf5a07a8 557Selects a file from which the identity (private key) for
fa08c86b 558RSA or DSA authentication is read.
cf5a07a8 559The default is
1d1ffb87 560.Pa $HOME/.ssh/identity
cf5a07a8 561for protocol version 1, and
562.Pa $HOME/.ssh/id_rsa
563and
564.Pa $HOME/.ssh/id_dsa
565for protocol version 2.
610cd5c6 566Identity files may also be specified on
567a per-host basis in the configuration file.
568It is possible to have multiple
bf740959 569.Fl i
570options (and multiple identities specified in
571configuration files).
bf740959 572.It Fl k
f7926e97 573Disables forwarding (delegation) of GSSAPI credentials to the server.
5f4a0c58 574.It Fl L Xo
575.Sm off
576.Ar port : host : hostport
577.Sm on
578.Xc
579Specifies that the given port on the local (client) host is to be
580forwarded to the given host and port on the remote side.
581This works by allocating a socket to listen to
582.Ar port
583on the local side, and whenever a connection is made to this port, the
584connection is forwarded over the secure channel, and a connection is
585made to
586.Ar host
587port
588.Ar hostport
589from the remote machine.
590Port forwardings can also be specified in the configuration file.
591Only root can forward privileged ports.
592IPv6 addresses can be specified with an alternative syntax:
593.Sm off
594.Xo
595.Ar port No / Ar host No /
596.Ar hostport .
597.Xc
598.Sm on
bf740959 599.It Fl l Ar login_name
610cd5c6 600Specifies the user to log in as on the remote machine.
601This also may be specified on a per-host basis in the configuration file.
b2552997 602.It Fl m Ar mac_spec
603Additionally, for protocol version 2 a comma-separated list of MAC
604(message authentication code) algorithms can
605be specified in order of preference.
606See the
607.Cm MACs
608keyword for more information.
5e96b616 609.It Fl M
610Places the
611.Nm
612client into
613.Dq master
614mode for connection sharing.
615Refer to the description of
616.Cm ControlMaster
617in
618.Xr ssh_config 5
619for details.
5f4a0c58 620.It Fl N
621Do not execute a remote command.
622This is useful for just forwarding ports
623(protocol version 2 only).
bf740959 624.It Fl n
625Redirects stdin from
626.Pa /dev/null
627(actually, prevents reading from stdin).
628This must be used when
629.Nm
610cd5c6 630is run in the background.
631A common trick is to use this to run X11 programs on a remote machine.
632For example,
bf740959 633.Ic ssh -n shadows.cs.hut.fi emacs &
634will start an emacs on shadows.cs.hut.fi, and the X11
635connection will be automatically forwarded over an encrypted channel.
636The
637.Nm
638program will be put in the background.
639(This does not work if
640.Nm
641needs to ask for a password or passphrase; see also the
642.Fl f
643option.)
644.It Fl o Ar option
38539909 645Can be used to give options in the format used in the configuration file.
bf740959 646This is useful for specifying options for which there is no separate
610cd5c6 647command-line flag.
5f4a0c58 648For full details of the options listed below, and their possible values, see
649.Xr ssh_config 5 .
650.Pp
651.Bl -tag -width Ds -offset indent -compact
652.It AddressFamily
653.It BatchMode
654.It BindAddress
655.It ChallengeResponseAuthentication
656.It CheckHostIP
657.It Cipher
658.It Ciphers
659.It ClearAllForwardings
660.It Compression
661.It CompressionLevel
662.It ConnectionAttempts
20b267fb 663.It ConnectTimeout
5e96b616 664.It ControlMaster
665.It ControlPath
5f4a0c58 666.It DynamicForward
5f4a0c58 667.It EscapeChar
668.It ForwardAgent
669.It ForwardX11
d73a67d7 670.It ForwardX11Trusted
5f4a0c58 671.It GatewayPorts
672.It GlobalKnownHostsFile
673.It GSSAPIAuthentication
674.It GSSAPIDelegateCredentials
675.It Host
676.It HostbasedAuthentication
677.It HostKeyAlgorithms
678.It HostKeyAlias
679.It HostName
680.It IdentityFile
3a065ed0 681.It IdentitiesOnly
5f4a0c58 682.It LocalForward
683.It LogLevel
684.It MACs
685.It NoHostAuthenticationForLocalhost
686.It NumberOfPasswordPrompts
687.It PasswordAuthentication
688.It Port
689.It PreferredAuthentications
690.It Protocol
691.It ProxyCommand
692.It PubkeyAuthentication
693.It RemoteForward
694.It RhostsRSAAuthentication
695.It RSAAuthentication
8e99a198 696.It SendEnv
5d8d32a3 697.It ServerAliveInterval
698.It ServerAliveCountMax
5f4a0c58 699.It SmartcardDevice
700.It StrictHostKeyChecking
fd573618 701.It TCPKeepAlive
5f4a0c58 702.It UsePrivilegedPort
703.It User
704.It UserKnownHostsFile
705.It VerifyHostKeyDNS
706.It XAuthLocation
707.El
bf740959 708.It Fl p Ar port
610cd5c6 709Port to connect to on the remote host.
710This can be specified on a
bf740959 711per-host basis in the configuration file.
bf740959 712.It Fl q
610cd5c6 713Quiet mode.
714Causes all warning and diagnostic messages to be suppressed.
5f4a0c58 715.It Fl R Xo
716.Sm off
717.Ar port : host : hostport
718.Sm on
719.Xc
720Specifies that the given port on the remote (server) host is to be
721forwarded to the given host and port on the local side.
722This works by allocating a socket to listen to
723.Ar port
724on the remote side, and whenever a connection is made to this port, the
725connection is forwarded over the secure channel, and a connection is
726made to
727.Ar host
728port
729.Ar hostport
730from the local machine.
731Port forwardings can also be specified in the configuration file.
732Privileged ports can be forwarded only when
733logging in as root on the remote machine.
734IPv6 addresses can be specified with an alternative syntax:
735.Sm off
736.Xo
737.Ar port No / Ar host No /
738.Ar hostport .
739.Xc
740.Sm on
4598add7 741.It Fl S Ar ctl
0e19494c 742Specifies the location of a control socket for for connection sharing.
5e96b616 743Refer to the description of
0e19494c 744.Cm ControlPath
745and
5e96b616 746.Cm ControlMaster
747in
748.Xr ssh_config 5
749for details.
ae810de7 750.It Fl s
3cbc677d 751May be used to request invocation of a subsystem on the remote system.
752Subsystems are a feature of the SSH2 protocol which facilitate the use
5f4a0c58 753of SSH as a secure transport for other applications (eg.\&
754.Xr sftp 1 ) .
3cbc677d 755The subsystem is specified as the remote command.
5f4a0c58 756.It Fl T
757Disable pseudo-tty allocation.
bf740959 758.It Fl t
610cd5c6 759Force pseudo-tty allocation.
4fe2af09 760This can be used to execute arbitrary
610cd5c6 761screen-based programs on a remote machine, which can be very useful,
762e.g., when implementing menu services.
8abcdba4 763Multiple
764.Fl t
765options force tty allocation, even if
766.Nm
767has no local tty.
5f4a0c58 768.It Fl V
769Display the version number and exit.
bf740959 770.It Fl v
610cd5c6 771Verbose mode.
772Causes
bf740959 773.Nm
610cd5c6 774to print debugging messages about its progress.
775This is helpful in
bf740959 776debugging connection, authentication, and configuration problems.
8abcdba4 777Multiple
778.Fl v
c825cd79 779options increase the verbosity.
780The maximum is 3.
bf740959 781.It Fl X
782Enables X11 forwarding.
71276795 783This can also be specified on a per-host basis in a configuration file.
07d688d5 784.Pp
a4e5acef 785X11 forwarding should be enabled with caution.
786Users with the ability to bypass file permissions on the remote host
787(for the user's X authorization database)
788can access the local X11 display through the forwarded connection.
789An attacker may then be able to perform activities such as keystroke monitoring.
5f4a0c58 790.It Fl x
791Disables X11 forwarding.
d73a67d7 792.It Fl Y
793Enables trusted X11 forwarding.
bf740959 794.El
795.Sh CONFIGURATION FILES
796.Nm
588df31a 797may additionally obtain configuration data from
798a per-user configuration file and a system-wide configuration file.
799The file format and configuration options are described in
800.Xr ssh_config 5 .
bf740959 801.Sh ENVIRONMENT
802.Nm
803will normally set the following environment variables:
5f4a0c58 804.Bl -tag -width LOGNAME
bf740959 805.It Ev DISPLAY
806The
807.Ev DISPLAY
610cd5c6 808variable indicates the location of the X11 server.
f54651ce 809It is automatically set by
bf740959 810.Nm
811to point to a value of the form
812.Dq hostname:n
813where hostname indicates
5f4a0c58 814the host where the shell runs, and n is an integer \*(Ge 1.
610cd5c6 815.Nm
816uses this special value to forward X11 connections over the secure
817channel.
da89cf4d 818The user should normally not set
819.Ev DISPLAY
820explicitly, as that
bf740959 821will render the X11 connection insecure (and will require the user to
822manually copy any required authorization cookies).
823.It Ev HOME
824Set to the path of the user's home directory.
825.It Ev LOGNAME
826Synonym for
827.Ev USER ;
828set for compatibility with systems that use this variable.
829.It Ev MAIL
ae897d7c 830Set to the path of the user's mailbox.
610cd5c6 831.It Ev PATH
bf740959 832Set to the default
833.Ev PATH ,
834as specified when compiling
835.Nm ssh .
3474b2b4 836.It Ev SSH_ASKPASS
837If
838.Nm
839needs a passphrase, it will read the passphrase from the current
840terminal if it was run from a terminal.
841If
842.Nm
843does not have a terminal associated with it but
844.Ev DISPLAY
845and
846.Ev SSH_ASKPASS
847are set, it will execute the program specified by
848.Ev SSH_ASKPASS
849and open an X11 window to read the passphrase.
850This is particularly useful when calling
851.Nm
852from a
853.Pa .Xsession
854or related script.
855(Note that on some machines it
856may be necessary to redirect the input from
857.Pa /dev/null
858to make this work.)
bf740959 859.It Ev SSH_AUTH_SOCK
ae897d7c 860Identifies the path of a unix-domain socket used to communicate with the
bf740959 861agent.
da0561eb 862.It Ev SSH_CONNECTION
863Identifies the client and server ends of the connection.
610cd5c6 864The variable contains
da0561eb 865four space-separated values: client ip-address, client port number,
866server ip-address and server port number.
8abcdba4 867.It Ev SSH_ORIGINAL_COMMAND
868The variable contains the original command line if a forced command
869is executed.
870It can be used to extract the original arguments.
bf740959 871.It Ev SSH_TTY
872This is set to the name of the tty (path to the device) associated
610cd5c6 873with the current shell or command.
874If the current session has no tty,
bf740959 875this variable is not set.
876.It Ev TZ
877The timezone variable is set to indicate the present timezone if it
c345cf9d 878was set when the daemon was started (i.e., the daemon passes the value
bf740959 879on to new connections).
880.It Ev USER
881Set to the name of the user logging in.
882.El
883.Pp
f54651ce 884Additionally,
bf740959 885.Nm
f54651ce 886reads
887.Pa $HOME/.ssh/environment ,
bf740959 888and adds lines of the format
889.Dq VARNAME=value
6a342527 890to the environment if the file exists and if users are allowed to
891change their environment.
5f4a0c58 892For more information, see the
6a342527 893.Cm PermitUserEnvironment
35453849 894option in
6a342527 895.Xr sshd_config 5 .
bf740959 896.Sh FILES
c8d54615 897.Bl -tag -width Ds
f49bc4f7 898.It Pa $HOME/.ssh/known_hosts
ae897d7c 899Records host keys for all hosts the user has logged into that are not
bf740959 900in
2a8a6488 901.Pa /etc/ssh/ssh_known_hosts .
bf740959 902See
903.Xr sshd 8 .
c0ecc314 904.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa
905Contains the authentication identity of the user.
906They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively.
1d1ffb87 907These files
908contain sensitive data and should be readable by the user but not
bf740959 909accessible by others (read/write/execute).
910Note that
911.Nm
1d1ffb87 912ignores a private key file if it is accessible by others.
bf740959 913It is possible to specify a passphrase when
914generating the key; the passphrase will be used to encrypt the
915sensitive part of this file using 3DES.
c0ecc314 916.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub
bf740959 917Contains the public key for authentication (public part of the
610cd5c6 918identity file in human-readable form).
1d1ffb87 919The contents of the
920.Pa $HOME/.ssh/identity.pub
5f4a0c58 921file should be added to the file
bf740959 922.Pa $HOME/.ssh/authorized_keys
923on all machines
91789042 924where the user wishes to log in using protocol version 1 RSA authentication.
1d1ffb87 925The contents of the
926.Pa $HOME/.ssh/id_dsa.pub
c0ecc314 927and
928.Pa $HOME/.ssh/id_rsa.pub
1d1ffb87 929file should be added to
96a7b0cc 930.Pa $HOME/.ssh/authorized_keys
1d1ffb87 931on all machines
91789042 932where the user wishes to log in using protocol version 2 DSA/RSA authentication.
1d1ffb87 933These files are not
610cd5c6 934sensitive and can (but need not) be readable by anyone.
1d1ffb87 935These files are
c44559d2 936never used automatically and are not necessary; they are only provided for
bf740959 937the convenience of the user.
938.It Pa $HOME/.ssh/config
610cd5c6 939This is the per-user configuration file.
588df31a 940The file format and configuration options are described in
941.Xr ssh_config 5 .
e1520719 942Because of the potential for abuse, this file must have strict permissions:
943read/write for the user, and not accessible by others.
bf740959 944.It Pa $HOME/.ssh/authorized_keys
96a7b0cc 945Lists the public keys (RSA/DSA) that can be used for logging in as this user.
610cd5c6 946The format of this file is described in the
bf740959 947.Xr sshd 8
610cd5c6 948manual page.
5f4a0c58 949In the simplest form the format is the same as the
950.Pa .pub
f49bc4f7 951identity files.
1d1ffb87 952This file is not highly sensitive, but the recommended
953permissions are read/write for the user, and not accessible by others.
2a8a6488 954.It Pa /etc/ssh/ssh_known_hosts
610cd5c6 955Systemwide list of known host keys.
f49bc4f7 956This file should be prepared by the
bf740959 957system administrator to contain the public host keys of all machines in the
610cd5c6 958organization.
959This file should be world-readable.
960This file contains
bf740959 961public keys, one per line, in the following format (fields separated
f49bc4f7 962by spaces): system name, public key and optional comment field.
610cd5c6 963When different names are used
bf740959 964for the same machine, all such names should be listed, separated by
610cd5c6 965commas.
5f4a0c58 966The format is described in the
bf740959 967.Xr sshd 8
968manual page.
969.Pp
970The canonical system name (as returned by name servers) is used by
971.Xr sshd 8
972to verify the client host when logging in; other names are needed because
973.Nm
974does not convert the user-supplied name to a canonical name before
975checking the key, because someone with access to the name servers
976would then be able to fool host authentication.
2a8a6488 977.It Pa /etc/ssh/ssh_config
610cd5c6 978Systemwide configuration file.
588df31a 979The file format and configuration options are described in
980.Xr ssh_config 5 .
2a8a6488 981.It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
dd58cb5e 982These three files contain the private parts of the host keys
983and are used for
984.Cm RhostsRSAAuthentication
985and
986.Cm HostbasedAuthentication .
d83cbdc3 987If the protocol version 1
988.Cm RhostsRSAAuthentication
7203d6bb 989method is used,
d83cbdc3 990.Nm
991must be setuid root, since the host key is readable only by root.
992For protocol version 2,
993.Nm
994uses
995.Xr ssh-keysign 8
996to access the host keys for
997.Cm HostbasedAuthentication .
998This eliminates the requirement that
999.Nm
1000be setuid root when that authentication method is used.
1001By default
dd58cb5e 1002.Nm
d83cbdc3 1003is not setuid root.
bf740959 1004.It Pa $HOME/.rhosts
1005This file is used in
5f4a0c58 1006.Em rhosts
bf740959 1007authentication to list the
610cd5c6 1008host/user pairs that are permitted to log in.
1009(Note that this file is
bf740959 1010also used by rlogin and rsh, which makes using this file insecure.)
1011Each line of the file contains a host name (in the canonical form
1012returned by name servers), and then a user name on that host,
610cd5c6 1013separated by a space.
e91c60f2 1014On some machines this file may need to be
bf740959 1015world-readable if the user's home directory is on a NFS partition,
1016because
1017.Xr sshd 8
610cd5c6 1018reads it as root.
1019Additionally, this file must be owned by the user,
1020and must not have write permissions for anyone else.
1021The recommended
bf740959 1022permission for most machines is read/write for the user, and not
1023accessible by others.
1024.Pp
1025Note that by default
1026.Xr sshd 8
1027will be installed so that it requires successful RSA host
5f4a0c58 1028authentication before permitting
1029.Em rhosts
1030authentication.
91789042 1031If the server machine does not have the client's host key in
2a8a6488 1032.Pa /etc/ssh/ssh_known_hosts ,
91789042 1033it can be stored in
bf740959 1034.Pa $HOME/.ssh/known_hosts .
1035The easiest way to do this is to
1036connect back to the client from the server machine using ssh; this
1d1ffb87 1037will automatically add the host key to
bf740959 1038.Pa $HOME/.ssh/known_hosts .
1039.It Pa $HOME/.shosts
1040This file is used exactly the same way as
5f4a0c58 1041.Pa .rhosts .
bf740959 1042The purpose for
1043having this file is to be able to use rhosts authentication with
1044.Nm
1045without permitting login with
5f4a0c58 1046.Xr rlogin
bf740959 1047or
1048.Xr rsh 1 .
1049.It Pa /etc/hosts.equiv
1050This file is used during
5f4a0c58 1051.Em rhosts
be193d89 1052authentication.
610cd5c6 1053It contains
5f4a0c58 1054canonical hosts names, one per line (the full format is described in the
bf740959 1055.Xr sshd 8
610cd5c6 1056manual page).
1057If the client host is found in this file, login is
bf740959 1058automatically permitted provided client and server user names are the
610cd5c6 1059same.
1060Additionally, successful RSA host authentication is normally
1061required.
1062This file should only be writable by root.
5f4fdfae 1063.It Pa /etc/shosts.equiv
f54651ce 1064This file is processed exactly as
bf740959 1065.Pa /etc/hosts.equiv .
1066This file may be useful to permit logins using
1067.Nm
1068but not using rsh/rlogin.
2a8a6488 1069.It Pa /etc/ssh/sshrc
bf740959 1070Commands in this file are executed by
1071.Nm
1072when the user logs in just before the user's shell (or command) is started.
1073See the
1074.Xr sshd 8
1075manual page for more information.
1076.It Pa $HOME/.ssh/rc
1077Commands in this file are executed by
1078.Nm
1079when the user logs in just before the user's shell (or command) is
1080started.
f54651ce 1081See the
bf740959 1082.Xr sshd 8
1083manual page for more information.
83b7f649 1084.It Pa $HOME/.ssh/environment
1085Contains additional definitions for environment variables, see section
1086.Sx ENVIRONMENT
1087above.
b5e300c2 1088.El
16210ef7 1089.Sh DIAGNOSTICS
1090.Nm
1091exits with the exit status of the remote command or with 255
1092if an error occurred.
bf740959 1093.Sh SEE ALSO
5f4a0c58 1094.Xr gzip 1 ,
bf740959 1095.Xr rsh 1 ,
1096.Xr scp 1 ,
61e96248 1097.Xr sftp 1 ,
bf740959 1098.Xr ssh-add 1 ,
1099.Xr ssh-agent 1 ,
1100.Xr ssh-keygen 1 ,
1101.Xr telnet 1 ,
5f4a0c58 1102.Xr hosts.equiv 5 ,
1ae02182 1103.Xr ssh_config 5 ,
b2843ec6 1104.Xr ssh-keysign 8 ,
9afadca8 1105.Xr sshd 8
2cad6cef 1106.Rs
1107.%A T. Ylonen
1108.%A T. Kivinen
1109.%A M. Saarinen
1110.%A T. Rinne
1111.%A S. Lehtinen
1112.%T "SSH Protocol Architecture"
17f5e68a 1113.%N draft-ietf-secsh-architecture-12.txt
1114.%D January 2002
2cad6cef 1115.%O work in progress material
1116.Re
be193d89 1117.Sh AUTHORS
1118OpenSSH is a derivative of the original and free
1119ssh 1.2.12 release by Tatu Ylonen.
1120Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1121Theo de Raadt and Dug Song
1122removed many bugs, re-added newer features and
1123created OpenSSH.
1124Markus Friedl contributed the support for SSH
1125protocol versions 1.5 and 2.0.
This page took 1.018213 seconds and 5 git commands to generate.