blob: 495b787111bf7c10c7414890ad730f9469b2145a [file] [log] [blame]
Damien Miller32aa1441999-10-29 09:15:49 +10001.\"
Damien Miller32aa1441999-10-29 09:15:49 +10002.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
Damien Miller32aa1441999-10-29 09:15:49 +10003.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4.\" All rights reserved
5.\"
Damien Millere4340be2000-09-16 13:29:08 +11006.\" As far as I am concerned, the code I have written for this software
7.\" can be used freely for any purpose. Any derived versions of this
8.\" software must be clearly marked as such, and if the derived work is
9.\" incompatible with the protocol description in the RFC file, it must be
10.\" called by a name other than "ssh" or "Secure Shell".
Damien Miller32aa1441999-10-29 09:15:49 +100011.\"
Ben Lindstrom92a2e382001-03-05 06:59:27 +000012.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
13.\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
14.\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
Damien Millere4340be2000-09-16 13:29:08 +110015.\"
16.\" Redistribution and use in source and binary forms, with or without
17.\" modification, are permitted provided that the following conditions
18.\" are met:
19.\" 1. Redistributions of source code must retain the above copyright
20.\" notice, this list of conditions and the following disclaimer.
21.\" 2. Redistributions in binary form must reproduce the above copyright
22.\" notice, this list of conditions and the following disclaimer in the
23.\" documentation and/or other materials provided with the distribution.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Damien Miller32aa1441999-10-29 09:15:49 +100035.\"
djm@openbsd.orgc0f55db2015-09-11 03:42:32 +000036.\" $OpenBSD: ssh.1,v 1.362 2015/09/11 03:42:32 djm Exp $
37.Dd $Mdocdate: September 11 2015 $
Damien Miller32aa1441999-10-29 09:15:49 +100038.Dt SSH 1
39.Os
40.Sh NAME
41.Nm ssh
Ben Lindstromd58eb5f2001-03-07 06:07:22 +000042.Nd OpenSSH SSH client (remote login program)
Damien Miller32aa1441999-10-29 09:15:49 +100043.Sh SYNOPSIS
44.Nm ssh
Damien Millerbcfbc482010-07-16 13:59:11 +100045.Bk -words
jmc@openbsd.orgb1ba15f2014-10-09 06:21:31 +000046.Op Fl 1246AaCfGgKkMNnqsTtVvXxYy
Ben Lindstrome0f88042001-04-30 13:06:24 +000047.Op Fl b Ar bind_address
Damien Miller30c3d422000-05-09 11:02:59 +100048.Op Fl c Ar cipher_spec
Damien Millerbcfbc482010-07-16 13:59:11 +100049.Op Fl D Oo Ar bind_address : Oc Ns Ar port
Damien Miller03d4d7e2013-04-23 15:21:06 +100050.Op Fl E Ar log_file
Damien Miller32aa1441999-10-29 09:15:49 +100051.Op Fl e Ar escape_char
Ben Lindstrom14f31ab2001-09-12 17:48:04 +000052.Op Fl F Ar configfile
Damien Miller048dc932010-02-12 09:22:04 +110053.Op Fl I Ar pkcs11
Darren Tucker61776952003-10-02 16:19:47 +100054.Op Fl i Ar identity_file
millert@openbsd.org79ec2142015-07-20 15:39:52 +000055.Op Fl L Ar address
Darren Tucker61776952003-10-02 16:19:47 +100056.Op Fl l Ar login_name
57.Op Fl m Ar mac_spec
Darren Tucker7ebfc102004-11-07 20:06:19 +110058.Op Fl O Ar ctl_cmd
Darren Tucker61776952003-10-02 16:19:47 +100059.Op Fl o Ar option
Darren Tucker61776952003-10-02 16:19:47 +100060.Op Fl p Ar port
djm@openbsd.orgc0f55db2015-09-11 03:42:32 +000061.Op Fl Q Ar query_option
millert@openbsd.org79ec2142015-07-20 15:39:52 +000062.Op Fl R Ar address
Darren Tucker7ebfc102004-11-07 20:06:19 +110063.Op Fl S Ar ctl_path
Darren Tucker7ad8dd22010-01-12 19:40:27 +110064.Op Fl W Ar host : Ns Ar port
Damien Millerbcfbc482010-07-16 13:59:11 +100065.Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
Darren Tucker61776952003-10-02 16:19:47 +100066.Oo Ar user Ns @ Oc Ns Ar hostname
Damien Miller32aa1441999-10-29 09:15:49 +100067.Op Ar command
Damien Millerbcfbc482010-07-16 13:59:11 +100068.Ek
Damien Miller22c77262000-04-13 12:26:34 +100069.Sh DESCRIPTION
Damien Miller32aa1441999-10-29 09:15:49 +100070.Nm
Ben Lindstromd58eb5f2001-03-07 06:07:22 +000071(SSH client) is a program for logging into a remote machine and for
Damien Miller7684ee12000-03-17 23:40:15 +110072executing commands on a remote machine.
Darren Tucker61776952003-10-02 16:19:47 +100073It is intended to replace rlogin and rsh,
74and provide secure encrypted communications between
Damien Miller7684ee12000-03-17 23:40:15 +110075two untrusted hosts over an insecure network.
Damien Millera8a0f652014-07-30 12:32:28 +100076X11 connections, arbitrary TCP ports and
77.Ux Ns -domain
78sockets can also be forwarded over the secure channel.
Damien Miller32aa1441999-10-29 09:15:49 +100079.Pp
80.Nm
Damien Miller22c77262000-04-13 12:26:34 +100081connects and logs into the specified
Darren Tucker61776952003-10-02 16:19:47 +100082.Ar hostname
83(with optional
84.Ar user
85name).
Damien Miller32aa1441999-10-29 09:15:49 +100086The user must prove
Damien Millere247cc42000-05-07 12:03:14 +100087his/her identity to the remote machine using one of several methods
Darren Tucker5434cfe2005-12-20 16:11:35 +110088depending on the protocol version used (see below).
Damien Millere247cc42000-05-07 12:03:14 +100089.Pp
Darren Tucker61776952003-10-02 16:19:47 +100090If
91.Ar command
92is specified,
Darren Tuckerb18c8672005-12-20 16:10:09 +110093it is executed on the remote host instead of a login shell.
Darren Tucker0b42e6d2004-08-13 21:22:40 +100094.Pp
Damien Miller0bc1bd82000-11-13 22:57:25 +110095The options are as follows:
millert@openbsd.org79ec2142015-07-20 15:39:52 +000096.Pp
millert@openbsd.orgebe27eb2015-07-20 18:44:12 +000097.Bl -tag -width Ds -compact
Darren Tucker61776952003-10-02 16:19:47 +100098.It Fl 1
99Forces
100.Nm
101to try protocol version 1 only.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000102.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000103.It Fl 2
104Forces
105.Nm
106to try protocol version 2 only.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000107.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000108.It Fl 4
109Forces
110.Nm
111to use IPv4 addresses only.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000112.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000113.It Fl 6
114Forces
115.Nm
116to use IPv6 addresses only.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000117.Pp
Damien Millerb1715dc2000-05-30 13:44:51 +1000118.It Fl A
119Enables forwarding of the authentication agent connection.
120This can also be specified on a per-host basis in a configuration file.
Damien Millerb5fdfaa2002-09-12 09:52:03 +1000121.Pp
Damien Miller495dca32003-04-01 21:42:14 +1000122Agent forwarding should be enabled with caution.
123Users with the ability to bypass file permissions on the remote host
Darren Tuckerae69e1d2009-10-24 11:41:34 +1100124(for the agent's
Darren Tucker98c9aec2009-10-24 11:42:44 +1100125.Ux Ns -domain
126socket) can access the local agent through the forwarded connection.
Damien Miller495dca32003-04-01 21:42:14 +1000127An attacker cannot obtain key material from the agent,
Damien Millerb5fdfaa2002-09-12 09:52:03 +1000128however they can perform operations on the keys that enable them to
129authenticate using the identities loaded into the agent.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000130.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000131.It Fl a
132Disables forwarding of the authentication agent connection.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000133.Pp
Ben Lindstrome0f88042001-04-30 13:06:24 +0000134.It Fl b Ar bind_address
Darren Tuckera5cf8552005-07-14 17:04:18 +1000135Use
136.Ar bind_address
137on the local machine as the source address
138of the connection.
139Only useful on systems with more than one address.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000140.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000141.It Fl C
142Requests compression of all data (including stdin, stdout, stderr, and
Damien Millera8a0f652014-07-30 12:32:28 +1000143data for forwarded X11, TCP and
144.Ux Ns -domain
145connections).
Darren Tucker61776952003-10-02 16:19:47 +1000146The compression algorithm is the same used by
147.Xr gzip 1 ,
148and the
149.Dq level
150can be controlled by the
151.Cm CompressionLevel
152option for protocol version 1.
153Compression is desirable on modem lines and other
154slow connections, but will only slow down things on fast networks.
155The default value can be set on a host-by-host basis in the
156configuration files; see the
157.Cm Compression
158option.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000159.Pp
Damien Miller05202ff2004-06-15 10:30:39 +1000160.It Fl c Ar cipher_spec
161Selects the cipher specification for encrypting the session.
162.Pp
163Protocol version 1 allows specification of a single cipher.
Darren Tucker1e4308e2005-10-03 18:18:40 +1000164The supported values are
Damien Miller05202ff2004-06-15 10:30:39 +1000165.Dq 3des ,
Darren Tuckerff9f4842005-12-20 16:10:45 +1100166.Dq blowfish ,
Damien Miller05202ff2004-06-15 10:30:39 +1000167and
168.Dq des .
Damien Miller35978212005-12-24 14:56:47 +1100169For protocol version 2,
Damien Miller05202ff2004-06-15 10:30:39 +1000170.Ar cipher_spec
171is a comma-separated list of ciphers
172listed in order of preference.
Darren Tucker3a6a51f2009-06-21 17:48:52 +1000173See the
174.Cm Ciphers
Damien Miller081f3c72010-08-03 16:05:25 +1000175keyword in
176.Xr ssh_config 5
177for more information.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000178.Pp
Darren Tuckerc8d64212005-10-03 18:13:42 +1000179.It Fl D Xo
180.Sm off
181.Oo Ar bind_address : Oc
182.Ar port
183.Sm on
184.Xc
Darren Tucker61776952003-10-02 16:19:47 +1000185Specifies a local
186.Dq dynamic
187application-level port forwarding.
188This works by allocating a socket to listen to
189.Ar port
Darren Tuckerc8d64212005-10-03 18:13:42 +1000190on the local side, optionally bound to the specified
191.Ar bind_address .
192Whenever a connection is made to this port, the
Darren Tucker61776952003-10-02 16:19:47 +1000193connection is forwarded over the secure channel, and the application
194protocol is then used to determine where to connect to from the
195remote machine.
196Currently the SOCKS4 and SOCKS5 protocols are supported, and
197.Nm
198will act as a SOCKS server.
199Only root can forward privileged ports.
200Dynamic port forwardings can also be specified in the configuration file.
Darren Tuckerc8d64212005-10-03 18:13:42 +1000201.Pp
Damien Miller7fa96602010-08-05 13:03:13 +1000202IPv6 addresses can be specified by enclosing the address in square brackets.
Darren Tuckerc8d64212005-10-03 18:13:42 +1000203Only the superuser can forward privileged ports.
204By default, the local port is bound in accordance with the
205.Cm GatewayPorts
206setting.
207However, an explicit
208.Ar bind_address
209may be used to bind the connection to a specific address.
210The
211.Ar bind_address
212of
213.Dq localhost
214indicates that the listening port be bound for local use only, while an
215empty address or
216.Sq *
217indicates that the port should be available from all interfaces.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000218.Pp
Damien Miller03d4d7e2013-04-23 15:21:06 +1000219.It Fl E Ar log_file
220Append debug logs to
221.Ar log_file
222instead of standard error.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000223.Pp
Damien Miller2142ba02005-12-24 14:56:29 +1100224.It Fl e Ar escape_char
Damien Miller32aa1441999-10-29 09:15:49 +1000225Sets the escape character for sessions with a pty (default:
226.Ql ~ ) .
Damien Miller7684ee12000-03-17 23:40:15 +1100227The escape character is only recognized at the beginning of a line.
228The escape character followed by a dot
Damien Miller32aa1441999-10-29 09:15:49 +1000229.Pq Ql \&.
Darren Tucker61776952003-10-02 16:19:47 +1000230closes the connection;
231followed by control-Z suspends the connection;
232and followed by itself sends the escape character once.
Damien Miller7684ee12000-03-17 23:40:15 +1100233Setting the character to
Damien Miller32aa1441999-10-29 09:15:49 +1000234.Dq none
235disables any escapes and makes the session fully transparent.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000236.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000237.It Fl F Ar configfile
238Specifies an alternative per-user configuration file.
239If a configuration file is given on the command line,
240the system-wide configuration file
241.Pq Pa /etc/ssh/ssh_config
242will be ignored.
243The default for the per-user configuration file is
Damien Miller167ea5d2005-05-26 12:04:02 +1000244.Pa ~/.ssh/config .
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000245.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000246.It Fl f
247Requests
248.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100249to go to background just before command execution.
250This is useful if
Damien Miller32aa1441999-10-29 09:15:49 +1000251.Nm
252is going to ask for passwords or passphrases, but the user
Damien Miller7684ee12000-03-17 23:40:15 +1100253wants it in the background.
Damien Miller22c77262000-04-13 12:26:34 +1000254This implies
Damien Miller32aa1441999-10-29 09:15:49 +1000255.Fl n .
256The recommended way to start X11 programs at a remote site is with
257something like
258.Ic ssh -f host xterm .
Darren Tucker9a2a6092008-07-04 12:53:50 +1000259.Pp
260If the
261.Cm ExitOnForwardFailure
262configuration option is set to
263.Dq yes ,
264then a client started with
265.Fl f
266will wait for all remote port forwards to be successfully established
267before placing itself in the background.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000268.Pp
djm@openbsd.org957fbce2014-10-08 22:20:25 +0000269.It Fl G
270Causes
271.Nm
272to print its configuration after evaluating
273.Cm Host
274and
275.Cm Match
276blocks and exit.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000277.Pp
Damien Miller396691a2000-01-20 22:44:08 +1100278.It Fl g
279Allows remote hosts to connect to local forwarded ports.
Damien Miller49d9bfe2014-07-03 21:26:42 +1000280If used on a multiplexed connection, then this option must be specified
281on the master process.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000282.Pp
Damien Miller7ea845e2010-02-12 09:21:02 +1100283.It Fl I Ar pkcs11
Damien Millerd400da52010-02-12 09:26:23 +1100284Specify the PKCS#11 shared library
Darren Tucker61776952003-10-02 16:19:47 +1000285.Nm
Damien Millera7618442010-02-12 09:26:02 +1100286should use to communicate with a PKCS#11 token providing the user's
Darren Tucker61776952003-10-02 16:19:47 +1000287private RSA key.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000288.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000289.It Fl i Ar identity_file
Damien Millerfae23862002-01-22 23:32:26 +1100290Selects a file from which the identity (private key) for
Damien Millereb8b60e2010-08-31 22:41:14 +1000291public key authentication is read.
Damien Millerfae23862002-01-22 23:32:26 +1100292The default is
Damien Miller167ea5d2005-05-26 12:04:02 +1000293.Pa ~/.ssh/identity
Damien Millerfae23862002-01-22 23:32:26 +1100294for protocol version 1, and
Damien Millereb8b60e2010-08-31 22:41:14 +1000295.Pa ~/.ssh/id_dsa ,
Damien Miller8ba0ead2013-12-18 17:46:27 +1100296.Pa ~/.ssh/id_ecdsa ,
297.Pa ~/.ssh/id_ed25519
Damien Millerfae23862002-01-22 23:32:26 +1100298and
Damien Millereb8b60e2010-08-31 22:41:14 +1000299.Pa ~/.ssh/id_rsa
Damien Millerfae23862002-01-22 23:32:26 +1100300for protocol version 2.
Damien Miller7684ee12000-03-17 23:40:15 +1100301Identity files may also be specified on
302a per-host basis in the configuration file.
303It is possible to have multiple
Damien Miller32aa1441999-10-29 09:15:49 +1000304.Fl i
305options (and multiple identities specified in
306configuration files).
Damien Miller5059d8d2010-03-05 21:31:11 +1100307.Nm
308will also try to load certificate information from the filename obtained
309by appending
310.Pa -cert.pub
311to identity filenames.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000312.Pp
Darren Tucker415bddc2007-06-12 23:43:16 +1000313.It Fl K
314Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
315credentials to the server.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000316.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000317.It Fl k
Damien Millere0113cc2003-11-24 13:10:09 +1100318Disables forwarding (delegation) of GSSAPI credentials to the server.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000319.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000320.It Fl L Xo
321.Sm off
Damien Millerf91ee4c2005-03-01 21:24:33 +1100322.Oo Ar bind_address : Oc
Darren Tucker61776952003-10-02 16:19:47 +1000323.Ar port : host : hostport
324.Sm on
325.Xc
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000326.It Fl L Xo
327.Sm off
328.Oo Ar bind_address : Oc
329.Ar port : remote_socket
330.Sm on
331.Xc
332.It Fl L Xo
333.Sm off
334.Ar local_socket : host : hostport
335.Sm on
336.Xc
337.It Fl L Xo
338.Sm off
339.Ar local_socket : remote_socket
340.Sm on
341.Xc
342Specifies that connections to the given TCP port or Unix socket on the local
343(client) host are to be forwarded to the given host and port, or Unix socket,
344on the remote side.
345This works by allocating a socket to listen to either a TCP
Darren Tucker61776952003-10-02 16:19:47 +1000346.Ar port
Damien Millerf91ee4c2005-03-01 21:24:33 +1100347on the local side, optionally bound to the specified
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000348.Ar bind_address ,
349or to a Unix socket.
350Whenever a connection is made to the local port or socket, the
Darren Tucker61776952003-10-02 16:19:47 +1000351connection is forwarded over the secure channel, and a connection is
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000352made to either
Darren Tucker61776952003-10-02 16:19:47 +1000353.Ar host
354port
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000355.Ar hostport ,
356or the Unix socket
357.Ar remote_socket ,
Darren Tucker61776952003-10-02 16:19:47 +1000358from the remote machine.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000359.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000360Port forwardings can also be specified in the configuration file.
Damien Millerf91ee4c2005-03-01 21:24:33 +1100361Only the superuser can forward privileged ports.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000362IPv6 addresses can be specified by enclosing the address in square brackets.
363.Pp
Damien Millerf91ee4c2005-03-01 21:24:33 +1100364By default, the local port is bound in accordance with the
365.Cm GatewayPorts
366setting.
367However, an explicit
368.Ar bind_address
369may be used to bind the connection to a specific address.
370The
371.Ar bind_address
372of
373.Dq localhost
Damien Miller36bf7dd2005-03-02 12:02:47 +1100374indicates that the listening port be bound for local use only, while an
375empty address or
376.Sq *
Damien Millerf91ee4c2005-03-01 21:24:33 +1100377indicates that the port should be available from all interfaces.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000378.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000379.It Fl l Ar login_name
Damien Miller7684ee12000-03-17 23:40:15 +1100380Specifies the user to log in as on the remote machine.
381This also may be specified on a per-host basis in the configuration file.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000382.Pp
Damien Miller0e220db2004-06-15 10:34:08 +1000383.It Fl M
384Places the
385.Nm
386client into
387.Dq master
388mode for connection sharing.
Damien Miller88b25522005-12-31 16:23:15 +1100389Multiple
390.Fl M
391options places
392.Nm
393into
394.Dq master
395mode with confirmation required before slave connections are accepted.
Damien Miller0e220db2004-06-15 10:34:08 +1000396Refer to the description of
397.Cm ControlMaster
398in
399.Xr ssh_config 5
400for details.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000401.Pp
Damien Miller5d1eceb2004-06-30 22:37:57 +1000402.It Fl m Ar mac_spec
403Additionally, for protocol version 2 a comma-separated list of MAC
404(message authentication code) algorithms can
405be specified in order of preference.
406See the
407.Cm MACs
408keyword for more information.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000409.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000410.It Fl N
411Do not execute a remote command.
412This is useful for just forwarding ports
413(protocol version 2 only).
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000414.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000415.It Fl n
416Redirects stdin from
417.Pa /dev/null
418(actually, prevents reading from stdin).
419This must be used when
420.Nm
Damien Miller7684ee12000-03-17 23:40:15 +1100421is run in the background.
422A common trick is to use this to run X11 programs on a remote machine.
423For example,
Damien Miller32aa1441999-10-29 09:15:49 +1000424.Ic ssh -n shadows.cs.hut.fi emacs &
425will start an emacs on shadows.cs.hut.fi, and the X11
426connection will be automatically forwarded over an encrypted channel.
427The
428.Nm
429program will be put in the background.
430(This does not work if
431.Nm
432needs to ask for a password or passphrase; see also the
433.Fl f
434option.)
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000435.Pp
Darren Tuckere04644c2004-12-03 14:08:45 +1100436.It Fl O Ar ctl_cmd
437Control an active connection multiplexing master process.
438When the
439.Fl O
440option is specified, the
441.Ar ctl_cmd
442argument is interpreted and passed to the master process.
443Valid commands are:
444.Dq check
Damien Miller388f6fc2010-05-21 14:57:35 +1000445(check that the master process is running),
446.Dq forward
Damien Miller8cb1cda2011-05-05 14:16:56 +1000447(request forwardings without command execution),
Damien Miller1bcbd0a2011-09-22 21:40:45 +1000448.Dq cancel
449(cancel forwardings),
Darren Tuckere04644c2004-12-03 14:08:45 +1100450.Dq exit
Damien Miller8cb1cda2011-05-05 14:16:56 +1000451(request the master to exit), and
Damien Miller6c3eec72011-05-05 14:16:22 +1000452.Dq stop
453(request the master to stop accepting further multiplexing requests).
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000454.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000455.It Fl o Ar option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000456Can be used to give options in the format used in the configuration file.
Damien Miller32aa1441999-10-29 09:15:49 +1000457This is useful for specifying options for which there is no separate
Damien Miller7684ee12000-03-17 23:40:15 +1100458command-line flag.
Darren Tucker61776952003-10-02 16:19:47 +1000459For full details of the options listed below, and their possible values, see
460.Xr ssh_config 5 .
461.Pp
462.Bl -tag -width Ds -offset indent -compact
463.It AddressFamily
464.It BatchMode
465.It BindAddress
Damien Miller0faf7472013-10-17 11:47:23 +1100466.It CanonicalDomains
Damien Miller38505592013-10-17 11:48:13 +1100467.It CanonicalizeFallbackLocal
468.It CanonicalizeHostname
469.It CanonicalizeMaxDots
470.It CanonicalizePermittedCNAMEs
Darren Tucker61776952003-10-02 16:19:47 +1000471.It ChallengeResponseAuthentication
472.It CheckHostIP
473.It Cipher
474.It Ciphers
475.It ClearAllForwardings
476.It Compression
477.It CompressionLevel
478.It ConnectionAttempts
Darren Tuckeredae0ec2004-05-02 22:15:52 +1000479.It ConnectTimeout
Damien Miller0e220db2004-06-15 10:34:08 +1000480.It ControlMaster
481.It ControlPath
Damien Millerefad7272011-09-22 21:33:53 +1000482.It ControlPersist
Darren Tucker61776952003-10-02 16:19:47 +1000483.It DynamicForward
Darren Tucker61776952003-10-02 16:19:47 +1000484.It EscapeChar
Darren Tuckere7d4b192006-07-12 22:17:10 +1000485.It ExitOnForwardFailure
jmc@openbsd.org8abd8032014-12-22 09:26:31 +0000486.It FingerprintHash
Darren Tucker61776952003-10-02 16:19:47 +1000487.It ForwardAgent
488.It ForwardX11
Damien Millerefad7272011-09-22 21:33:53 +1000489.It ForwardX11Timeout
Darren Tucker0a118da2003-10-15 15:54:32 +1000490.It ForwardX11Trusted
Darren Tucker61776952003-10-02 16:19:47 +1000491.It GatewayPorts
492.It GlobalKnownHostsFile
493.It GSSAPIAuthentication
494.It GSSAPIDelegateCredentials
Damien Millere1776152005-03-01 21:47:37 +1100495.It HashKnownHosts
Darren Tucker61776952003-10-02 16:19:47 +1000496.It Host
497.It HostbasedAuthentication
djm@openbsd.org46347ed2015-01-30 11:43:14 +0000498.It HostbasedKeyTypes
Darren Tucker61776952003-10-02 16:19:47 +1000499.It HostKeyAlgorithms
500.It HostKeyAlias
501.It HostName
502.It IdentityFile
Damien Millerbd394c32004-03-08 23:12:36 +1100503.It IdentitiesOnly
Damien Miller0a184732010-11-20 15:21:03 +1100504.It IPQoS
Damien Millerefad7272011-09-22 21:33:53 +1000505.It KbdInteractiveAuthentication
Darren Tucker636ca902004-11-05 20:22:00 +1100506.It KbdInteractiveDevices
Damien Miller7fe2b1f2010-09-24 22:11:53 +1000507.It KexAlgorithms
Damien Millerd27b9472005-12-13 19:29:02 +1100508.It LocalCommand
Darren Tucker61776952003-10-02 16:19:47 +1000509.It LocalForward
510.It LogLevel
511.It MACs
Damien Millerd77b81f2013-10-17 11:39:00 +1100512.It Match
Darren Tucker61776952003-10-02 16:19:47 +1000513.It NoHostAuthenticationForLocalhost
514.It NumberOfPasswordPrompts
515.It PasswordAuthentication
Damien Millerd27b9472005-12-13 19:29:02 +1100516.It PermitLocalCommand
Damien Miller7ea845e2010-02-12 09:21:02 +1100517.It PKCS11Provider
Darren Tucker61776952003-10-02 16:19:47 +1000518.It Port
519.It PreferredAuthentications
520.It Protocol
521.It ProxyCommand
Damien Millerf2f6c312013-08-21 02:44:58 +1000522.It ProxyUseFdpass
markus@openbsd.org3a1638d2015-07-10 06:21:53 +0000523.It PubkeyAcceptedKeyTypes
Darren Tucker61776952003-10-02 16:19:47 +1000524.It PubkeyAuthentication
Darren Tucker62388b22006-01-20 11:31:47 +1100525.It RekeyLimit
Darren Tucker61776952003-10-02 16:19:47 +1000526.It RemoteForward
Damien Millerf4b32aa2011-05-15 08:47:43 +1000527.It RequestTTY
Darren Tucker61776952003-10-02 16:19:47 +1000528.It RhostsRSAAuthentication
529.It RSAAuthentication
Darren Tucker7a6c0662004-05-02 22:14:03 +1000530.It SendEnv
Damien Miller509b0102003-12-17 16:33:10 +1100531.It ServerAliveInterval
532.It ServerAliveCountMax
Damien Miller6d576562014-07-18 15:02:06 +1000533.It StreamLocalBindMask
534.It StreamLocalBindUnlink
Darren Tucker61776952003-10-02 16:19:47 +1000535.It StrictHostKeyChecking
Damien Miller12c150e2003-12-17 16:31:10 +1100536.It TCPKeepAlive
Damien Millerd27b9472005-12-13 19:29:02 +1100537.It Tunnel
538.It TunnelDevice
djm@openbsd.org1d1092b2015-01-26 12:16:36 +0000539.It UpdateHostKeys
Darren Tucker61776952003-10-02 16:19:47 +1000540.It UsePrivilegedPort
541.It User
542.It UserKnownHostsFile
543.It VerifyHostKeyDNS
Damien Miller86399202008-06-30 00:04:31 +1000544.It VisualHostKey
Darren Tucker61776952003-10-02 16:19:47 +1000545.It XAuthLocation
546.El
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000547.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000548.It Fl p Ar port
Damien Miller7684ee12000-03-17 23:40:15 +1100549Port to connect to on the remote host.
550This can be specified on a
Damien Miller32aa1441999-10-29 09:15:49 +1000551per-host basis in the configuration file.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000552.Pp
djm@openbsd.orgc0f55db2015-09-11 03:42:32 +0000553.It Fl Q Ar query_option
Damien Millerea111192013-04-23 19:24:32 +1000554Queries
555.Nm
Damien Millerd937dc02013-12-05 10:19:54 +1100556for the algorithms supported for the specified version 2.
557The available features are:
558.Ar cipher
Damien Millerea111192013-04-23 19:24:32 +1000559(supported symmetric ciphers),
Damien Millerd937dc02013-12-05 10:19:54 +1100560.Ar cipher-auth
Damien Miller0fde8ac2013-11-21 14:12:23 +1100561(supported symmetric ciphers that support authenticated encryption),
Damien Millerd937dc02013-12-05 10:19:54 +1100562.Ar mac
Damien Millerea111192013-04-23 19:24:32 +1000563(supported message integrity codes),
Damien Millerd937dc02013-12-05 10:19:54 +1100564.Ar kex
Damien Millerea111192013-04-23 19:24:32 +1000565(key exchange algorithms),
Damien Millerd937dc02013-12-05 10:19:54 +1100566.Ar key
djm@openbsd.orgc0f55db2015-09-11 03:42:32 +0000567(key types),
568.Ar key-cert
569(certificate key types),
570.Ar key-plain
571(non-certificate key types), and
djm@openbsd.org68d2dfc2015-03-03 06:48:58 +0000572.Ar protocol-version
573(supported SSH protocol versions).
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000574.Pp
Damien Miller32aa1441999-10-29 09:15:49 +1000575.It Fl q
Damien Miller7684ee12000-03-17 23:40:15 +1100576Quiet mode.
Damien Millereb602472008-02-10 22:21:28 +1100577Causes most warning and diagnostic messages to be suppressed.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000578.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000579.It Fl R Xo
580.Sm off
Damien Millerf91ee4c2005-03-01 21:24:33 +1100581.Oo Ar bind_address : Oc
Darren Tucker61776952003-10-02 16:19:47 +1000582.Ar port : host : hostport
583.Sm on
584.Xc
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000585.It Fl R Xo
586.Sm off
587.Oo Ar bind_address : Oc
588.Ar port : local_socket
589.Sm on
590.Xc
591.It Fl R Xo
592.Sm off
593.Ar remote_socket : host : hostport
594.Sm on
595.Xc
596.It Fl R Xo
597.Sm off
598.Ar remote_socket : local_socket
599.Sm on
600.Xc
601Specifies that connections to the given TCP port or Unix socket on the remote
602(server) host are to be forwarded to the given host and port, or Unix socket,
603on the local side.
604This works by allocating a socket to listen to either a TCP
Damien Miller32aa1441999-10-29 09:15:49 +1000605.Ar port
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000606or to a Unix socket on the remote side.
607Whenever a connection is made to this port or Unix socket, the
608connection is forwarded over the secure channel, and a connection
609is made to either
Damien Miller34132e52000-01-14 15:45:46 +1100610.Ar host
611port
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000612.Ar hostport ,
613or
614.Ar local_socket ,
Damien Miller7684ee12000-03-17 23:40:15 +1100615from the local machine.
Damien Millerf91ee4c2005-03-01 21:24:33 +1100616.Pp
Damien Miller7684ee12000-03-17 23:40:15 +1100617Port forwardings can also be specified in the configuration file.
618Privileged ports can be forwarded only when
Damien Miller32aa1441999-10-29 09:15:49 +1000619logging in as root on the remote machine.
Damien Miller70b2d552012-04-22 11:26:10 +1000620IPv6 addresses can be specified by enclosing the address in square brackets.
Damien Millerf91ee4c2005-03-01 21:24:33 +1100621.Pp
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000622By default, TCP listening sockets on the server will be bound to the loopback
Damien Millerf91ee4c2005-03-01 21:24:33 +1100623interface only.
Darren Tucker63917bd2008-11-11 16:33:48 +1100624This may be overridden by specifying a
Damien Millerf91ee4c2005-03-01 21:24:33 +1100625.Ar bind_address .
Damien Miller36bf7dd2005-03-02 12:02:47 +1100626An empty
627.Ar bind_address ,
Damien Millerf91ee4c2005-03-01 21:24:33 +1100628or the address
Damien Miller36bf7dd2005-03-02 12:02:47 +1100629.Ql * ,
Damien Millerf91ee4c2005-03-01 21:24:33 +1100630indicates that the remote socket should listen on all interfaces.
631Specifying a remote
632.Ar bind_address
Damien Miller36bf7dd2005-03-02 12:02:47 +1100633will only succeed if the server's
634.Cm GatewayPorts
Damien Millerf91ee4c2005-03-01 21:24:33 +1100635option is enabled (see
Damien Miller36bf7dd2005-03-02 12:02:47 +1100636.Xr sshd_config 5 ) .
Damien Millere2f4cc52009-02-14 16:33:49 +1100637.Pp
638If the
639.Ar port
640argument is
Damien Miller65fa4ca2009-02-14 16:34:05 +1100641.Ql 0 ,
Damien Millere2f4cc52009-02-14 16:33:49 +1100642the listen port will be dynamically allocated on the server and reported
643to the client at run time.
Damien Miller388f6fc2010-05-21 14:57:35 +1000644When used together with
645.Ic -O forward
646the allocated port will be printed to the standard output.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000647.Pp
Darren Tucker7ebfc102004-11-07 20:06:19 +1100648.It Fl S Ar ctl_path
Damien Miller67f30d72010-04-16 15:52:03 +1000649Specifies the location of a control socket for connection sharing,
Damien Miller9c60f242010-03-26 11:28:35 +1100650or the string
651.Dq none
652to disable connection sharing.
Damien Miller0e220db2004-06-15 10:34:08 +1000653Refer to the description of
Darren Tuckerba5c5922004-06-18 16:22:39 +1000654.Cm ControlPath
655and
Damien Miller0e220db2004-06-15 10:34:08 +1000656.Cm ControlMaster
657in
658.Xr ssh_config 5
659for details.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000660.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000661.It Fl s
662May be used to request invocation of a subsystem on the remote system.
663Subsystems are a feature of the SSH2 protocol which facilitate the use
664of SSH as a secure transport for other applications (eg.\&
665.Xr sftp 1 ) .
666The subsystem is specified as the remote command.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000667.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000668.It Fl T
dtucker@openbsd.orgf8484da2015-05-06 05:45:17 +0000669Disable pseudo-terminal allocation.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000670.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000671.It Fl t
dtucker@openbsd.orgf8484da2015-05-06 05:45:17 +0000672Force pseudo-terminal allocation.
Darren Tucker61776952003-10-02 16:19:47 +1000673This can be used to execute arbitrary
674screen-based programs on a remote machine, which can be very useful,
Damien Miller208f1ed2006-03-15 11:56:03 +1100675e.g. when implementing menu services.
Darren Tucker61776952003-10-02 16:19:47 +1000676Multiple
677.Fl t
678options force tty allocation, even if
Ben Lindstrom19ceb172001-09-12 17:54:24 +0000679.Nm
Darren Tucker61776952003-10-02 16:19:47 +1000680has no local tty.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000681.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000682.It Fl V
683Display the version number and exit.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000684.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000685.It Fl v
686Verbose mode.
687Causes
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +0000688.Nm
Darren Tucker61776952003-10-02 16:19:47 +1000689to print debugging messages about its progress.
690This is helpful in
691debugging connection, authentication, and configuration problems.
692Multiple
693.Fl v
694options increase the verbosity.
695The maximum is 3.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000696.Pp
Darren Tucker7ad8dd22010-01-12 19:40:27 +1100697.It Fl W Ar host : Ns Ar port
698Requests that standard input and output on the client be forwarded to
699.Ar host
700on
701.Ar port
702over the secure channel.
703Implies
704.Fl N ,
705.Fl T ,
706.Cm ExitOnForwardFailure
707and
Damien Miller36378c62012-06-20 21:53:25 +1000708.Cm ClearAllForwardings .
709Works with Protocol version 2 only.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000710.Pp
Damien Miller991dba42006-07-10 20:16:27 +1000711.It Fl w Xo
712.Ar local_tun Ns Op : Ns Ar remote_tun
713.Xc
714Requests
715tunnel
716device forwarding with the specified
Damien Millerd27b9472005-12-13 19:29:02 +1100717.Xr tun 4
Damien Miller991dba42006-07-10 20:16:27 +1000718devices between the client
719.Pq Ar local_tun
720and the server
721.Pq Ar remote_tun .
722.Pp
Damien Millercf1e3422005-12-24 14:56:04 +1100723The devices may be specified by numerical ID or the keyword
724.Dq any ,
725which uses the next available tunnel device.
Damien Miller991dba42006-07-10 20:16:27 +1000726If
727.Ar remote_tun
728is not specified, it defaults to
729.Dq any .
Damien Millercf1e3422005-12-24 14:56:04 +1100730See also the
Damien Millerd27b9472005-12-13 19:29:02 +1100731.Cm Tunnel
Damien Miller991dba42006-07-10 20:16:27 +1000732and
733.Cm TunnelDevice
734directives in
Damien Millerd27b9472005-12-13 19:29:02 +1100735.Xr ssh_config 5 .
Damien Miller991dba42006-07-10 20:16:27 +1000736If the
737.Cm Tunnel
738directive is unset, it is set to the default tunnel mode, which is
739.Dq point-to-point .
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000740.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000741.It Fl X
742Enables X11 forwarding.
743This can also be specified on a per-host basis in a configuration file.
744.Pp
745X11 forwarding should be enabled with caution.
746Users with the ability to bypass file permissions on the remote host
747(for the user's X authorization database)
748can access the local X11 display through the forwarded connection.
749An attacker may then be able to perform activities such as keystroke monitoring.
Damien Miller947219e2005-03-02 13:22:30 +1100750.Pp
Damien Millerb022b232005-03-05 11:22:36 +1100751For this reason, X11 forwarding is subjected to X11 SECURITY extension
Damien Miller947219e2005-03-02 13:22:30 +1100752restrictions by default.
753Please refer to the
754.Nm
755.Fl Y
756option and the
757.Cm ForwardX11Trusted
758directive in
759.Xr ssh_config 5
760for more information.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000761.Pp
Darren Tucker61776952003-10-02 16:19:47 +1000762.It Fl x
763Disables X11 forwarding.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000764.Pp
Darren Tucker0a118da2003-10-15 15:54:32 +1000765.It Fl Y
766Enables trusted X11 forwarding.
Damien Miller947219e2005-03-02 13:22:30 +1100767Trusted X11 forwardings are not subjected to the X11 SECURITY extension
768controls.
millert@openbsd.org79ec2142015-07-20 15:39:52 +0000769.Pp
Damien Millere272a5b2008-11-03 19:22:37 +1100770.It Fl y
771Send log information using the
772.Xr syslog 3
773system module.
774By default this information is sent to stderr.
Damien Miller32aa1441999-10-29 09:15:49 +1000775.El
Damien Millere9b333a2005-12-24 14:53:04 +1100776.Pp
777.Nm
778may additionally obtain configuration data from
779a per-user configuration file and a system-wide configuration file.
780The file format and configuration options are described in
781.Xr ssh_config 5 .
Damien Millerc93a8132005-12-24 14:52:13 +1100782.Sh AUTHENTICATION
Darren Tucker94299ec2006-01-20 11:30:14 +1100783The OpenSSH SSH client supports SSH protocols 1 and 2.
Darren Tucker7a4a7652009-10-11 21:51:40 +1100784The default is to use protocol 2 only,
785though this can be changed via the
Damien Millerc93a8132005-12-24 14:52:13 +1100786.Cm Protocol
787option in
Darren Tucker7a4a7652009-10-11 21:51:40 +1100788.Xr ssh_config 5
789or the
Damien Millerc93a8132005-12-24 14:52:13 +1100790.Fl 1
791and
792.Fl 2
793options (see above).
794Both protocols support similar authentication methods,
Darren Tucker7a4a7652009-10-11 21:51:40 +1100795but protocol 2 is the default since
Damien Millerc93a8132005-12-24 14:52:13 +1100796it provides additional mechanisms for confidentiality
797(the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
Damien Miller20bd4532011-08-06 06:17:30 +1000798and integrity (hmac-md5, hmac-sha1,
799hmac-sha2-256, hmac-sha2-512,
Darren Tucker427e4092012-10-05 11:02:39 +1000800umac-64, umac-128, hmac-ripemd160).
Damien Millerc93a8132005-12-24 14:52:13 +1100801Protocol 1 lacks a strong mechanism for ensuring the
802integrity of the connection.
803.Pp
804The methods available for authentication are:
Damien Millerfbc94c82006-06-13 13:03:16 +1000805GSSAPI-based authentication,
Damien Millerc93a8132005-12-24 14:52:13 +1100806host-based authentication,
807public key authentication,
808challenge-response authentication,
809and password authentication.
810Authentication methods are tried in the order specified above,
811though protocol 2 has a configuration option to change the default order:
812.Cm PreferredAuthentications .
813.Pp
814Host-based authentication works as follows:
Darren Tuckerd3877b92005-12-20 16:09:36 +1100815If the machine the user logs in from is listed in
816.Pa /etc/hosts.equiv
817or
818.Pa /etc/shosts.equiv
819on the remote machine, and the user names are
820the same on both sides, or if the files
821.Pa ~/.rhosts
822or
823.Pa ~/.shosts
824exist in the user's home directory on the
825remote machine and contain a line containing the name of the client
826machine and the name of the user on that machine, the user is
Damien Millerc93a8132005-12-24 14:52:13 +1100827considered for login.
828Additionally, the server
829.Em must
830be able to verify the client's
831host key (see the description of
Darren Tuckerd3877b92005-12-20 16:09:36 +1100832.Pa /etc/ssh/ssh_known_hosts
833and
Damien Millerc93a8132005-12-24 14:52:13 +1100834.Pa ~/.ssh/known_hosts ,
835below)
836for login to be permitted.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100837This authentication method closes security holes due to IP
Damien Millerc93a8132005-12-24 14:52:13 +1100838spoofing, DNS spoofing, and routing spoofing.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100839[Note to the administrator:
840.Pa /etc/hosts.equiv ,
841.Pa ~/.rhosts ,
842and the rlogin/rsh protocol in general, are inherently insecure and should be
843disabled if security is desired.]
844.Pp
Damien Millerc93a8132005-12-24 14:52:13 +1100845Public key authentication works as follows:
846The scheme is based on public-key cryptography,
847using cryptosystems
848where encryption and decryption are done using separate keys,
849and it is unfeasible to derive the decryption key from the encryption key.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100850The idea is that each user creates a public/private
851key pair for authentication purposes.
852The server knows the public key, and only the user knows the private key.
Damien Millerc93a8132005-12-24 14:52:13 +1100853.Nm
854implements public key authentication protocol automatically,
sobrado@openbsd.orgf70b22b2014-08-30 15:33:50 +0000855using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
Damien Millerc93a8132005-12-24 14:52:13 +1100856Protocol 1 is restricted to using only RSA keys,
Damien Millereb8b60e2010-08-31 22:41:14 +1000857but protocol 2 may use any.
Damien Millerfecfd112013-07-18 16:11:50 +1000858The HISTORY section of
Damien Millerc93a8132005-12-24 14:52:13 +1100859.Xr ssl 8
Damien Millerd4427902010-09-10 11:15:10 +1000860contains a brief discussion of the DSA and RSA algorithms.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100861.Pp
862The file
863.Pa ~/.ssh/authorized_keys
864lists the public keys that are permitted for logging in.
865When the user logs in, the
866.Nm
867program tells the server which key pair it would like to use for
868authentication.
Damien Millerc93a8132005-12-24 14:52:13 +1100869The client proves that it has access to the private key
870and the server checks that the corresponding public key
871is authorized to accept the account.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100872.Pp
Damien Millerc93a8132005-12-24 14:52:13 +1100873The user creates his/her key pair by running
Darren Tuckerd3877b92005-12-20 16:09:36 +1100874.Xr ssh-keygen 1 .
875This stores the private key in
876.Pa ~/.ssh/identity
Damien Millerc93a8132005-12-24 14:52:13 +1100877(protocol 1),
878.Pa ~/.ssh/id_dsa
879(protocol 2 DSA),
Damien Millereb8b60e2010-08-31 22:41:14 +1000880.Pa ~/.ssh/id_ecdsa
881(protocol 2 ECDSA),
Damien Miller8ba0ead2013-12-18 17:46:27 +1100882.Pa ~/.ssh/id_ed25519
sobrado@openbsd.orgf70b22b2014-08-30 15:33:50 +0000883(protocol 2 Ed25519),
Damien Millerc93a8132005-12-24 14:52:13 +1100884or
885.Pa ~/.ssh/id_rsa
886(protocol 2 RSA)
Darren Tuckerd3877b92005-12-20 16:09:36 +1100887and stores the public key in
888.Pa ~/.ssh/identity.pub
Damien Millerc93a8132005-12-24 14:52:13 +1100889(protocol 1),
890.Pa ~/.ssh/id_dsa.pub
891(protocol 2 DSA),
Damien Millereb8b60e2010-08-31 22:41:14 +1000892.Pa ~/.ssh/id_ecdsa.pub
893(protocol 2 ECDSA),
Damien Miller8ba0ead2013-12-18 17:46:27 +1100894.Pa ~/.ssh/id_ed25519.pub
sobrado@openbsd.orgf70b22b2014-08-30 15:33:50 +0000895(protocol 2 Ed25519),
Damien Millerc93a8132005-12-24 14:52:13 +1100896or
897.Pa ~/.ssh/id_rsa.pub
898(protocol 2 RSA)
Darren Tuckerd3877b92005-12-20 16:09:36 +1100899in the user's home directory.
Damien Millerc93a8132005-12-24 14:52:13 +1100900The user should then copy the public key
Darren Tuckerd3877b92005-12-20 16:09:36 +1100901to
902.Pa ~/.ssh/authorized_keys
Damien Millerc93a8132005-12-24 14:52:13 +1100903in his/her home directory on the remote machine.
904The
Darren Tuckerd3877b92005-12-20 16:09:36 +1100905.Pa authorized_keys
906file corresponds to the conventional
907.Pa ~/.rhosts
908file, and has one key
Damien Millerc93a8132005-12-24 14:52:13 +1100909per line, though the lines can be very long.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100910After this, the user can log in without giving the password.
911.Pp
Damien Miller922b5412010-03-05 21:30:54 +1100912A variation on public key authentication
913is available in the form of certificate authentication:
914instead of a set of public/private keys,
915signed certificates are used.
916This has the advantage that a single trusted certification authority
917can be used in place of many public/private keys.
Damien Millerfecfd112013-07-18 16:11:50 +1000918See the CERTIFICATES section of
Damien Miller922b5412010-03-05 21:30:54 +1100919.Xr ssh-keygen 1
920for more information.
921.Pp
922The most convenient way to use public key or certificate authentication
923may be with an authentication agent.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100924See
925.Xr ssh-agent 1
926for more information.
927.Pp
Damien Millerc93a8132005-12-24 14:52:13 +1100928Challenge-response authentication works as follows:
929The server sends an arbitrary
930.Qq challenge
931text, and prompts for a response.
932Protocol 2 allows multiple challenges and responses;
933protocol 1 is restricted to just one challenge/response.
934Examples of challenge-response authentication include
Damien Millerb7727df2013-08-21 02:43:49 +1000935.Bx
936Authentication (see
Damien Millerc93a8132005-12-24 14:52:13 +1100937.Xr login.conf 5 )
Damien Millerb7727df2013-08-21 02:43:49 +1000938and PAM (some
939.Pf non- Ox
940systems).
Damien Millerc93a8132005-12-24 14:52:13 +1100941.Pp
942Finally, if other authentication methods fail,
Darren Tuckerd3877b92005-12-20 16:09:36 +1100943.Nm
944prompts the user for a password.
945The password is sent to the remote
946host for checking; however, since all communications are encrypted,
947the password cannot be seen by someone listening on the network.
Damien Miller48c94ab2006-01-02 23:38:00 +1100948.Pp
949.Nm
950automatically maintains and checks a database containing
951identification for all hosts it has ever been used with.
952Host keys are stored in
953.Pa ~/.ssh/known_hosts
954in the user's home directory.
955Additionally, the file
956.Pa /etc/ssh/ssh_known_hosts
957is automatically checked for known hosts.
958Any new hosts are automatically added to the user's file.
959If a host's identification ever changes,
960.Nm
961warns about this and disables password authentication to prevent
962server spoofing or man-in-the-middle attacks,
963which could otherwise be used to circumvent the encryption.
964The
965.Cm StrictHostKeyChecking
966option can be used to control logins to machines whose
967host key is not known or has changed.
968.Pp
Darren Tuckerd3877b92005-12-20 16:09:36 +1100969When the user's identity has been accepted by the server, the server
dtucker@openbsd.orgf8484da2015-05-06 05:45:17 +0000970either executes the given command in a non-interactive session or,
971if no command has been specified, logs into the machine and gives
972the user a normal shell as an interactive session.
Darren Tuckerd3877b92005-12-20 16:09:36 +1100973All communication with
974the remote command or shell will be automatically encrypted.
975.Pp
dtucker@openbsd.orgf8484da2015-05-06 05:45:17 +0000976If an interactive session is requested
977.Nm
978by default will only request a pseudo-terminal (pty) for interactive
979sessions when the client has one.
980The flags
981.Fl T
982and
983.Fl t
984can be used to override this behaviour.
985.Pp
986If a pseudo-terminal has been allocated the
Darren Tuckerd3877b92005-12-20 16:09:36 +1100987user may use the escape characters noted below.
988.Pp
dtucker@openbsd.orgf8484da2015-05-06 05:45:17 +0000989If no pseudo-terminal has been allocated,
Darren Tuckerd3877b92005-12-20 16:09:36 +1100990the session is transparent and can be used to reliably transfer binary data.
991On most systems, setting the escape character to
992.Dq none
993will also make the session transparent even if a tty is used.
994.Pp
995The session terminates when the command or shell on the remote
Damien Miller8bfaf932006-01-14 10:09:30 +1100996machine exits and all X11 and TCP connections have been closed.
Damien Miller52d20612005-12-24 14:52:36 +1100997.Sh ESCAPE CHARACTERS
Darren Tuckerd3877b92005-12-20 16:09:36 +1100998When a pseudo-terminal has been requested,
999.Nm
1000supports a number of functions through the use of an escape character.
1001.Pp
1002A single tilde character can be sent as
1003.Ic ~~
1004or by following the tilde by a character other than those described below.
1005The escape character must always follow a newline to be interpreted as
1006special.
1007The escape character can be changed in configuration files using the
1008.Cm EscapeChar
1009configuration directive or on the command line by the
1010.Fl e
1011option.
1012.Pp
1013The supported escapes (assuming the default
1014.Ql ~ )
1015are:
1016.Bl -tag -width Ds
1017.It Cm ~.
1018Disconnect.
1019.It Cm ~^Z
1020Background
Damien Miller1164c292006-01-02 23:38:37 +11001021.Nm .
Darren Tuckerd3877b92005-12-20 16:09:36 +11001022.It Cm ~#
1023List forwarded connections.
1024.It Cm ~&
1025Background
1026.Nm
1027at logout when waiting for forwarded connection / X11 sessions to terminate.
1028.It Cm ~?
1029Display a list of escape characters.
1030.It Cm ~B
1031Send a BREAK to the remote system
1032(only useful for SSH protocol version 2 and if the peer supports it).
1033.It Cm ~C
1034Open command line.
1035Currently this allows the addition of port forwardings using the
Damien Miller0164cb82008-11-05 16:30:31 +11001036.Fl L ,
Darren Tuckerd3877b92005-12-20 16:09:36 +11001037.Fl R
Damien Miller0164cb82008-11-05 16:30:31 +11001038and
1039.Fl D
Damien Miller329cb012005-12-24 14:53:23 +11001040options (see above).
Damien Millerff773642011-09-22 21:39:48 +10001041It also allows the cancellation of existing port-forwardings
1042with
Damien Miller57e8ad32006-07-10 20:20:52 +10001043.Sm off
Damien Millerff773642011-09-22 21:39:48 +10001044.Fl KL Oo Ar bind_address : Oc Ar port
Damien Miller57e8ad32006-07-10 20:20:52 +10001045.Sm on
Damien Millerff773642011-09-22 21:39:48 +10001046for local,
1047.Sm off
1048.Fl KR Oo Ar bind_address : Oc Ar port
1049.Sm on
1050for remote and
1051.Sm off
1052.Fl KD Oo Ar bind_address : Oc Ar port
1053.Sm on
1054for dynamic port-forwardings.
Darren Tuckerd3877b92005-12-20 16:09:36 +11001055.Ic !\& Ns Ar command
1056allows the user to execute a local command if the
1057.Ic PermitLocalCommand
1058option is enabled in
1059.Xr ssh_config 5 .
1060Basic help is available, using the
1061.Fl h
1062option.
1063.It Cm ~R
1064Request rekeying of the connection
1065(only useful for SSH protocol version 2 and if the peer supports it).
Darren Tucker50a48d02012-09-06 21:25:37 +10001066.It Cm ~V
1067Decrease the verbosity
1068.Pq Ic LogLevel
1069when errors are being written to stderr.
1070.It Cm ~v
Darren Tucker83d0af62012-09-07 11:21:03 +10001071Increase the verbosity
Darren Tucker50a48d02012-09-06 21:25:37 +10001072.Pq Ic LogLevel
1073when errors are being written to stderr.
Darren Tuckerd3877b92005-12-20 16:09:36 +11001074.El
Damien Millerf3177182006-01-14 10:09:13 +11001075.Sh TCP FORWARDING
1076Forwarding of arbitrary TCP connections over the secure channel can
1077be specified either on the command line or in a configuration file.
1078One possible application of TCP forwarding is a secure connection to a
1079mail server; another is going through firewalls.
1080.Pp
1081In the example below, we look at encrypting communication between
1082an IRC client and server, even though the IRC server does not directly
1083support encrypted communications.
1084This works as follows:
1085the user connects to the remote host using
1086.Nm ,
1087specifying a port to be used to forward connections
1088to the remote server.
1089After that it is possible to start the service which is to be encrypted
1090on the client machine,
1091connecting to the same local port,
1092and
1093.Nm
1094will encrypt and forward the connection.
1095.Pp
1096The following example tunnels an IRC session from client machine
1097.Dq 127.0.0.1
1098(localhost)
1099to remote server
1100.Dq server.example.com :
1101.Bd -literal -offset 4n
1102$ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
1103$ irc -c '#users' -p 1234 pinky 127.0.0.1
1104.Ed
1105.Pp
1106This tunnels a connection to IRC server
1107.Dq server.example.com ,
1108joining channel
1109.Dq #users ,
1110nickname
1111.Dq pinky ,
1112using port 1234.
1113It doesn't matter which port is used,
1114as long as it's greater than 1023
1115(remember, only root can open sockets on privileged ports)
1116and doesn't conflict with any ports already in use.
1117The connection is forwarded to port 6667 on the remote server,
1118since that's the standard port for IRC services.
1119.Pp
1120The
1121.Fl f
1122option backgrounds
1123.Nm
1124and the remote command
1125.Dq sleep 10
1126is specified to allow an amount of time
1127(10 seconds, in the example)
1128to start the service which is to be tunnelled.
1129If no connections are made within the time specified,
1130.Nm
1131will exit.
Damien Millerf3177182006-01-14 10:09:13 +11001132.Sh X11 FORWARDING
Darren Tuckerd3877b92005-12-20 16:09:36 +11001133If the
1134.Cm ForwardX11
1135variable is set to
1136.Dq yes
1137(or see the description of the
Damien Millerd7f308f2005-12-24 14:55:16 +11001138.Fl X ,
1139.Fl x ,
Darren Tuckerd3877b92005-12-20 16:09:36 +11001140and
Damien Millerd7f308f2005-12-24 14:55:16 +11001141.Fl Y
Damien Miller9a765b22005-12-24 14:53:44 +11001142options above)
Darren Tuckerd3877b92005-12-20 16:09:36 +11001143and the user is using X11 (the
1144.Ev DISPLAY
1145environment variable is set), the connection to the X11 display is
1146automatically forwarded to the remote side in such a way that any X11
1147programs started from the shell (or command) will go through the
1148encrypted channel, and the connection to the real X server will be made
1149from the local machine.
1150The user should not manually set
1151.Ev DISPLAY .
1152Forwarding of X11 connections can be
1153configured on the command line or in configuration files.
1154.Pp
1155The
1156.Ev DISPLAY
1157value set by
1158.Nm
1159will point to the server machine, but with a display number greater than zero.
1160This is normal, and happens because
1161.Nm
1162creates a
1163.Dq proxy
1164X server on the server machine for forwarding the
1165connections over the encrypted channel.
1166.Pp
1167.Nm
1168will also automatically set up Xauthority data on the server machine.
1169For this purpose, it will generate a random authorization cookie,
1170store it in Xauthority on the server, and verify that any forwarded
1171connections carry this cookie and replace it by the real cookie when
1172the connection is opened.
1173The real authentication cookie is never
1174sent to the server machine (and no cookies are sent in the plain).
1175.Pp
1176If the
1177.Cm ForwardAgent
1178variable is set to
1179.Dq yes
1180(or see the description of the
1181.Fl A
1182and
1183.Fl a
Damien Miller9a765b22005-12-24 14:53:44 +11001184options above) and
Darren Tuckerd3877b92005-12-20 16:09:36 +11001185the user is using an authentication agent, the connection to the agent
1186is automatically forwarded to the remote side.
Damien Millerbbc59092006-01-31 21:46:51 +11001187.Sh VERIFYING HOST KEYS
1188When connecting to a server for the first time,
1189a fingerprint of the server's public key is presented to the user
1190(unless the option
1191.Cm StrictHostKeyChecking
1192has been disabled).
1193Fingerprints can be determined using
1194.Xr ssh-keygen 1 :
1195.Pp
1196.Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1197.Pp
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001198If the fingerprint is already known, it can be matched
1199and the key can be accepted or rejected.
djm@openbsd.orgf9487372015-05-22 05:28:45 +00001200If only legacy (MD5) fingerprints for the server are available, the
1201.Xr ssh-keygen 1
1202.Fl E
1203option may be used to downgrade the fingerprint algorithm to match.
1204.Pp
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001205Because of the difficulty of comparing host keys
djm@openbsd.org56d1c832014-12-21 22:27:55 +00001206just by looking at fingerprint strings,
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001207there is also support to compare host keys visually,
1208using
1209.Em random art .
1210By setting the
Damien Miller10288242008-06-30 00:04:03 +10001211.Cm VisualHostKey
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001212option to
Damien Miller10288242008-06-30 00:04:03 +10001213.Dq yes ,
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001214a small ASCII graphic gets displayed on every login to a server, no matter
1215if the session itself is interactive or not.
1216By learning the pattern a known server produces, a user can easily
1217find out that the host key has changed when a completely different pattern
1218is displayed.
1219Because these patterns are not unambiguous however, a pattern that looks
1220similar to the pattern remembered only gives a good probability that the
1221host key is the same, not guaranteed proof.
1222.Pp
1223To get a listing of the fingerprints along with their random art for
1224all known hosts, the following command line can be used:
1225.Pp
1226.Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1227.Pp
Damien Millerbbc59092006-01-31 21:46:51 +11001228If the fingerprint is unknown,
1229an alternative method of verification is available:
1230SSH fingerprints verified by DNS.
1231An additional resource record (RR),
1232SSHFP,
1233is added to a zonefile
1234and the connecting client is able to match the fingerprint
1235with that of the key presented.
1236.Pp
1237In this example, we are connecting a client to a server,
1238.Dq host.example.com .
1239The SSHFP resource records should first be added to the zonefile for
1240host.example.com:
1241.Bd -literal -offset indent
Damien Millera1b3d632006-03-26 00:07:02 +11001242$ ssh-keygen -r host.example.com.
Damien Millerbbc59092006-01-31 21:46:51 +11001243.Ed
1244.Pp
1245The output lines will have to be added to the zonefile.
1246To check that the zone is answering fingerprint queries:
1247.Pp
1248.Dl $ dig -t SSHFP host.example.com
1249.Pp
1250Finally the client connects:
1251.Bd -literal -offset indent
1252$ ssh -o "VerifyHostKeyDNS ask" host.example.com
1253[...]
1254Matching host key fingerprint found in DNS.
1255Are you sure you want to continue connecting (yes/no)?
1256.Ed
1257.Pp
1258See the
1259.Cm VerifyHostKeyDNS
1260option in
1261.Xr ssh_config 5
1262for more information.
Darren Tucker248dd132006-01-20 11:30:58 +11001263.Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1264.Nm
1265contains support for Virtual Private Network (VPN) tunnelling
1266using the
1267.Xr tun 4
1268network pseudo-device,
1269allowing two networks to be joined securely.
1270The
1271.Xr sshd_config 5
1272configuration option
1273.Cm PermitTunnel
1274controls whether the server supports this,
1275and at what level (layer 2 or 3 traffic).
1276.Pp
1277The following example would connect client network 10.0.50.0/24
Damien Miller3975ee22006-11-05 05:31:33 +11001278with remote network 10.0.99.0/24 using a point-to-point connection
1279from 10.1.1.1 to 10.1.1.2,
1280provided that the SSH server running on the gateway to the remote network,
1281at 192.168.1.15, allows it.
1282.Pp
1283On the client:
Darren Tucker248dd132006-01-20 11:30:58 +11001284.Bd -literal -offset indent
1285# ssh -f -w 0:1 192.168.1.15 true
Damien Miller3975ee22006-11-05 05:31:33 +11001286# ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1287# route add 10.0.99.0/24 10.1.1.2
1288.Ed
1289.Pp
1290On the server:
1291.Bd -literal -offset indent
1292# ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1293# route add 10.0.50.0/24 10.1.1.1
Darren Tucker248dd132006-01-20 11:30:58 +11001294.Ed
1295.Pp
1296Client access may be more finely tuned via the
1297.Pa /root/.ssh/authorized_keys
1298file (see below) and the
1299.Cm PermitRootLogin
1300server option.
Damien Millere93eaaa2006-03-15 11:05:59 +11001301The following entry would permit connections on
Darren Tucker248dd132006-01-20 11:30:58 +11001302.Xr tun 4
Damien Millere93eaaa2006-03-15 11:05:59 +11001303device 1 from user
Darren Tucker248dd132006-01-20 11:30:58 +11001304.Dq jane
Damien Millere93eaaa2006-03-15 11:05:59 +11001305and on tun device 2 from user
Darren Tucker248dd132006-01-20 11:30:58 +11001306.Dq john ,
1307if
1308.Cm PermitRootLogin
1309is set to
1310.Dq forced-commands-only :
1311.Bd -literal -offset 2n
1312tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
Damien Miller9f67a212006-03-15 11:05:35 +11001313tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
Darren Tucker248dd132006-01-20 11:30:58 +11001314.Ed
1315.Pp
Darren Tuckerffe88e12006-10-18 07:53:06 +10001316Since an SSH-based setup entails a fair amount of overhead,
Darren Tucker248dd132006-01-20 11:30:58 +11001317it may be more suited to temporary setups,
1318such as for wireless VPNs.
1319More permanent VPNs are better provided by tools such as
1320.Xr ipsecctl 8
1321and
1322.Xr isakmpd 8 .
Damien Miller32aa1441999-10-29 09:15:49 +10001323.Sh ENVIRONMENT
1324.Nm
1325will normally set the following environment variables:
Damien Miller6aa22902006-01-06 14:48:34 +11001326.Bl -tag -width "SSH_ORIGINAL_COMMAND"
Damien Miller32aa1441999-10-29 09:15:49 +10001327.It Ev DISPLAY
1328The
1329.Ev DISPLAY
Damien Miller7684ee12000-03-17 23:40:15 +11001330variable indicates the location of the X11 server.
Damien Miller22c77262000-04-13 12:26:34 +10001331It is automatically set by
Damien Miller32aa1441999-10-29 09:15:49 +10001332.Nm
1333to point to a value of the form
Damien Miller14af93e2006-01-02 23:38:21 +11001334.Dq hostname:n ,
1335where
1336.Dq hostname
1337indicates the host where the shell runs, and
1338.Sq n
1339is an integer \*(Ge 1.
Damien Miller7684ee12000-03-17 23:40:15 +11001340.Nm
1341uses this special value to forward X11 connections over the secure
1342channel.
Ben Lindstromc65e6a02001-04-23 13:02:16 +00001343The user should normally not set
1344.Ev DISPLAY
1345explicitly, as that
Damien Miller32aa1441999-10-29 09:15:49 +10001346will render the X11 connection insecure (and will require the user to
1347manually copy any required authorization cookies).
1348.It Ev HOME
1349Set to the path of the user's home directory.
1350.It Ev LOGNAME
1351Synonym for
1352.Ev USER ;
1353set for compatibility with systems that use this variable.
1354.It Ev MAIL
Ben Lindstrome59433d2001-09-12 16:41:37 +00001355Set to the path of the user's mailbox.
Damien Miller7684ee12000-03-17 23:40:15 +11001356.It Ev PATH
Damien Miller32aa1441999-10-29 09:15:49 +10001357Set to the default
1358.Ev PATH ,
1359as specified when compiling
Damien Miller1164c292006-01-02 23:38:37 +11001360.Nm .
Ben Lindstrom5bf5d672001-07-04 04:31:38 +00001361.It Ev SSH_ASKPASS
1362If
1363.Nm
1364needs a passphrase, it will read the passphrase from the current
1365terminal if it was run from a terminal.
1366If
1367.Nm
1368does not have a terminal associated with it but
1369.Ev DISPLAY
1370and
1371.Ev SSH_ASKPASS
1372are set, it will execute the program specified by
1373.Ev SSH_ASKPASS
1374and open an X11 window to read the passphrase.
1375This is particularly useful when calling
1376.Nm
1377from a
Darren Tucker4e4fe002004-11-05 20:01:03 +11001378.Pa .xsession
Ben Lindstrom5bf5d672001-07-04 04:31:38 +00001379or related script.
1380(Note that on some machines it
1381may be necessary to redirect the input from
1382.Pa /dev/null
1383to make this work.)
Damien Miller32aa1441999-10-29 09:15:49 +10001384.It Ev SSH_AUTH_SOCK
Damien Miller14af93e2006-01-02 23:38:21 +11001385Identifies the path of a
1386.Ux Ns -domain
1387socket used to communicate with the agent.
Damien Millerf37e2462002-09-19 11:47:55 +10001388.It Ev SSH_CONNECTION
1389Identifies the client and server ends of the connection.
Damien Miller7684ee12000-03-17 23:40:15 +11001390The variable contains
Damien Miller14af93e2006-01-02 23:38:21 +11001391four space-separated values: client IP address, client port number,
1392server IP address, and server port number.
Ben Lindstrom4dccfa52000-12-28 16:40:05 +00001393.It Ev SSH_ORIGINAL_COMMAND
Damien Miller14af93e2006-01-02 23:38:21 +11001394This variable contains the original command line if a forced command
Ben Lindstrom4dccfa52000-12-28 16:40:05 +00001395is executed.
1396It can be used to extract the original arguments.
Damien Miller32aa1441999-10-29 09:15:49 +10001397.It Ev SSH_TTY
1398This is set to the name of the tty (path to the device) associated
Damien Miller7684ee12000-03-17 23:40:15 +11001399with the current shell or command.
1400If the current session has no tty,
Damien Miller32aa1441999-10-29 09:15:49 +10001401this variable is not set.
1402.It Ev TZ
Damien Miller6dbdb6a2005-12-13 19:25:43 +11001403This variable is set to indicate the present time zone if it
Damien Miller208f1ed2006-03-15 11:56:03 +11001404was set when the daemon was started (i.e. the daemon passes the value
Damien Miller32aa1441999-10-29 09:15:49 +10001405on to new connections).
1406.It Ev USER
1407Set to the name of the user logging in.
1408.El
1409.Pp
Damien Miller22c77262000-04-13 12:26:34 +10001410Additionally,
Damien Miller32aa1441999-10-29 09:15:49 +10001411.Nm
Damien Miller22c77262000-04-13 12:26:34 +10001412reads
Damien Miller167ea5d2005-05-26 12:04:02 +10001413.Pa ~/.ssh/environment ,
Damien Miller32aa1441999-10-29 09:15:49 +10001414and adds lines of the format
1415.Dq VARNAME=value
Damien Miller14af93e2006-01-02 23:38:21 +11001416to the environment if the file exists and users are allowed to
Ben Lindstromdc7adf22002-08-20 18:38:02 +00001417change their environment.
Darren Tucker61776952003-10-02 16:19:47 +10001418For more information, see the
Ben Lindstromdc7adf22002-08-20 18:38:02 +00001419.Cm PermitUserEnvironment
Ben Lindstrombd9bf382002-08-20 18:54:20 +00001420option in
Ben Lindstromdc7adf22002-08-20 18:38:02 +00001421.Xr sshd_config 5 .
Damien Miller32aa1441999-10-29 09:15:49 +10001422.Sh FILES
Damien Miller7655f5c2006-01-06 14:48:18 +11001423.Bl -tag -width Ds -compact
Damien Millerafdae612010-08-31 22:31:14 +10001424.It Pa ~/.rhosts
Damien Miller1bcdb502006-01-06 14:49:38 +11001425This file is used for host-based authentication (see above).
Ben Lindstromebd888d2001-03-05 05:49:29 +00001426On some machines this file may need to be
Damien Miller1bcdb502006-01-06 14:49:38 +11001427world-readable if the user's home directory is on an NFS partition,
Damien Miller32aa1441999-10-29 09:15:49 +10001428because
1429.Xr sshd 8
Damien Miller7684ee12000-03-17 23:40:15 +11001430reads it as root.
1431Additionally, this file must be owned by the user,
1432and must not have write permissions for anyone else.
1433The recommended
Damien Miller32aa1441999-10-29 09:15:49 +10001434permission for most machines is read/write for the user, and not
1435accessible by others.
1436.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001437.It Pa ~/.shosts
Damien Miller1bcdb502006-01-06 14:49:38 +11001438This file is used in exactly the same way as
1439.Pa .rhosts ,
1440but allows host-based authentication without permitting login with
1441rlogin/rsh.
Damien Miller7655f5c2006-01-06 14:48:18 +11001442.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001443.It Pa ~/.ssh/
Damien Miller520e6152008-02-10 22:46:22 +11001444This directory is the default location for all user-specific configuration
1445and authentication information.
1446There is no general requirement to keep the entire contents of this directory
1447secret, but the recommended permissions are read/write/execute for the user,
1448and not accessible by others.
1449.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001450.It Pa ~/.ssh/authorized_keys
sobrado@openbsd.orgf70b22b2014-08-30 15:33:50 +00001451Lists the public keys (DSA, ECDSA, Ed25519, RSA)
Damien Miller8ba0ead2013-12-18 17:46:27 +11001452that can be used for logging in as this user.
Damien Millerfb8ea742006-01-06 14:48:52 +11001453The format of this file is described in the
1454.Xr sshd 8
1455manual page.
Damien Millerfb8ea742006-01-06 14:48:52 +11001456This file is not highly sensitive, but the recommended
1457permissions are read/write for the user, and not accessible by others.
1458.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001459.It Pa ~/.ssh/config
Damien Millerfb8ea742006-01-06 14:48:52 +11001460This is the per-user configuration file.
1461The file format and configuration options are described in
1462.Xr ssh_config 5 .
1463Because of the potential for abuse, this file must have strict permissions:
Damien Millerd93340c2013-07-18 16:14:34 +10001464read/write for the user, and not writable by others.
Damien Millerfb8ea742006-01-06 14:48:52 +11001465.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001466.It Pa ~/.ssh/environment
Damien Miller4c102ee2006-01-06 14:49:17 +11001467Contains additional definitions for environment variables; see
1468.Sx ENVIRONMENT ,
Damien Millerfb8ea742006-01-06 14:48:52 +11001469above.
1470.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001471.It Pa ~/.ssh/identity
1472.It Pa ~/.ssh/id_dsa
Damien Millereb8b60e2010-08-31 22:41:14 +10001473.It Pa ~/.ssh/id_ecdsa
Damien Miller8ba0ead2013-12-18 17:46:27 +11001474.It Pa ~/.ssh/id_ed25519
Damien Millerafdae612010-08-31 22:31:14 +10001475.It Pa ~/.ssh/id_rsa
Damien Millerfb8ea742006-01-06 14:48:52 +11001476Contains the private key for authentication.
1477These files
1478contain sensitive data and should be readable by the user but not
1479accessible by others (read/write/execute).
1480.Nm
1481will simply ignore a private key file if it is accessible by others.
1482It is possible to specify a passphrase when
1483generating the key which will be used to encrypt the
1484sensitive part of this file using 3DES.
1485.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001486.It Pa ~/.ssh/identity.pub
1487.It Pa ~/.ssh/id_dsa.pub
Damien Millereb8b60e2010-08-31 22:41:14 +10001488.It Pa ~/.ssh/id_ecdsa.pub
Damien Miller8ba0ead2013-12-18 17:46:27 +11001489.It Pa ~/.ssh/id_ed25519.pub
Damien Millerafdae612010-08-31 22:31:14 +10001490.It Pa ~/.ssh/id_rsa.pub
Damien Millerfb8ea742006-01-06 14:48:52 +11001491Contains the public key for authentication.
1492These files are not
1493sensitive and can (but need not) be readable by anyone.
Damien Millerfb8ea742006-01-06 14:48:52 +11001494.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001495.It Pa ~/.ssh/known_hosts
Damien Millere87eb4c2006-01-14 10:08:36 +11001496Contains a list of host keys for all hosts the user has logged into
1497that are not already in the systemwide list of known host keys.
Damien Millerfb8ea742006-01-06 14:48:52 +11001498See
Damien Millere87eb4c2006-01-14 10:08:36 +11001499.Xr sshd 8
1500for further details of the format of this file.
Damien Millerfb8ea742006-01-06 14:48:52 +11001501.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001502.It Pa ~/.ssh/rc
Damien Millerfb8ea742006-01-06 14:48:52 +11001503Commands in this file are executed by
1504.Nm
Damien Miller7e76e1f2006-01-14 10:08:57 +11001505when the user logs in, just before the user's shell (or command) is
Damien Millerfb8ea742006-01-06 14:48:52 +11001506started.
1507See the
1508.Xr sshd 8
1509manual page for more information.
1510.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001511.It Pa /etc/hosts.equiv
Damien Miller1bcdb502006-01-06 14:49:38 +11001512This file is for host-based authentication (see above).
1513It should only be writable by root.
Damien Miller7655f5c2006-01-06 14:48:18 +11001514.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001515.It Pa /etc/shosts.equiv
Damien Miller1bcdb502006-01-06 14:49:38 +11001516This file is used in exactly the same way as
1517.Pa hosts.equiv ,
1518but allows host-based authentication without permitting login with
1519rlogin/rsh.
Damien Miller7655f5c2006-01-06 14:48:18 +11001520.Pp
Damien Millerfb8ea742006-01-06 14:48:52 +11001521.It Pa /etc/ssh/ssh_config
1522Systemwide configuration file.
1523The file format and configuration options are described in
1524.Xr ssh_config 5 .
1525.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001526.It Pa /etc/ssh/ssh_host_key
1527.It Pa /etc/ssh/ssh_host_dsa_key
Damien Millereb8b60e2010-08-31 22:41:14 +10001528.It Pa /etc/ssh/ssh_host_ecdsa_key
Damien Miller8ba0ead2013-12-18 17:46:27 +11001529.It Pa /etc/ssh/ssh_host_ed25519_key
Damien Millerafdae612010-08-31 22:31:14 +10001530.It Pa /etc/ssh/ssh_host_rsa_key
Damien Millerb9902cf2012-06-20 21:52:58 +10001531These files contain the private parts of the host keys
Damien Miller7e76e1f2006-01-14 10:08:57 +11001532and are used for host-based authentication.
1533If protocol version 1 is used,
Damien Millerfb8ea742006-01-06 14:48:52 +11001534.Nm
1535must be setuid root, since the host key is readable only by root.
1536For protocol version 2,
1537.Nm
1538uses
1539.Xr ssh-keysign 8
Damien Miller7e76e1f2006-01-14 10:08:57 +11001540to access the host keys,
1541eliminating the requirement that
Damien Millerfb8ea742006-01-06 14:48:52 +11001542.Nm
Damien Miller7e76e1f2006-01-14 10:08:57 +11001543be setuid root when host-based authentication is used.
Damien Millerfb8ea742006-01-06 14:48:52 +11001544By default
1545.Nm
1546is not setuid root.
1547.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001548.It Pa /etc/ssh/ssh_known_hosts
Damien Millerfb8ea742006-01-06 14:48:52 +11001549Systemwide list of known host keys.
1550This file should be prepared by the
1551system administrator to contain the public host keys of all machines in the
1552organization.
Damien Millere87eb4c2006-01-14 10:08:36 +11001553It should be world-readable.
1554See
Damien Millerfb8ea742006-01-06 14:48:52 +11001555.Xr sshd 8
Damien Millere87eb4c2006-01-14 10:08:36 +11001556for further details of the format of this file.
Damien Millerfb8ea742006-01-06 14:48:52 +11001557.Pp
Damien Millerafdae612010-08-31 22:31:14 +10001558.It Pa /etc/ssh/sshrc
Damien Miller32aa1441999-10-29 09:15:49 +10001559Commands in this file are executed by
1560.Nm
Damien Miller7e76e1f2006-01-14 10:08:57 +11001561when the user logs in, just before the user's shell (or command) is started.
Damien Miller32aa1441999-10-29 09:15:49 +10001562See the
1563.Xr sshd 8
1564manual page for more information.
Damien Miller7b28dc52000-09-05 13:34:53 +11001565.El
Damien Millerdaa7b222010-09-10 11:19:33 +10001566.Sh EXIT STATUS
1567.Nm
1568exits with the exit status of the remote command or with 255
1569if an error occurred.
Damien Miller32aa1441999-10-29 09:15:49 +10001570.Sh SEE ALSO
Damien Miller32aa1441999-10-29 09:15:49 +10001571.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +11001572.Xr sftp 1 ,
Damien Miller32aa1441999-10-29 09:15:49 +10001573.Xr ssh-add 1 ,
1574.Xr ssh-agent 1 ,
1575.Xr ssh-keygen 1 ,
Damien Miller128a0f12006-01-06 14:50:11 +11001576.Xr ssh-keyscan 1 ,
Darren Tucker248dd132006-01-20 11:30:58 +11001577.Xr tun 4 ,
Ben Lindstrombf69e3b2002-06-23 00:31:24 +00001578.Xr ssh_config 5 ,
Ben Lindstromc001cd32002-06-23 00:32:11 +00001579.Xr ssh-keysign 8 ,
Ben Lindstrom5ab6ae12001-02-10 22:08:03 +00001580.Xr sshd 8
Darren Tucker628a3fd2012-10-05 10:50:15 +10001581.Sh STANDARDS
Ben Lindstrom160ec622001-04-22 17:17:46 +00001582.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001583.%A S. Lehtinen
1584.%A C. Lonvick
1585.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001586.%R RFC 4250
Darren Tucker628a3fd2012-10-05 10:50:15 +10001587.%T The Secure Shell (SSH) Protocol Assigned Numbers
Damien Miller39a93a32006-03-15 11:34:45 +11001588.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001589.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001590.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001591.%A T. Ylonen
1592.%A C. Lonvick
1593.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001594.%R RFC 4251
Darren Tucker628a3fd2012-10-05 10:50:15 +10001595.%T The Secure Shell (SSH) Protocol Architecture
Damien Miller39a93a32006-03-15 11:34:45 +11001596.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001597.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001598.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001599.%A T. Ylonen
1600.%A C. Lonvick
1601.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001602.%R RFC 4252
Darren Tucker628a3fd2012-10-05 10:50:15 +10001603.%T The Secure Shell (SSH) Authentication Protocol
Damien Miller39a93a32006-03-15 11:34:45 +11001604.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001605.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001606.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001607.%A T. Ylonen
1608.%A C. Lonvick
1609.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001610.%R RFC 4253
Darren Tucker628a3fd2012-10-05 10:50:15 +10001611.%T The Secure Shell (SSH) Transport Layer Protocol
Damien Miller39a93a32006-03-15 11:34:45 +11001612.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001613.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001614.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001615.%A T. Ylonen
1616.%A C. Lonvick
1617.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001618.%R RFC 4254
Darren Tucker628a3fd2012-10-05 10:50:15 +10001619.%T The Secure Shell (SSH) Connection Protocol
Damien Miller39a93a32006-03-15 11:34:45 +11001620.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001621.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001622.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001623.%A J. Schlyter
1624.%A W. Griffin
1625.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001626.%R RFC 4255
Darren Tucker628a3fd2012-10-05 10:50:15 +10001627.%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
Damien Miller39a93a32006-03-15 11:34:45 +11001628.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001629.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001630.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001631.%A F. Cusack
1632.%A M. Forssen
1633.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001634.%R RFC 4256
Darren Tucker628a3fd2012-10-05 10:50:15 +10001635.%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
Damien Miller39a93a32006-03-15 11:34:45 +11001636.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001637.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001638.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001639.%A J. Galbraith
1640.%A P. Remaker
1641.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001642.%R RFC 4335
Darren Tucker628a3fd2012-10-05 10:50:15 +10001643.%T The Secure Shell (SSH) Session Channel Break Extension
Damien Miller39a93a32006-03-15 11:34:45 +11001644.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001645.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001646.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001647.%A M. Bellare
1648.%A T. Kohno
1649.%A C. Namprempre
1650.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001651.%R RFC 4344
Darren Tucker628a3fd2012-10-05 10:50:15 +10001652.%T The Secure Shell (SSH) Transport Layer Encryption Modes
Damien Miller39a93a32006-03-15 11:34:45 +11001653.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001654.Pp
Damien Miller39a93a32006-03-15 11:34:45 +11001655.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001656.%A B. Harris
1657.%D January 2006
Damien Miller39a93a32006-03-15 11:34:45 +11001658.%R RFC 4345
Darren Tucker628a3fd2012-10-05 10:50:15 +10001659.%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
Ben Lindstrom160ec622001-04-22 17:17:46 +00001660.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001661.Pp
Damien Miller3e96d742006-03-25 23:39:29 +11001662.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001663.%A M. Friedl
1664.%A N. Provos
1665.%A W. Simpson
1666.%D March 2006
Damien Miller3e96d742006-03-25 23:39:29 +11001667.%R RFC 4419
Darren Tucker628a3fd2012-10-05 10:50:15 +10001668.%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
Damien Miller3e96d742006-03-25 23:39:29 +11001669.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001670.Pp
Damien Millerc0367fb2007-01-05 16:25:46 +11001671.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001672.%A J. Galbraith
1673.%A R. Thayer
1674.%D November 2006
Damien Millerc0367fb2007-01-05 16:25:46 +11001675.%R RFC 4716
Darren Tucker628a3fd2012-10-05 10:50:15 +10001676.%T The Secure Shell (SSH) Public Key File Format
Damien Millerc0367fb2007-01-05 16:25:46 +11001677.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001678.Pp
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001679.Rs
Darren Tucker628a3fd2012-10-05 10:50:15 +10001680.%A D. Stebila
1681.%A J. Green
1682.%D December 2009
Damien Miller1ca94692010-09-24 22:01:22 +10001683.%R RFC 5656
Darren Tucker628a3fd2012-10-05 10:50:15 +10001684.%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
Damien Miller1ca94692010-09-24 22:01:22 +10001685.Re
Darren Tucker628a3fd2012-10-05 10:50:15 +10001686.Pp
Damien Miller1ca94692010-09-24 22:01:22 +10001687.Rs
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001688.%A A. Perrig
1689.%A D. Song
1690.%D 1999
Darren Tucker628a3fd2012-10-05 10:50:15 +10001691.%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1692.%T Hash Visualization: a New Technique to improve Real-World Security
Darren Tuckerf6bffb12008-06-14 09:04:26 +10001693.Re
Damien Millerf1ce5052003-06-11 22:04:39 +10001694.Sh AUTHORS
1695OpenSSH is a derivative of the original and free
1696ssh 1.2.12 release by Tatu Ylonen.
1697Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1698Theo de Raadt and Dug Song
1699removed many bugs, re-added newer features and
1700created OpenSSH.
1701Markus Friedl contributed the support for SSH
1702protocol versions 1.5 and 2.0.