blob: 2ea0a2058d17a5901984ae31c3a6b3eadbbf03a0 [file] [log] [blame]
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001.\"
2.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
3.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4.\" All rights reserved
5.\"
6.\" 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".
11.\"
12.\" 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.
15.\"
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.
35.\"
Greg Hartmana2eb7b52016-02-03 09:59:44 -080036.\" $OpenBSD: ssh.1,v 1.361 2015/07/20 18:44:12 millert Exp $
37.Dd $Mdocdate: July 20 2015 $
Greg Hartmanbd77cf72015-02-25 13:21:06 -080038.Dt SSH 1
39.Os
40.Sh NAME
41.Nm ssh
42.Nd OpenSSH SSH client (remote login program)
43.Sh SYNOPSIS
44.Nm ssh
45.Bk -words
Adam Langleyd0592972015-03-30 14:49:51 -070046.Op Fl 1246AaCfGgKkMNnqsTtVvXxYy
Greg Hartmanbd77cf72015-02-25 13:21:06 -080047.Op Fl b Ar bind_address
48.Op Fl c Ar cipher_spec
49.Op Fl D Oo Ar bind_address : Oc Ns Ar port
Adam Langleyd0592972015-03-30 14:49:51 -070050.Op Fl E Ar log_file
Greg Hartmanbd77cf72015-02-25 13:21:06 -080051.Op Fl e Ar escape_char
52.Op Fl F Ar configfile
53.Op Fl I Ar pkcs11
54.Op Fl i Ar identity_file
Greg Hartmana2eb7b52016-02-03 09:59:44 -080055.Op Fl L Ar address
Greg Hartmanbd77cf72015-02-25 13:21:06 -080056.Op Fl l Ar login_name
57.Op Fl m Ar mac_spec
58.Op Fl O Ar ctl_cmd
59.Op Fl o Ar option
60.Op Fl p Ar port
Adam Langleyd0592972015-03-30 14:49:51 -070061.Op Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
Greg Hartmana2eb7b52016-02-03 09:59:44 -080062.Op Fl R Ar address
Greg Hartmanbd77cf72015-02-25 13:21:06 -080063.Op Fl S Ar ctl_path
64.Op Fl W Ar host : Ns Ar port
65.Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
66.Oo Ar user Ns @ Oc Ns Ar hostname
67.Op Ar command
68.Ek
69.Sh DESCRIPTION
70.Nm
71(SSH client) is a program for logging into a remote machine and for
72executing commands on a remote machine.
73It is intended to replace rlogin and rsh,
74and provide secure encrypted communications between
75two untrusted hosts over an insecure network.
Adam Langleyd0592972015-03-30 14:49:51 -070076X11 connections, arbitrary TCP ports and
77.Ux Ns -domain
78sockets can also be forwarded over the secure channel.
Greg Hartmanbd77cf72015-02-25 13:21:06 -080079.Pp
80.Nm
81connects and logs into the specified
82.Ar hostname
83(with optional
84.Ar user
85name).
86The user must prove
87his/her identity to the remote machine using one of several methods
88depending on the protocol version used (see below).
89.Pp
90If
91.Ar command
92is specified,
93it is executed on the remote host instead of a login shell.
94.Pp
95The options are as follows:
Greg Hartmana2eb7b52016-02-03 09:59:44 -080096.Pp
97.Bl -tag -width Ds -compact
Greg Hartmanbd77cf72015-02-25 13:21:06 -080098.It Fl 1
99Forces
100.Nm
101to try protocol version 1 only.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800102.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800103.It Fl 2
104Forces
105.Nm
106to try protocol version 2 only.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800107.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800108.It Fl 4
109Forces
110.Nm
111to use IPv4 addresses only.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800112.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800113.It Fl 6
114Forces
115.Nm
116to use IPv6 addresses only.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800117.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800118.It Fl A
119Enables forwarding of the authentication agent connection.
120This can also be specified on a per-host basis in a configuration file.
121.Pp
122Agent forwarding should be enabled with caution.
123Users with the ability to bypass file permissions on the remote host
124(for the agent's
125.Ux Ns -domain
126socket) can access the local agent through the forwarded connection.
127An attacker cannot obtain key material from the agent,
128however they can perform operations on the keys that enable them to
129authenticate using the identities loaded into the agent.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800130.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800131.It Fl a
132Disables forwarding of the authentication agent connection.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800133.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800134.It Fl b Ar bind_address
135Use
136.Ar bind_address
137on the local machine as the source address
138of the connection.
139Only useful on systems with more than one address.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800140.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800141.It Fl C
142Requests compression of all data (including stdin, stdout, stderr, and
Adam Langleyd0592972015-03-30 14:49:51 -0700143data for forwarded X11, TCP and
144.Ux Ns -domain
145connections).
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800146The 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.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800159.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800160.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.
164The supported values are
165.Dq 3des ,
166.Dq blowfish ,
167and
168.Dq des .
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800169For protocol version 2,
170.Ar cipher_spec
171is a comma-separated list of ciphers
172listed in order of preference.
173See the
174.Cm Ciphers
175keyword in
176.Xr ssh_config 5
177for more information.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800178.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800179.It Fl D Xo
180.Sm off
181.Oo Ar bind_address : Oc
182.Ar port
183.Sm on
184.Xc
185Specifies a local
186.Dq dynamic
187application-level port forwarding.
188This works by allocating a socket to listen to
189.Ar port
190on the local side, optionally bound to the specified
191.Ar bind_address .
192Whenever a connection is made to this port, the
193connection 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.
201.Pp
202IPv6 addresses can be specified by enclosing the address in square brackets.
203Only 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.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800218.Pp
Adam Langleyd0592972015-03-30 14:49:51 -0700219.It Fl E Ar log_file
220Append debug logs to
221.Ar log_file
222instead of standard error.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800223.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800224.It Fl e Ar escape_char
225Sets the escape character for sessions with a pty (default:
226.Ql ~ ) .
227The escape character is only recognized at the beginning of a line.
228The escape character followed by a dot
229.Pq Ql \&.
230closes the connection;
231followed by control-Z suspends the connection;
232and followed by itself sends the escape character once.
233Setting the character to
234.Dq none
235disables any escapes and makes the session fully transparent.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800236.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800237.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
244.Pa ~/.ssh/config .
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800245.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800246.It Fl f
247Requests
248.Nm
249to go to background just before command execution.
250This is useful if
251.Nm
252is going to ask for passwords or passphrases, but the user
253wants it in the background.
254This implies
255.Fl n .
256The recommended way to start X11 programs at a remote site is with
257something like
258.Ic ssh -f host xterm .
259.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.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800268.Pp
Adam Langleyd0592972015-03-30 14:49:51 -0700269.It Fl G
270Causes
271.Nm
272to print its configuration after evaluating
273.Cm Host
274and
275.Cm Match
276blocks and exit.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800277.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800278.It Fl g
279Allows remote hosts to connect to local forwarded ports.
Adam Langleyd0592972015-03-30 14:49:51 -0700280If used on a multiplexed connection, then this option must be specified
281on the master process.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800282.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800283.It Fl I Ar pkcs11
284Specify the PKCS#11 shared library
285.Nm
286should use to communicate with a PKCS#11 token providing the user's
287private RSA key.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800288.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800289.It Fl i Ar identity_file
290Selects a file from which the identity (private key) for
291public key authentication is read.
292The default is
293.Pa ~/.ssh/identity
294for protocol version 1, and
295.Pa ~/.ssh/id_dsa ,
Adam Langleyd0592972015-03-30 14:49:51 -0700296.Pa ~/.ssh/id_ecdsa ,
297.Pa ~/.ssh/id_ed25519
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800298and
299.Pa ~/.ssh/id_rsa
300for protocol version 2.
301Identity files may also be specified on
302a per-host basis in the configuration file.
303It is possible to have multiple
304.Fl i
305options (and multiple identities specified in
306configuration files).
307.Nm
308will also try to load certificate information from the filename obtained
309by appending
310.Pa -cert.pub
311to identity filenames.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800312.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800313.It Fl K
314Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
315credentials to the server.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800316.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800317.It Fl k
318Disables forwarding (delegation) of GSSAPI credentials to the server.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800319.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800320.It Fl L Xo
321.Sm off
322.Oo Ar bind_address : Oc
323.Ar port : host : hostport
324.Sm on
325.Xc
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800326.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
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800346.Ar port
347on the local side, optionally bound to the specified
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800348.Ar bind_address ,
349or to a Unix socket.
350Whenever a connection is made to the local port or socket, the
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800351connection is forwarded over the secure channel, and a connection is
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800352made to either
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800353.Ar host
354port
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800355.Ar hostport ,
356or the Unix socket
357.Ar remote_socket ,
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800358from the remote machine.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800359.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800360Port forwardings can also be specified in the configuration file.
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800361Only the superuser can forward privileged ports.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800362IPv6 addresses can be specified by enclosing the address in square brackets.
363.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800364By 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
374indicates that the listening port be bound for local use only, while an
375empty address or
376.Sq *
377indicates that the port should be available from all interfaces.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800378.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800379.It Fl l Ar login_name
380Specifies the user to log in as on the remote machine.
381This also may be specified on a per-host basis in the configuration file.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800382.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800383.It Fl M
384Places the
385.Nm
386client into
387.Dq master
388mode for connection sharing.
389Multiple
390.Fl M
391options places
392.Nm
393into
394.Dq master
395mode with confirmation required before slave connections are accepted.
396Refer to the description of
397.Cm ControlMaster
398in
399.Xr ssh_config 5
400for details.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800401.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800402.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.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800409.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800410.It Fl N
411Do not execute a remote command.
412This is useful for just forwarding ports
413(protocol version 2 only).
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800414.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800415.It Fl n
416Redirects stdin from
417.Pa /dev/null
418(actually, prevents reading from stdin).
419This must be used when
420.Nm
421is run in the background.
422A common trick is to use this to run X11 programs on a remote machine.
423For example,
424.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.)
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800435.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800436.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
445(check that the master process is running),
446.Dq forward
447(request forwardings without command execution),
Adam Langleyd0592972015-03-30 14:49:51 -0700448.Dq cancel
449(cancel forwardings),
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800450.Dq exit
451(request the master to exit), and
452.Dq stop
453(request the master to stop accepting further multiplexing requests).
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800454.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800455.It Fl o Ar option
456Can be used to give options in the format used in the configuration file.
457This is useful for specifying options for which there is no separate
458command-line flag.
459For 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
Adam Langleyd0592972015-03-30 14:49:51 -0700466.It CanonicalDomains
467.It CanonicalizeFallbackLocal
468.It CanonicalizeHostname
469.It CanonicalizeMaxDots
470.It CanonicalizePermittedCNAMEs
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800471.It ChallengeResponseAuthentication
472.It CheckHostIP
473.It Cipher
474.It Ciphers
475.It ClearAllForwardings
476.It Compression
477.It CompressionLevel
478.It ConnectionAttempts
479.It ConnectTimeout
480.It ControlMaster
481.It ControlPath
Adam Langleyd0592972015-03-30 14:49:51 -0700482.It ControlPersist
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800483.It DynamicForward
484.It EscapeChar
485.It ExitOnForwardFailure
Adam Langleyd0592972015-03-30 14:49:51 -0700486.It FingerprintHash
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800487.It ForwardAgent
488.It ForwardX11
Adam Langleyd0592972015-03-30 14:49:51 -0700489.It ForwardX11Timeout
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800490.It ForwardX11Trusted
491.It GatewayPorts
492.It GlobalKnownHostsFile
493.It GSSAPIAuthentication
494.It GSSAPIDelegateCredentials
495.It HashKnownHosts
496.It Host
497.It HostbasedAuthentication
Adam Langleyd0592972015-03-30 14:49:51 -0700498.It HostbasedKeyTypes
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800499.It HostKeyAlgorithms
500.It HostKeyAlias
501.It HostName
502.It IdentityFile
503.It IdentitiesOnly
504.It IPQoS
Adam Langleyd0592972015-03-30 14:49:51 -0700505.It KbdInteractiveAuthentication
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800506.It KbdInteractiveDevices
507.It KexAlgorithms
508.It LocalCommand
509.It LocalForward
510.It LogLevel
511.It MACs
Adam Langleyd0592972015-03-30 14:49:51 -0700512.It Match
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800513.It NoHostAuthenticationForLocalhost
514.It NumberOfPasswordPrompts
515.It PasswordAuthentication
516.It PermitLocalCommand
517.It PKCS11Provider
518.It Port
519.It PreferredAuthentications
520.It Protocol
521.It ProxyCommand
Adam Langleyd0592972015-03-30 14:49:51 -0700522.It ProxyUseFdpass
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800523.It PubkeyAcceptedKeyTypes
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800524.It PubkeyAuthentication
525.It RekeyLimit
526.It RemoteForward
527.It RequestTTY
528.It RhostsRSAAuthentication
529.It RSAAuthentication
530.It SendEnv
531.It ServerAliveInterval
532.It ServerAliveCountMax
Adam Langleyd0592972015-03-30 14:49:51 -0700533.It StreamLocalBindMask
534.It StreamLocalBindUnlink
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800535.It StrictHostKeyChecking
536.It TCPKeepAlive
537.It Tunnel
538.It TunnelDevice
Adam Langleyd0592972015-03-30 14:49:51 -0700539.It UpdateHostKeys
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800540.It UsePrivilegedPort
541.It User
542.It UserKnownHostsFile
543.It VerifyHostKeyDNS
544.It VisualHostKey
545.It XAuthLocation
546.El
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800547.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800548.It Fl p Ar port
549Port to connect to on the remote host.
550This can be specified on a
551per-host basis in the configuration file.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800552.Pp
Adam Langleyd0592972015-03-30 14:49:51 -0700553.It Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
554Queries
555.Nm
556for the algorithms supported for the specified version 2.
557The available features are:
558.Ar cipher
559(supported symmetric ciphers),
560.Ar cipher-auth
561(supported symmetric ciphers that support authenticated encryption),
562.Ar mac
563(supported message integrity codes),
564.Ar kex
565(key exchange algorithms),
566.Ar key
567(key types) and
568.Ar protocol-version
569(supported SSH protocol versions).
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800570.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800571.It Fl q
572Quiet mode.
573Causes most warning and diagnostic messages to be suppressed.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800574.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800575.It Fl R Xo
576.Sm off
577.Oo Ar bind_address : Oc
578.Ar port : host : hostport
579.Sm on
580.Xc
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800581.It Fl R Xo
582.Sm off
583.Oo Ar bind_address : Oc
584.Ar port : local_socket
585.Sm on
586.Xc
587.It Fl R Xo
588.Sm off
589.Ar remote_socket : host : hostport
590.Sm on
591.Xc
592.It Fl R Xo
593.Sm off
594.Ar remote_socket : local_socket
595.Sm on
596.Xc
597Specifies that connections to the given TCP port or Unix socket on the remote
598(server) host are to be forwarded to the given host and port, or Unix socket,
599on the local side.
600This works by allocating a socket to listen to either a TCP
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800601.Ar port
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800602or to a Unix socket on the remote side.
603Whenever a connection is made to this port or Unix socket, the
604connection is forwarded over the secure channel, and a connection
605is made to either
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800606.Ar host
607port
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800608.Ar hostport ,
609or
610.Ar local_socket ,
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800611from the local machine.
612.Pp
613Port forwardings can also be specified in the configuration file.
614Privileged ports can be forwarded only when
615logging in as root on the remote machine.
Adam Langleyd0592972015-03-30 14:49:51 -0700616IPv6 addresses can be specified by enclosing the address in square brackets.
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800617.Pp
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800618By default, TCP listening sockets on the server will be bound to the loopback
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800619interface only.
620This may be overridden by specifying a
621.Ar bind_address .
622An empty
623.Ar bind_address ,
624or the address
625.Ql * ,
626indicates that the remote socket should listen on all interfaces.
627Specifying a remote
628.Ar bind_address
629will only succeed if the server's
630.Cm GatewayPorts
631option is enabled (see
632.Xr sshd_config 5 ) .
633.Pp
634If the
635.Ar port
636argument is
637.Ql 0 ,
638the listen port will be dynamically allocated on the server and reported
639to the client at run time.
640When used together with
641.Ic -O forward
642the allocated port will be printed to the standard output.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800643.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800644.It Fl S Ar ctl_path
645Specifies the location of a control socket for connection sharing,
646or the string
647.Dq none
648to disable connection sharing.
649Refer to the description of
650.Cm ControlPath
651and
652.Cm ControlMaster
653in
654.Xr ssh_config 5
655for details.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800656.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800657.It Fl s
658May be used to request invocation of a subsystem on the remote system.
659Subsystems are a feature of the SSH2 protocol which facilitate the use
660of SSH as a secure transport for other applications (eg.\&
661.Xr sftp 1 ) .
662The subsystem is specified as the remote command.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800663.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800664.It Fl T
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800665Disable pseudo-terminal allocation.
666.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800667.It Fl t
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800668Force pseudo-terminal allocation.
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800669This can be used to execute arbitrary
670screen-based programs on a remote machine, which can be very useful,
671e.g. when implementing menu services.
672Multiple
673.Fl t
674options force tty allocation, even if
675.Nm
676has no local tty.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800677.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800678.It Fl V
679Display the version number and exit.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800680.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800681.It Fl v
682Verbose mode.
683Causes
684.Nm
685to print debugging messages about its progress.
686This is helpful in
687debugging connection, authentication, and configuration problems.
688Multiple
689.Fl v
690options increase the verbosity.
691The maximum is 3.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800692.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800693.It Fl W Ar host : Ns Ar port
694Requests that standard input and output on the client be forwarded to
695.Ar host
696on
697.Ar port
698over the secure channel.
699Implies
700.Fl N ,
701.Fl T ,
702.Cm ExitOnForwardFailure
703and
Adam Langleyd0592972015-03-30 14:49:51 -0700704.Cm ClearAllForwardings .
705Works with Protocol version 2 only.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800706.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800707.It Fl w Xo
708.Ar local_tun Ns Op : Ns Ar remote_tun
709.Xc
710Requests
711tunnel
712device forwarding with the specified
713.Xr tun 4
714devices between the client
715.Pq Ar local_tun
716and the server
717.Pq Ar remote_tun .
718.Pp
719The devices may be specified by numerical ID or the keyword
720.Dq any ,
721which uses the next available tunnel device.
722If
723.Ar remote_tun
724is not specified, it defaults to
725.Dq any .
726See also the
727.Cm Tunnel
728and
729.Cm TunnelDevice
730directives in
731.Xr ssh_config 5 .
732If the
733.Cm Tunnel
734directive is unset, it is set to the default tunnel mode, which is
735.Dq point-to-point .
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800736.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800737.It Fl X
738Enables X11 forwarding.
739This can also be specified on a per-host basis in a configuration file.
740.Pp
741X11 forwarding should be enabled with caution.
742Users with the ability to bypass file permissions on the remote host
743(for the user's X authorization database)
744can access the local X11 display through the forwarded connection.
745An attacker may then be able to perform activities such as keystroke monitoring.
746.Pp
747For this reason, X11 forwarding is subjected to X11 SECURITY extension
748restrictions by default.
749Please refer to the
750.Nm
751.Fl Y
752option and the
753.Cm ForwardX11Trusted
754directive in
755.Xr ssh_config 5
756for more information.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800757.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800758.It Fl x
759Disables X11 forwarding.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800760.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800761.It Fl Y
762Enables trusted X11 forwarding.
763Trusted X11 forwardings are not subjected to the X11 SECURITY extension
764controls.
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800765.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800766.It Fl y
767Send log information using the
768.Xr syslog 3
769system module.
770By default this information is sent to stderr.
771.El
772.Pp
773.Nm
774may additionally obtain configuration data from
775a per-user configuration file and a system-wide configuration file.
776The file format and configuration options are described in
777.Xr ssh_config 5 .
778.Sh AUTHENTICATION
779The OpenSSH SSH client supports SSH protocols 1 and 2.
780The default is to use protocol 2 only,
781though this can be changed via the
782.Cm Protocol
783option in
784.Xr ssh_config 5
785or the
786.Fl 1
787and
788.Fl 2
789options (see above).
790Both protocols support similar authentication methods,
791but protocol 2 is the default since
792it provides additional mechanisms for confidentiality
793(the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
794and integrity (hmac-md5, hmac-sha1,
795hmac-sha2-256, hmac-sha2-512,
Adam Langleyd0592972015-03-30 14:49:51 -0700796umac-64, umac-128, hmac-ripemd160).
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800797Protocol 1 lacks a strong mechanism for ensuring the
798integrity of the connection.
799.Pp
800The methods available for authentication are:
801GSSAPI-based authentication,
802host-based authentication,
803public key authentication,
804challenge-response authentication,
805and password authentication.
806Authentication methods are tried in the order specified above,
807though protocol 2 has a configuration option to change the default order:
808.Cm PreferredAuthentications .
809.Pp
810Host-based authentication works as follows:
811If the machine the user logs in from is listed in
812.Pa /etc/hosts.equiv
813or
814.Pa /etc/shosts.equiv
815on the remote machine, and the user names are
816the same on both sides, or if the files
817.Pa ~/.rhosts
818or
819.Pa ~/.shosts
820exist in the user's home directory on the
821remote machine and contain a line containing the name of the client
822machine and the name of the user on that machine, the user is
823considered for login.
824Additionally, the server
825.Em must
826be able to verify the client's
827host key (see the description of
828.Pa /etc/ssh/ssh_known_hosts
829and
830.Pa ~/.ssh/known_hosts ,
831below)
832for login to be permitted.
833This authentication method closes security holes due to IP
834spoofing, DNS spoofing, and routing spoofing.
835[Note to the administrator:
836.Pa /etc/hosts.equiv ,
837.Pa ~/.rhosts ,
838and the rlogin/rsh protocol in general, are inherently insecure and should be
839disabled if security is desired.]
840.Pp
841Public key authentication works as follows:
842The scheme is based on public-key cryptography,
843using cryptosystems
844where encryption and decryption are done using separate keys,
845and it is unfeasible to derive the decryption key from the encryption key.
846The idea is that each user creates a public/private
847key pair for authentication purposes.
848The server knows the public key, and only the user knows the private key.
849.Nm
850implements public key authentication protocol automatically,
Adam Langleyd0592972015-03-30 14:49:51 -0700851using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800852Protocol 1 is restricted to using only RSA keys,
853but protocol 2 may use any.
Adam Langleyd0592972015-03-30 14:49:51 -0700854The HISTORY section of
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800855.Xr ssl 8
856contains a brief discussion of the DSA and RSA algorithms.
857.Pp
858The file
859.Pa ~/.ssh/authorized_keys
860lists the public keys that are permitted for logging in.
861When the user logs in, the
862.Nm
863program tells the server which key pair it would like to use for
864authentication.
865The client proves that it has access to the private key
866and the server checks that the corresponding public key
867is authorized to accept the account.
868.Pp
869The user creates his/her key pair by running
870.Xr ssh-keygen 1 .
871This stores the private key in
872.Pa ~/.ssh/identity
873(protocol 1),
874.Pa ~/.ssh/id_dsa
875(protocol 2 DSA),
876.Pa ~/.ssh/id_ecdsa
877(protocol 2 ECDSA),
Adam Langleyd0592972015-03-30 14:49:51 -0700878.Pa ~/.ssh/id_ed25519
879(protocol 2 Ed25519),
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800880or
881.Pa ~/.ssh/id_rsa
882(protocol 2 RSA)
883and stores the public key in
884.Pa ~/.ssh/identity.pub
885(protocol 1),
886.Pa ~/.ssh/id_dsa.pub
887(protocol 2 DSA),
888.Pa ~/.ssh/id_ecdsa.pub
889(protocol 2 ECDSA),
Adam Langleyd0592972015-03-30 14:49:51 -0700890.Pa ~/.ssh/id_ed25519.pub
891(protocol 2 Ed25519),
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800892or
893.Pa ~/.ssh/id_rsa.pub
894(protocol 2 RSA)
895in the user's home directory.
896The user should then copy the public key
897to
898.Pa ~/.ssh/authorized_keys
899in his/her home directory on the remote machine.
900The
901.Pa authorized_keys
902file corresponds to the conventional
903.Pa ~/.rhosts
904file, and has one key
905per line, though the lines can be very long.
906After this, the user can log in without giving the password.
907.Pp
908A variation on public key authentication
909is available in the form of certificate authentication:
910instead of a set of public/private keys,
911signed certificates are used.
912This has the advantage that a single trusted certification authority
913can be used in place of many public/private keys.
Adam Langleyd0592972015-03-30 14:49:51 -0700914See the CERTIFICATES section of
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800915.Xr ssh-keygen 1
916for more information.
917.Pp
918The most convenient way to use public key or certificate authentication
919may be with an authentication agent.
920See
921.Xr ssh-agent 1
922for more information.
923.Pp
924Challenge-response authentication works as follows:
925The server sends an arbitrary
926.Qq challenge
927text, and prompts for a response.
928Protocol 2 allows multiple challenges and responses;
929protocol 1 is restricted to just one challenge/response.
930Examples of challenge-response authentication include
Adam Langleyd0592972015-03-30 14:49:51 -0700931.Bx
932Authentication (see
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800933.Xr login.conf 5 )
Adam Langleyd0592972015-03-30 14:49:51 -0700934and PAM (some
935.Pf non- Ox
936systems).
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800937.Pp
938Finally, if other authentication methods fail,
939.Nm
940prompts the user for a password.
941The password is sent to the remote
942host for checking; however, since all communications are encrypted,
943the password cannot be seen by someone listening on the network.
944.Pp
945.Nm
946automatically maintains and checks a database containing
947identification for all hosts it has ever been used with.
948Host keys are stored in
949.Pa ~/.ssh/known_hosts
950in the user's home directory.
951Additionally, the file
952.Pa /etc/ssh/ssh_known_hosts
953is automatically checked for known hosts.
954Any new hosts are automatically added to the user's file.
955If a host's identification ever changes,
956.Nm
957warns about this and disables password authentication to prevent
958server spoofing or man-in-the-middle attacks,
959which could otherwise be used to circumvent the encryption.
960The
961.Cm StrictHostKeyChecking
962option can be used to control logins to machines whose
963host key is not known or has changed.
964.Pp
965When the user's identity has been accepted by the server, the server
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800966either executes the given command in a non-interactive session or,
967if no command has been specified, logs into the machine and gives
968the user a normal shell as an interactive session.
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800969All communication with
970the remote command or shell will be automatically encrypted.
971.Pp
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800972If an interactive session is requested
973.Nm
974by default will only request a pseudo-terminal (pty) for interactive
975sessions when the client has one.
976The flags
977.Fl T
978and
979.Fl t
980can be used to override this behaviour.
981.Pp
982If a pseudo-terminal has been allocated the
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800983user may use the escape characters noted below.
984.Pp
Greg Hartmana2eb7b52016-02-03 09:59:44 -0800985If no pseudo-terminal has been allocated,
Greg Hartmanbd77cf72015-02-25 13:21:06 -0800986the session is transparent and can be used to reliably transfer binary data.
987On most systems, setting the escape character to
988.Dq none
989will also make the session transparent even if a tty is used.
990.Pp
991The session terminates when the command or shell on the remote
992machine exits and all X11 and TCP connections have been closed.
993.Sh ESCAPE CHARACTERS
994When a pseudo-terminal has been requested,
995.Nm
996supports a number of functions through the use of an escape character.
997.Pp
998A single tilde character can be sent as
999.Ic ~~
1000or by following the tilde by a character other than those described below.
1001The escape character must always follow a newline to be interpreted as
1002special.
1003The escape character can be changed in configuration files using the
1004.Cm EscapeChar
1005configuration directive or on the command line by the
1006.Fl e
1007option.
1008.Pp
1009The supported escapes (assuming the default
1010.Ql ~ )
1011are:
1012.Bl -tag -width Ds
1013.It Cm ~.
1014Disconnect.
1015.It Cm ~^Z
1016Background
1017.Nm .
1018.It Cm ~#
1019List forwarded connections.
1020.It Cm ~&
1021Background
1022.Nm
1023at logout when waiting for forwarded connection / X11 sessions to terminate.
1024.It Cm ~?
1025Display a list of escape characters.
1026.It Cm ~B
1027Send a BREAK to the remote system
1028(only useful for SSH protocol version 2 and if the peer supports it).
1029.It Cm ~C
1030Open command line.
1031Currently this allows the addition of port forwardings using the
1032.Fl L ,
1033.Fl R
1034and
1035.Fl D
1036options (see above).
Adam Langleyd0592972015-03-30 14:49:51 -07001037It also allows the cancellation of existing port-forwardings
1038with
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001039.Sm off
Adam Langleyd0592972015-03-30 14:49:51 -07001040.Fl KL Oo Ar bind_address : Oc Ar port
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001041.Sm on
Adam Langleyd0592972015-03-30 14:49:51 -07001042for local,
1043.Sm off
1044.Fl KR Oo Ar bind_address : Oc Ar port
1045.Sm on
1046for remote and
1047.Sm off
1048.Fl KD Oo Ar bind_address : Oc Ar port
1049.Sm on
1050for dynamic port-forwardings.
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001051.Ic !\& Ns Ar command
1052allows the user to execute a local command if the
1053.Ic PermitLocalCommand
1054option is enabled in
1055.Xr ssh_config 5 .
1056Basic help is available, using the
1057.Fl h
1058option.
1059.It Cm ~R
1060Request rekeying of the connection
1061(only useful for SSH protocol version 2 and if the peer supports it).
Adam Langleyd0592972015-03-30 14:49:51 -07001062.It Cm ~V
1063Decrease the verbosity
1064.Pq Ic LogLevel
1065when errors are being written to stderr.
1066.It Cm ~v
1067Increase the verbosity
1068.Pq Ic LogLevel
1069when errors are being written to stderr.
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001070.El
1071.Sh TCP FORWARDING
1072Forwarding of arbitrary TCP connections over the secure channel can
1073be specified either on the command line or in a configuration file.
1074One possible application of TCP forwarding is a secure connection to a
1075mail server; another is going through firewalls.
1076.Pp
1077In the example below, we look at encrypting communication between
1078an IRC client and server, even though the IRC server does not directly
1079support encrypted communications.
1080This works as follows:
1081the user connects to the remote host using
1082.Nm ,
1083specifying a port to be used to forward connections
1084to the remote server.
1085After that it is possible to start the service which is to be encrypted
1086on the client machine,
1087connecting to the same local port,
1088and
1089.Nm
1090will encrypt and forward the connection.
1091.Pp
1092The following example tunnels an IRC session from client machine
1093.Dq 127.0.0.1
1094(localhost)
1095to remote server
1096.Dq server.example.com :
1097.Bd -literal -offset 4n
1098$ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
1099$ irc -c '#users' -p 1234 pinky 127.0.0.1
1100.Ed
1101.Pp
1102This tunnels a connection to IRC server
1103.Dq server.example.com ,
1104joining channel
1105.Dq #users ,
1106nickname
1107.Dq pinky ,
1108using port 1234.
1109It doesn't matter which port is used,
1110as long as it's greater than 1023
1111(remember, only root can open sockets on privileged ports)
1112and doesn't conflict with any ports already in use.
1113The connection is forwarded to port 6667 on the remote server,
1114since that's the standard port for IRC services.
1115.Pp
1116The
1117.Fl f
1118option backgrounds
1119.Nm
1120and the remote command
1121.Dq sleep 10
1122is specified to allow an amount of time
1123(10 seconds, in the example)
1124to start the service which is to be tunnelled.
1125If no connections are made within the time specified,
1126.Nm
1127will exit.
1128.Sh X11 FORWARDING
1129If the
1130.Cm ForwardX11
1131variable is set to
1132.Dq yes
1133(or see the description of the
1134.Fl X ,
1135.Fl x ,
1136and
1137.Fl Y
1138options above)
1139and the user is using X11 (the
1140.Ev DISPLAY
1141environment variable is set), the connection to the X11 display is
1142automatically forwarded to the remote side in such a way that any X11
1143programs started from the shell (or command) will go through the
1144encrypted channel, and the connection to the real X server will be made
1145from the local machine.
1146The user should not manually set
1147.Ev DISPLAY .
1148Forwarding of X11 connections can be
1149configured on the command line or in configuration files.
1150.Pp
1151The
1152.Ev DISPLAY
1153value set by
1154.Nm
1155will point to the server machine, but with a display number greater than zero.
1156This is normal, and happens because
1157.Nm
1158creates a
1159.Dq proxy
1160X server on the server machine for forwarding the
1161connections over the encrypted channel.
1162.Pp
1163.Nm
1164will also automatically set up Xauthority data on the server machine.
1165For this purpose, it will generate a random authorization cookie,
1166store it in Xauthority on the server, and verify that any forwarded
1167connections carry this cookie and replace it by the real cookie when
1168the connection is opened.
1169The real authentication cookie is never
1170sent to the server machine (and no cookies are sent in the plain).
1171.Pp
1172If the
1173.Cm ForwardAgent
1174variable is set to
1175.Dq yes
1176(or see the description of the
1177.Fl A
1178and
1179.Fl a
1180options above) and
1181the user is using an authentication agent, the connection to the agent
1182is automatically forwarded to the remote side.
1183.Sh VERIFYING HOST KEYS
1184When connecting to a server for the first time,
1185a fingerprint of the server's public key is presented to the user
1186(unless the option
1187.Cm StrictHostKeyChecking
1188has been disabled).
1189Fingerprints can be determined using
1190.Xr ssh-keygen 1 :
1191.Pp
1192.Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1193.Pp
1194If the fingerprint is already known, it can be matched
1195and the key can be accepted or rejected.
Greg Hartmana2eb7b52016-02-03 09:59:44 -08001196If only legacy (MD5) fingerprints for the server are available, the
1197.Xr ssh-keygen 1
1198.Fl E
1199option may be used to downgrade the fingerprint algorithm to match.
1200.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001201Because of the difficulty of comparing host keys
Adam Langleyd0592972015-03-30 14:49:51 -07001202just by looking at fingerprint strings,
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001203there is also support to compare host keys visually,
1204using
1205.Em random art .
1206By setting the
1207.Cm VisualHostKey
1208option to
1209.Dq yes ,
1210a small ASCII graphic gets displayed on every login to a server, no matter
1211if the session itself is interactive or not.
1212By learning the pattern a known server produces, a user can easily
1213find out that the host key has changed when a completely different pattern
1214is displayed.
1215Because these patterns are not unambiguous however, a pattern that looks
1216similar to the pattern remembered only gives a good probability that the
1217host key is the same, not guaranteed proof.
1218.Pp
1219To get a listing of the fingerprints along with their random art for
1220all known hosts, the following command line can be used:
1221.Pp
1222.Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1223.Pp
1224If the fingerprint is unknown,
1225an alternative method of verification is available:
1226SSH fingerprints verified by DNS.
1227An additional resource record (RR),
1228SSHFP,
1229is added to a zonefile
1230and the connecting client is able to match the fingerprint
1231with that of the key presented.
1232.Pp
1233In this example, we are connecting a client to a server,
1234.Dq host.example.com .
1235The SSHFP resource records should first be added to the zonefile for
1236host.example.com:
1237.Bd -literal -offset indent
1238$ ssh-keygen -r host.example.com.
1239.Ed
1240.Pp
1241The output lines will have to be added to the zonefile.
1242To check that the zone is answering fingerprint queries:
1243.Pp
1244.Dl $ dig -t SSHFP host.example.com
1245.Pp
1246Finally the client connects:
1247.Bd -literal -offset indent
1248$ ssh -o "VerifyHostKeyDNS ask" host.example.com
1249[...]
1250Matching host key fingerprint found in DNS.
1251Are you sure you want to continue connecting (yes/no)?
1252.Ed
1253.Pp
1254See the
1255.Cm VerifyHostKeyDNS
1256option in
1257.Xr ssh_config 5
1258for more information.
1259.Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1260.Nm
1261contains support for Virtual Private Network (VPN) tunnelling
1262using the
1263.Xr tun 4
1264network pseudo-device,
1265allowing two networks to be joined securely.
1266The
1267.Xr sshd_config 5
1268configuration option
1269.Cm PermitTunnel
1270controls whether the server supports this,
1271and at what level (layer 2 or 3 traffic).
1272.Pp
1273The following example would connect client network 10.0.50.0/24
1274with remote network 10.0.99.0/24 using a point-to-point connection
1275from 10.1.1.1 to 10.1.1.2,
1276provided that the SSH server running on the gateway to the remote network,
1277at 192.168.1.15, allows it.
1278.Pp
1279On the client:
1280.Bd -literal -offset indent
1281# ssh -f -w 0:1 192.168.1.15 true
1282# ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1283# route add 10.0.99.0/24 10.1.1.2
1284.Ed
1285.Pp
1286On the server:
1287.Bd -literal -offset indent
1288# ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1289# route add 10.0.50.0/24 10.1.1.1
1290.Ed
1291.Pp
1292Client access may be more finely tuned via the
1293.Pa /root/.ssh/authorized_keys
1294file (see below) and the
1295.Cm PermitRootLogin
1296server option.
1297The following entry would permit connections on
1298.Xr tun 4
1299device 1 from user
1300.Dq jane
1301and on tun device 2 from user
1302.Dq john ,
1303if
1304.Cm PermitRootLogin
1305is set to
1306.Dq forced-commands-only :
1307.Bd -literal -offset 2n
1308tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1309tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1310.Ed
1311.Pp
1312Since an SSH-based setup entails a fair amount of overhead,
1313it may be more suited to temporary setups,
1314such as for wireless VPNs.
1315More permanent VPNs are better provided by tools such as
1316.Xr ipsecctl 8
1317and
1318.Xr isakmpd 8 .
1319.Sh ENVIRONMENT
1320.Nm
1321will normally set the following environment variables:
1322.Bl -tag -width "SSH_ORIGINAL_COMMAND"
1323.It Ev DISPLAY
1324The
1325.Ev DISPLAY
1326variable indicates the location of the X11 server.
1327It is automatically set by
1328.Nm
1329to point to a value of the form
1330.Dq hostname:n ,
1331where
1332.Dq hostname
1333indicates the host where the shell runs, and
1334.Sq n
1335is an integer \*(Ge 1.
1336.Nm
1337uses this special value to forward X11 connections over the secure
1338channel.
1339The user should normally not set
1340.Ev DISPLAY
1341explicitly, as that
1342will render the X11 connection insecure (and will require the user to
1343manually copy any required authorization cookies).
1344.It Ev HOME
1345Set to the path of the user's home directory.
1346.It Ev LOGNAME
1347Synonym for
1348.Ev USER ;
1349set for compatibility with systems that use this variable.
1350.It Ev MAIL
1351Set to the path of the user's mailbox.
1352.It Ev PATH
1353Set to the default
1354.Ev PATH ,
1355as specified when compiling
1356.Nm .
1357.It Ev SSH_ASKPASS
1358If
1359.Nm
1360needs a passphrase, it will read the passphrase from the current
1361terminal if it was run from a terminal.
1362If
1363.Nm
1364does not have a terminal associated with it but
1365.Ev DISPLAY
1366and
1367.Ev SSH_ASKPASS
1368are set, it will execute the program specified by
1369.Ev SSH_ASKPASS
1370and open an X11 window to read the passphrase.
1371This is particularly useful when calling
1372.Nm
1373from a
1374.Pa .xsession
1375or related script.
1376(Note that on some machines it
1377may be necessary to redirect the input from
1378.Pa /dev/null
1379to make this work.)
1380.It Ev SSH_AUTH_SOCK
1381Identifies the path of a
1382.Ux Ns -domain
1383socket used to communicate with the agent.
1384.It Ev SSH_CONNECTION
1385Identifies the client and server ends of the connection.
1386The variable contains
1387four space-separated values: client IP address, client port number,
1388server IP address, and server port number.
1389.It Ev SSH_ORIGINAL_COMMAND
1390This variable contains the original command line if a forced command
1391is executed.
1392It can be used to extract the original arguments.
1393.It Ev SSH_TTY
1394This is set to the name of the tty (path to the device) associated
1395with the current shell or command.
1396If the current session has no tty,
1397this variable is not set.
1398.It Ev TZ
1399This variable is set to indicate the present time zone if it
1400was set when the daemon was started (i.e. the daemon passes the value
1401on to new connections).
1402.It Ev USER
1403Set to the name of the user logging in.
1404.El
1405.Pp
1406Additionally,
1407.Nm
1408reads
1409.Pa ~/.ssh/environment ,
1410and adds lines of the format
1411.Dq VARNAME=value
1412to the environment if the file exists and users are allowed to
1413change their environment.
1414For more information, see the
1415.Cm PermitUserEnvironment
1416option in
1417.Xr sshd_config 5 .
1418.Sh FILES
1419.Bl -tag -width Ds -compact
1420.It Pa ~/.rhosts
1421This file is used for host-based authentication (see above).
1422On some machines this file may need to be
1423world-readable if the user's home directory is on an NFS partition,
1424because
1425.Xr sshd 8
1426reads it as root.
1427Additionally, this file must be owned by the user,
1428and must not have write permissions for anyone else.
1429The recommended
1430permission for most machines is read/write for the user, and not
1431accessible by others.
1432.Pp
1433.It Pa ~/.shosts
1434This file is used in exactly the same way as
1435.Pa .rhosts ,
1436but allows host-based authentication without permitting login with
1437rlogin/rsh.
1438.Pp
1439.It Pa ~/.ssh/
1440This directory is the default location for all user-specific configuration
1441and authentication information.
1442There is no general requirement to keep the entire contents of this directory
1443secret, but the recommended permissions are read/write/execute for the user,
1444and not accessible by others.
1445.Pp
1446.It Pa ~/.ssh/authorized_keys
Adam Langleyd0592972015-03-30 14:49:51 -07001447Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1448that can be used for logging in as this user.
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001449The format of this file is described in the
1450.Xr sshd 8
1451manual page.
1452This file is not highly sensitive, but the recommended
1453permissions are read/write for the user, and not accessible by others.
1454.Pp
1455.It Pa ~/.ssh/config
1456This is the per-user configuration file.
1457The file format and configuration options are described in
1458.Xr ssh_config 5 .
1459Because of the potential for abuse, this file must have strict permissions:
Adam Langleyd0592972015-03-30 14:49:51 -07001460read/write for the user, and not writable by others.
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001461.Pp
1462.It Pa ~/.ssh/environment
1463Contains additional definitions for environment variables; see
1464.Sx ENVIRONMENT ,
1465above.
1466.Pp
1467.It Pa ~/.ssh/identity
1468.It Pa ~/.ssh/id_dsa
1469.It Pa ~/.ssh/id_ecdsa
Adam Langleyd0592972015-03-30 14:49:51 -07001470.It Pa ~/.ssh/id_ed25519
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001471.It Pa ~/.ssh/id_rsa
1472Contains the private key for authentication.
1473These files
1474contain sensitive data and should be readable by the user but not
1475accessible by others (read/write/execute).
1476.Nm
1477will simply ignore a private key file if it is accessible by others.
1478It is possible to specify a passphrase when
1479generating the key which will be used to encrypt the
1480sensitive part of this file using 3DES.
1481.Pp
1482.It Pa ~/.ssh/identity.pub
1483.It Pa ~/.ssh/id_dsa.pub
1484.It Pa ~/.ssh/id_ecdsa.pub
Adam Langleyd0592972015-03-30 14:49:51 -07001485.It Pa ~/.ssh/id_ed25519.pub
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001486.It Pa ~/.ssh/id_rsa.pub
1487Contains the public key for authentication.
1488These files are not
1489sensitive and can (but need not) be readable by anyone.
1490.Pp
1491.It Pa ~/.ssh/known_hosts
1492Contains a list of host keys for all hosts the user has logged into
1493that are not already in the systemwide list of known host keys.
1494See
1495.Xr sshd 8
1496for further details of the format of this file.
1497.Pp
1498.It Pa ~/.ssh/rc
1499Commands in this file are executed by
1500.Nm
1501when the user logs in, just before the user's shell (or command) is
1502started.
1503See the
1504.Xr sshd 8
1505manual page for more information.
1506.Pp
1507.It Pa /etc/hosts.equiv
1508This file is for host-based authentication (see above).
1509It should only be writable by root.
1510.Pp
1511.It Pa /etc/shosts.equiv
1512This file is used in exactly the same way as
1513.Pa hosts.equiv ,
1514but allows host-based authentication without permitting login with
1515rlogin/rsh.
1516.Pp
1517.It Pa /etc/ssh/ssh_config
1518Systemwide configuration file.
1519The file format and configuration options are described in
1520.Xr ssh_config 5 .
1521.Pp
1522.It Pa /etc/ssh/ssh_host_key
1523.It Pa /etc/ssh/ssh_host_dsa_key
1524.It Pa /etc/ssh/ssh_host_ecdsa_key
Adam Langleyd0592972015-03-30 14:49:51 -07001525.It Pa /etc/ssh/ssh_host_ed25519_key
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001526.It Pa /etc/ssh/ssh_host_rsa_key
Adam Langleyd0592972015-03-30 14:49:51 -07001527These files contain the private parts of the host keys
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001528and are used for host-based authentication.
1529If protocol version 1 is used,
1530.Nm
1531must be setuid root, since the host key is readable only by root.
1532For protocol version 2,
1533.Nm
1534uses
1535.Xr ssh-keysign 8
1536to access the host keys,
1537eliminating the requirement that
1538.Nm
1539be setuid root when host-based authentication is used.
1540By default
1541.Nm
1542is not setuid root.
1543.Pp
1544.It Pa /etc/ssh/ssh_known_hosts
1545Systemwide list of known host keys.
1546This file should be prepared by the
1547system administrator to contain the public host keys of all machines in the
1548organization.
1549It should be world-readable.
1550See
1551.Xr sshd 8
1552for further details of the format of this file.
1553.Pp
1554.It Pa /etc/ssh/sshrc
1555Commands in this file are executed by
1556.Nm
1557when the user logs in, just before the user's shell (or command) is started.
1558See the
1559.Xr sshd 8
1560manual page for more information.
1561.El
1562.Sh EXIT STATUS
1563.Nm
1564exits with the exit status of the remote command or with 255
1565if an error occurred.
1566.Sh SEE ALSO
1567.Xr scp 1 ,
1568.Xr sftp 1 ,
1569.Xr ssh-add 1 ,
1570.Xr ssh-agent 1 ,
1571.Xr ssh-keygen 1 ,
1572.Xr ssh-keyscan 1 ,
1573.Xr tun 4 ,
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001574.Xr ssh_config 5 ,
1575.Xr ssh-keysign 8 ,
1576.Xr sshd 8
Adam Langleyd0592972015-03-30 14:49:51 -07001577.Sh STANDARDS
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001578.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001579.%A S. Lehtinen
1580.%A C. Lonvick
1581.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001582.%R RFC 4250
Adam Langleyd0592972015-03-30 14:49:51 -07001583.%T The Secure Shell (SSH) Protocol Assigned Numbers
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001584.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001585.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001586.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001587.%A T. Ylonen
1588.%A C. Lonvick
1589.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001590.%R RFC 4251
Adam Langleyd0592972015-03-30 14:49:51 -07001591.%T The Secure Shell (SSH) Protocol Architecture
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001592.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001593.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001594.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001595.%A T. Ylonen
1596.%A C. Lonvick
1597.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001598.%R RFC 4252
Adam Langleyd0592972015-03-30 14:49:51 -07001599.%T The Secure Shell (SSH) Authentication Protocol
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001600.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001601.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001602.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001603.%A T. Ylonen
1604.%A C. Lonvick
1605.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001606.%R RFC 4253
Adam Langleyd0592972015-03-30 14:49:51 -07001607.%T The Secure Shell (SSH) Transport Layer Protocol
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001608.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001609.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001610.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001611.%A T. Ylonen
1612.%A C. Lonvick
1613.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001614.%R RFC 4254
Adam Langleyd0592972015-03-30 14:49:51 -07001615.%T The Secure Shell (SSH) Connection Protocol
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001616.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001617.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001618.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001619.%A J. Schlyter
1620.%A W. Griffin
1621.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001622.%R RFC 4255
Adam Langleyd0592972015-03-30 14:49:51 -07001623.%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001624.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001625.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001626.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001627.%A F. Cusack
1628.%A M. Forssen
1629.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001630.%R RFC 4256
Adam Langleyd0592972015-03-30 14:49:51 -07001631.%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001632.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001633.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001634.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001635.%A J. Galbraith
1636.%A P. Remaker
1637.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001638.%R RFC 4335
Adam Langleyd0592972015-03-30 14:49:51 -07001639.%T The Secure Shell (SSH) Session Channel Break Extension
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001640.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001641.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001642.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001643.%A M. Bellare
1644.%A T. Kohno
1645.%A C. Namprempre
1646.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001647.%R RFC 4344
Adam Langleyd0592972015-03-30 14:49:51 -07001648.%T The Secure Shell (SSH) Transport Layer Encryption Modes
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001649.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001650.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001651.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001652.%A B. Harris
1653.%D January 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001654.%R RFC 4345
Adam Langleyd0592972015-03-30 14:49:51 -07001655.%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001656.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001657.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001658.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001659.%A M. Friedl
1660.%A N. Provos
1661.%A W. Simpson
1662.%D March 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001663.%R RFC 4419
Adam Langleyd0592972015-03-30 14:49:51 -07001664.%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001665.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001666.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001667.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001668.%A J. Galbraith
1669.%A R. Thayer
1670.%D November 2006
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001671.%R RFC 4716
Adam Langleyd0592972015-03-30 14:49:51 -07001672.%T The Secure Shell (SSH) Public Key File Format
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001673.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001674.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001675.Rs
Adam Langleyd0592972015-03-30 14:49:51 -07001676.%A D. Stebila
1677.%A J. Green
1678.%D December 2009
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001679.%R RFC 5656
Adam Langleyd0592972015-03-30 14:49:51 -07001680.%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001681.Re
Adam Langleyd0592972015-03-30 14:49:51 -07001682.Pp
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001683.Rs
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001684.%A A. Perrig
1685.%A D. Song
1686.%D 1999
Adam Langleyd0592972015-03-30 14:49:51 -07001687.%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1688.%T Hash Visualization: a New Technique to improve Real-World Security
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001689.Re
1690.Sh AUTHORS
1691OpenSSH is a derivative of the original and free
1692ssh 1.2.12 release by Tatu Ylonen.
1693Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1694Theo de Raadt and Dug Song
1695removed many bugs, re-added newer features and
1696created OpenSSH.
1697Markus Friedl contributed the support for SSH
1698protocol versions 1.5 and 2.0.