xref: /openbsd-src/usr.bin/ssh/ssh.1 (revision 78fec973f57e9fc9edd564490c79661460ad807b)
1.\"
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.\"
36.\" $OpenBSD: ssh.1,v 1.431 2022/05/28 05:57:56 jmc Exp $
37.Dd $Mdocdate: May 28 2022 $
38.Dt SSH 1
39.Os
40.Sh NAME
41.Nm ssh
42.Nd OpenSSH remote login client
43.Sh SYNOPSIS
44.Nm ssh
45.Op Fl 46AaCfGgKkMNnqsTtVvXxYy
46.Op Fl B Ar bind_interface
47.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
50.Op Fl E Ar log_file
51.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
55.Op Fl J Ar destination
56.Op Fl L Ar address
57.Op Fl l Ar login_name
58.Op Fl m Ar mac_spec
59.Op Fl O Ar ctl_cmd
60.Op Fl o Ar option
61.Op Fl p Ar port
62.Op Fl Q Ar query_option
63.Op Fl R Ar address
64.Op Fl S Ar ctl_path
65.Op Fl W Ar host : Ns Ar port
66.Op Fl w Ar local_tun Ns Op : Ns Ar remote_tun
67.Ar destination
68.Op Ar command Op Ar argument ...
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 provide secure encrypted communications between
74two untrusted hosts over an insecure network.
75X11 connections, arbitrary TCP ports and
76.Ux Ns -domain
77sockets can also be forwarded over the secure channel.
78.Pp
79.Nm
80connects and logs into the specified
81.Ar destination ,
82which may be specified as either
83.Sm off
84.Oo user @ Oc hostname
85.Sm on
86or a URI of the form
87.Sm off
88.No ssh:// Oo user @ Oc hostname Op : port .
89.Sm on
90The user must prove
91their identity to the remote machine using one of several methods
92(see below).
93.Pp
94If a
95.Ar command
96is specified,
97it will be executed on the remote host instead of a login shell.
98A complete command line may be specified as
99.Ar command ,
100or it may have additional arguments.
101If supplied, the arguments will be appended to the command, separated by
102spaces, before it is sent to the server to be executed.
103.Pp
104The options are as follows:
105.Pp
106.Bl -tag -width Ds -compact
107.It Fl 4
108Forces
109.Nm
110to use IPv4 addresses only.
111.Pp
112.It Fl 6
113Forces
114.Nm
115to use IPv6 addresses only.
116.Pp
117.It Fl A
118Enables forwarding of connections from an authentication agent such as
119.Xr ssh-agent 1 .
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.
130A safer alternative may be to use a jump host
131(see
132.Fl J ) .
133.Pp
134.It Fl a
135Disables forwarding of the authentication agent connection.
136.Pp
137.It Fl B Ar bind_interface
138Bind to the address of
139.Ar bind_interface
140before attempting to connect to the destination host.
141This is only useful on systems with more than one address.
142.Pp
143.It Fl b Ar bind_address
144Use
145.Ar bind_address
146on the local machine as the source address
147of the connection.
148Only useful on systems with more than one address.
149.Pp
150.It Fl C
151Requests compression of all data (including stdin, stdout, stderr, and
152data for forwarded X11, TCP and
153.Ux Ns -domain
154connections).
155The compression algorithm is the same used by
156.Xr gzip 1 .
157Compression is desirable on modem lines and other
158slow connections, but will only slow down things on fast networks.
159The default value can be set on a host-by-host basis in the
160configuration files; see the
161.Cm Compression
162option in
163.Xr ssh_config 5 .
164.Pp
165.It Fl c Ar cipher_spec
166Selects the cipher specification for encrypting the session.
167.Ar cipher_spec
168is a comma-separated list of ciphers
169listed in order of preference.
170See the
171.Cm Ciphers
172keyword in
173.Xr ssh_config 5
174for more information.
175.Pp
176.It Fl D Xo
177.Sm off
178.Oo Ar bind_address : Oc
179.Ar port
180.Sm on
181.Xc
182Specifies a local
183.Dq dynamic
184application-level port forwarding.
185This works by allocating a socket to listen to
186.Ar port
187on the local side, optionally bound to the specified
188.Ar bind_address .
189Whenever a connection is made to this port, the
190connection is forwarded over the secure channel, and the application
191protocol is then used to determine where to connect to from the
192remote machine.
193Currently the SOCKS4 and SOCKS5 protocols are supported, and
194.Nm
195will act as a SOCKS server.
196Only root can forward privileged ports.
197Dynamic port forwardings can also be specified in the configuration file.
198.Pp
199IPv6 addresses can be specified by enclosing the address in square brackets.
200Only the superuser can forward privileged ports.
201By default, the local port is bound in accordance with the
202.Cm GatewayPorts
203setting.
204However, an explicit
205.Ar bind_address
206may be used to bind the connection to a specific address.
207The
208.Ar bind_address
209of
210.Dq localhost
211indicates that the listening port be bound for local use only, while an
212empty address or
213.Sq *
214indicates that the port should be available from all interfaces.
215.Pp
216.It Fl E Ar log_file
217Append debug logs to
218.Ar log_file
219instead of standard error.
220.Pp
221.It Fl e Ar escape_char
222Sets the escape character for sessions with a pty (default:
223.Ql ~ ) .
224The escape character is only recognized at the beginning of a line.
225The escape character followed by a dot
226.Pq Ql \&.
227closes the connection;
228followed by control-Z suspends the connection;
229and followed by itself sends the escape character once.
230Setting the character to
231.Dq none
232disables any escapes and makes the session fully transparent.
233.Pp
234.It Fl F Ar configfile
235Specifies an alternative per-user configuration file.
236If a configuration file is given on the command line,
237the system-wide configuration file
238.Pq Pa /etc/ssh/ssh_config
239will be ignored.
240The default for the per-user configuration file is
241.Pa ~/.ssh/config .
242If set to
243.Dq none ,
244no configuration files will be read.
245.Pp
246.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.
268Refer to the description of
269.Cm ForkAfterAuthentication
270in
271.Xr ssh_config 5
272for details.
273.Pp
274.It Fl G
275Causes
276.Nm
277to print its configuration after evaluating
278.Cm Host
279and
280.Cm Match
281blocks and exit.
282.Pp
283.It Fl g
284Allows remote hosts to connect to local forwarded ports.
285If used on a multiplexed connection, then this option must be specified
286on the master process.
287.Pp
288.It Fl I Ar pkcs11
289Specify the PKCS#11 shared library
290.Nm
291should use to communicate with a PKCS#11 token providing keys for user
292authentication.
293.Pp
294.It Fl i Ar identity_file
295Selects a file from which the identity (private key) for
296public key authentication is read.
297You can also specify a public key file to use the corresponding
298private key that is loaded in
299.Xr ssh-agent 1
300when the private key file is not present locally.
301The default is
302.Pa ~/.ssh/id_rsa ,
303.Pa ~/.ssh/id_ecdsa ,
304.Pa ~/.ssh/id_ecdsa_sk ,
305.Pa ~/.ssh/id_ed25519 ,
306.Pa ~/.ssh/id_ed25519_sk
307and
308.Pa ~/.ssh/id_dsa .
309Identity files may also be specified on
310a per-host basis in the configuration file.
311It is possible to have multiple
312.Fl i
313options (and multiple identities specified in
314configuration files).
315If no certificates have been explicitly specified by the
316.Cm CertificateFile
317directive,
318.Nm
319will also try to load certificate information from the filename obtained
320by appending
321.Pa -cert.pub
322to identity filenames.
323.Pp
324.It Fl J Ar destination
325Connect to the target host by first making a
326.Nm
327connection to the jump host described by
328.Ar destination
329and then establishing a TCP forwarding to the ultimate destination from
330there.
331Multiple jump hops may be specified separated by comma characters.
332This is a shortcut to specify a
333.Cm ProxyJump
334configuration directive.
335Note that configuration directives supplied on the command-line generally
336apply to the destination host and not any specified jump hosts.
337Use
338.Pa ~/.ssh/config
339to specify configuration for jump hosts.
340.Pp
341.It Fl K
342Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
343credentials to the server.
344.Pp
345.It Fl k
346Disables forwarding (delegation) of GSSAPI credentials to the server.
347.Pp
348.It Fl L Xo
349.Sm off
350.Oo Ar bind_address : Oc
351.Ar port : host : hostport
352.Sm on
353.Xc
354.It Fl L Xo
355.Sm off
356.Oo Ar bind_address : Oc
357.Ar port : remote_socket
358.Sm on
359.Xc
360.It Fl L Xo
361.Sm off
362.Ar local_socket : host : hostport
363.Sm on
364.Xc
365.It Fl L Xo
366.Sm off
367.Ar local_socket : remote_socket
368.Sm on
369.Xc
370Specifies that connections to the given TCP port or Unix socket on the local
371(client) host are to be forwarded to the given host and port, or Unix socket,
372on the remote side.
373This works by allocating a socket to listen to either a TCP
374.Ar port
375on the local side, optionally bound to the specified
376.Ar bind_address ,
377or to a Unix socket.
378Whenever a connection is made to the local port or socket, the
379connection is forwarded over the secure channel, and a connection is
380made to either
381.Ar host
382port
383.Ar hostport ,
384or the Unix socket
385.Ar remote_socket ,
386from the remote machine.
387.Pp
388Port forwardings can also be specified in the configuration file.
389Only the superuser can forward privileged ports.
390IPv6 addresses can be specified by enclosing the address in square brackets.
391.Pp
392By default, the local port is bound in accordance with the
393.Cm GatewayPorts
394setting.
395However, an explicit
396.Ar bind_address
397may be used to bind the connection to a specific address.
398The
399.Ar bind_address
400of
401.Dq localhost
402indicates that the listening port be bound for local use only, while an
403empty address or
404.Sq *
405indicates that the port should be available from all interfaces.
406.Pp
407.It Fl l Ar login_name
408Specifies the user to log in as on the remote machine.
409This also may be specified on a per-host basis in the configuration file.
410.Pp
411.It Fl M
412Places the
413.Nm
414client into
415.Dq master
416mode for connection sharing.
417Multiple
418.Fl M
419options places
420.Nm
421into
422.Dq master
423mode but with confirmation required using
424.Xr ssh-askpass 1
425before each operation that changes the multiplexing state
426(e.g. opening a new session).
427Refer to the description of
428.Cm ControlMaster
429in
430.Xr ssh_config 5
431for details.
432.Pp
433.It Fl m Ar mac_spec
434A comma-separated list of MAC (message authentication code) algorithms,
435specified in order of preference.
436See the
437.Cm MACs
438keyword in
439.Xr ssh_config 5
440for more information.
441.Pp
442.It Fl N
443Do not execute a remote command.
444This is useful for just forwarding ports.
445Refer to the description of
446.Cm SessionType
447in
448.Xr ssh_config 5
449for details.
450.Pp
451.It Fl n
452Redirects stdin from
453.Pa /dev/null
454(actually, prevents reading from stdin).
455This must be used when
456.Nm
457is run in the background.
458A common trick is to use this to run X11 programs on a remote machine.
459For example,
460.Ic ssh -n shadows.cs.hut.fi emacs &
461will start an emacs on shadows.cs.hut.fi, and the X11
462connection will be automatically forwarded over an encrypted channel.
463The
464.Nm
465program will be put in the background.
466(This does not work if
467.Nm
468needs to ask for a password or passphrase; see also the
469.Fl f
470option.)
471Refer to the description of
472.Cm StdinNull
473in
474.Xr ssh_config 5
475for details.
476.Pp
477.It Fl O Ar ctl_cmd
478Control an active connection multiplexing master process.
479When the
480.Fl O
481option is specified, the
482.Ar ctl_cmd
483argument is interpreted and passed to the master process.
484Valid commands are:
485.Dq check
486(check that the master process is running),
487.Dq forward
488(request forwardings without command execution),
489.Dq cancel
490(cancel forwardings),
491.Dq exit
492(request the master to exit), and
493.Dq stop
494(request the master to stop accepting further multiplexing requests).
495.Pp
496.It Fl o Ar option
497Can be used to give options in the format used in the configuration file.
498This is useful for specifying options for which there is no separate
499command-line flag.
500For full details of the options listed below, and their possible values, see
501.Xr ssh_config 5 .
502.Pp
503.Bl -tag -width Ds -offset indent -compact
504.It AddKeysToAgent
505.It AddressFamily
506.It BatchMode
507.It BindAddress
508.It CanonicalDomains
509.It CanonicalizeFallbackLocal
510.It CanonicalizeHostname
511.It CanonicalizeMaxDots
512.It CanonicalizePermittedCNAMEs
513.It CASignatureAlgorithms
514.It CertificateFile
515.It CheckHostIP
516.It Ciphers
517.It ClearAllForwardings
518.It Compression
519.It ConnectionAttempts
520.It ConnectTimeout
521.It ControlMaster
522.It ControlPath
523.It ControlPersist
524.It DynamicForward
525.It EscapeChar
526.It ExitOnForwardFailure
527.It FingerprintHash
528.It ForkAfterAuthentication
529.It ForwardAgent
530.It ForwardX11
531.It ForwardX11Timeout
532.It ForwardX11Trusted
533.It GatewayPorts
534.It GlobalKnownHostsFile
535.It GSSAPIAuthentication
536.It GSSAPIDelegateCredentials
537.It HashKnownHosts
538.It Host
539.It HostbasedAcceptedAlgorithms
540.It HostbasedAuthentication
541.It HostKeyAlgorithms
542.It HostKeyAlias
543.It Hostname
544.It IdentitiesOnly
545.It IdentityAgent
546.It IdentityFile
547.It IPQoS
548.It KbdInteractiveAuthentication
549.It KbdInteractiveDevices
550.It KexAlgorithms
551.It KnownHostsCommand
552.It LocalCommand
553.It LocalForward
554.It LogLevel
555.It MACs
556.It Match
557.It NoHostAuthenticationForLocalhost
558.It NumberOfPasswordPrompts
559.It PasswordAuthentication
560.It PermitLocalCommand
561.It PermitRemoteOpen
562.It PKCS11Provider
563.It Port
564.It PreferredAuthentications
565.It ProxyCommand
566.It ProxyJump
567.It ProxyUseFdpass
568.It PubkeyAcceptedAlgorithms
569.It PubkeyAuthentication
570.It RekeyLimit
571.It RemoteCommand
572.It RemoteForward
573.It RequestTTY
574.It SendEnv
575.It ServerAliveInterval
576.It ServerAliveCountMax
577.It SessionType
578.It SetEnv
579.It StdinNull
580.It StreamLocalBindMask
581.It StreamLocalBindUnlink
582.It StrictHostKeyChecking
583.It TCPKeepAlive
584.It Tunnel
585.It TunnelDevice
586.It UpdateHostKeys
587.It User
588.It UserKnownHostsFile
589.It VerifyHostKeyDNS
590.It VisualHostKey
591.It XAuthLocation
592.El
593.Pp
594.It Fl p Ar port
595Port to connect to on the remote host.
596This can be specified on a
597per-host basis in the configuration file.
598.Pp
599.It Fl Q Ar query_option
600Queries for the algorithms supported by one of the following features:
601.Ar cipher
602(supported symmetric ciphers),
603.Ar cipher-auth
604(supported symmetric ciphers that support authenticated encryption),
605.Ar help
606(supported query terms for use with the
607.Fl Q
608flag),
609.Ar mac
610(supported message integrity codes),
611.Ar kex
612(key exchange algorithms),
613.Ar key
614(key types),
615.Ar key-cert
616(certificate key types),
617.Ar key-plain
618(non-certificate key types),
619.Ar key-sig
620(all key types and signature algorithms),
621.Ar protocol-version
622(supported SSH protocol versions), and
623.Ar sig
624(supported signature algorithms).
625Alternatively, any keyword from
626.Xr ssh_config 5
627or
628.Xr sshd_config 5
629that takes an algorithm list may be used as an alias for the corresponding
630query_option.
631.Pp
632.It Fl q
633Quiet mode.
634Causes most warning and diagnostic messages to be suppressed.
635.Pp
636.It Fl R Xo
637.Sm off
638.Oo Ar bind_address : Oc
639.Ar port : host : hostport
640.Sm on
641.Xc
642.It Fl R Xo
643.Sm off
644.Oo Ar bind_address : Oc
645.Ar port : local_socket
646.Sm on
647.Xc
648.It Fl R Xo
649.Sm off
650.Ar remote_socket : host : hostport
651.Sm on
652.Xc
653.It Fl R Xo
654.Sm off
655.Ar remote_socket : local_socket
656.Sm on
657.Xc
658.It Fl R Xo
659.Sm off
660.Oo Ar bind_address : Oc
661.Ar port
662.Sm on
663.Xc
664Specifies that connections to the given TCP port or Unix socket on the remote
665(server) host are to be forwarded to the local side.
666.Pp
667This works by allocating a socket to listen to either a TCP
668.Ar port
669or to a Unix socket on the remote side.
670Whenever a connection is made to this port or Unix socket, the
671connection is forwarded over the secure channel, and a connection
672is made from the local machine to either an explicit destination specified by
673.Ar host
674port
675.Ar hostport ,
676or
677.Ar local_socket ,
678or, if no explicit destination was specified,
679.Nm
680will act as a SOCKS 4/5 proxy and forward connections to the destinations
681requested by the remote SOCKS client.
682.Pp
683Port forwardings can also be specified in the configuration file.
684Privileged ports can be forwarded only when
685logging in as root on the remote machine.
686IPv6 addresses can be specified by enclosing the address in square brackets.
687.Pp
688By default, TCP listening sockets on the server will be bound to the loopback
689interface only.
690This may be overridden by specifying a
691.Ar bind_address .
692An empty
693.Ar bind_address ,
694or the address
695.Ql * ,
696indicates that the remote socket should listen on all interfaces.
697Specifying a remote
698.Ar bind_address
699will only succeed if the server's
700.Cm GatewayPorts
701option is enabled (see
702.Xr sshd_config 5 ) .
703.Pp
704If the
705.Ar port
706argument is
707.Ql 0 ,
708the listen port will be dynamically allocated on the server and reported
709to the client at run time.
710When used together with
711.Ic -O forward ,
712the allocated port will be printed to the standard output.
713.Pp
714.It Fl S Ar ctl_path
715Specifies the location of a control socket for connection sharing,
716or the string
717.Dq none
718to disable connection sharing.
719Refer to the description of
720.Cm ControlPath
721and
722.Cm ControlMaster
723in
724.Xr ssh_config 5
725for details.
726.Pp
727.It Fl s
728May be used to request invocation of a subsystem on the remote system.
729Subsystems facilitate the use of SSH
730as a secure transport for other applications (e.g.\&
731.Xr sftp 1 ) .
732The subsystem is specified as the remote command.
733Refer to the description of
734.Cm SessionType
735in
736.Xr ssh_config 5
737for details.
738.Pp
739.It Fl T
740Disable pseudo-terminal allocation.
741.Pp
742.It Fl t
743Force pseudo-terminal allocation.
744This can be used to execute arbitrary
745screen-based programs on a remote machine, which can be very useful,
746e.g. when implementing menu services.
747Multiple
748.Fl t
749options force tty allocation, even if
750.Nm
751has no local tty.
752.Pp
753.It Fl V
754Display the version number and exit.
755.Pp
756.It Fl v
757Verbose mode.
758Causes
759.Nm
760to print debugging messages about its progress.
761This is helpful in
762debugging connection, authentication, and configuration problems.
763Multiple
764.Fl v
765options increase the verbosity.
766The maximum is 3.
767.Pp
768.It Fl W Ar host : Ns Ar port
769Requests that standard input and output on the client be forwarded to
770.Ar host
771on
772.Ar port
773over the secure channel.
774Implies
775.Fl N ,
776.Fl T ,
777.Cm ExitOnForwardFailure
778and
779.Cm ClearAllForwardings ,
780though these can be overridden in the configuration file or using
781.Fl o
782command line options.
783.Pp
784.It Fl w Xo
785.Ar local_tun Ns Op : Ns Ar remote_tun
786.Xc
787Requests
788tunnel
789device forwarding with the specified
790.Xr tun 4
791devices between the client
792.Pq Ar local_tun
793and the server
794.Pq Ar remote_tun .
795.Pp
796The devices may be specified by numerical ID or the keyword
797.Dq any ,
798which uses the next available tunnel device.
799If
800.Ar remote_tun
801is not specified, it defaults to
802.Dq any .
803See also the
804.Cm Tunnel
805and
806.Cm TunnelDevice
807directives in
808.Xr ssh_config 5 .
809.Pp
810If the
811.Cm Tunnel
812directive is unset, it will be set to the default tunnel mode, which is
813.Dq point-to-point .
814If a different
815.Cm Tunnel
816forwarding mode it desired, then it should be specified before
817.Fl w .
818.Pp
819.It Fl X
820Enables X11 forwarding.
821This can also be specified on a per-host basis in a configuration file.
822.Pp
823X11 forwarding should be enabled with caution.
824Users with the ability to bypass file permissions on the remote host
825(for the user's X authorization database)
826can access the local X11 display through the forwarded connection.
827An attacker may then be able to perform activities such as keystroke monitoring.
828.Pp
829For this reason, X11 forwarding is subjected to X11 SECURITY extension
830restrictions by default.
831Refer to the
832.Nm
833.Fl Y
834option and the
835.Cm ForwardX11Trusted
836directive in
837.Xr ssh_config 5
838for more information.
839.Pp
840.It Fl x
841Disables X11 forwarding.
842.Pp
843.It Fl Y
844Enables trusted X11 forwarding.
845Trusted X11 forwardings are not subjected to the X11 SECURITY extension
846controls.
847.Pp
848.It Fl y
849Send log information using the
850.Xr syslog 3
851system module.
852By default this information is sent to stderr.
853.El
854.Pp
855.Nm
856may additionally obtain configuration data from
857a per-user configuration file and a system-wide configuration file.
858The file format and configuration options are described in
859.Xr ssh_config 5 .
860.Sh AUTHENTICATION
861The OpenSSH SSH client supports SSH protocol 2.
862.Pp
863The methods available for authentication are:
864GSSAPI-based authentication,
865host-based authentication,
866public key authentication,
867keyboard-interactive authentication,
868and password authentication.
869Authentication methods are tried in the order specified above,
870though
871.Cm PreferredAuthentications
872can be used to change the default order.
873.Pp
874Host-based authentication works as follows:
875If the machine the user logs in from is listed in
876.Pa /etc/hosts.equiv
877or
878.Pa /etc/shosts.equiv
879on the remote machine, the user is non-root and the user names are
880the same on both sides, or if the files
881.Pa ~/.rhosts
882or
883.Pa ~/.shosts
884exist in the user's home directory on the
885remote machine and contain a line containing the name of the client
886machine and the name of the user on that machine, the user is
887considered for login.
888Additionally, the server
889.Em must
890be able to verify the client's
891host key (see the description of
892.Pa /etc/ssh/ssh_known_hosts
893and
894.Pa ~/.ssh/known_hosts ,
895below)
896for login to be permitted.
897This authentication method closes security holes due to IP
898spoofing, DNS spoofing, and routing spoofing.
899[Note to the administrator:
900.Pa /etc/hosts.equiv ,
901.Pa ~/.rhosts ,
902and the rlogin/rsh protocol in general, are inherently insecure and should be
903disabled if security is desired.]
904.Pp
905Public key authentication works as follows:
906The scheme is based on public-key cryptography,
907using cryptosystems
908where encryption and decryption are done using separate keys,
909and it is unfeasible to derive the decryption key from the encryption key.
910The idea is that each user creates a public/private
911key pair for authentication purposes.
912The server knows the public key, and only the user knows the private key.
913.Nm
914implements public key authentication protocol automatically,
915using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
916The HISTORY section of
917.Xr ssl 8
918contains a brief discussion of the DSA and RSA algorithms.
919.Pp
920The file
921.Pa ~/.ssh/authorized_keys
922lists the public keys that are permitted for logging in.
923When the user logs in, the
924.Nm
925program tells the server which key pair it would like to use for
926authentication.
927The client proves that it has access to the private key
928and the server checks that the corresponding public key
929is authorized to accept the account.
930.Pp
931The server may inform the client of errors that prevented public key
932authentication from succeeding after authentication completes using a
933different method.
934These may be viewed by increasing the
935.Cm LogLevel
936to
937.Cm DEBUG
938or higher (e.g. by using the
939.Fl v
940flag).
941.Pp
942The user creates their key pair by running
943.Xr ssh-keygen 1 .
944This stores the private key in
945.Pa ~/.ssh/id_dsa
946(DSA),
947.Pa ~/.ssh/id_ecdsa
948(ECDSA),
949.Pa ~/.ssh/id_ecdsa_sk
950(authenticator-hosted ECDSA),
951.Pa ~/.ssh/id_ed25519
952(Ed25519),
953.Pa ~/.ssh/id_ed25519_sk
954(authenticator-hosted Ed25519),
955or
956.Pa ~/.ssh/id_rsa
957(RSA)
958and stores the public key in
959.Pa ~/.ssh/id_dsa.pub
960(DSA),
961.Pa ~/.ssh/id_ecdsa.pub
962(ECDSA),
963.Pa ~/.ssh/id_ecdsa_sk.pub
964(authenticator-hosted ECDSA),
965.Pa ~/.ssh/id_ed25519.pub
966(Ed25519),
967.Pa ~/.ssh/id_ed25519_sk.pub
968(authenticator-hosted Ed25519),
969or
970.Pa ~/.ssh/id_rsa.pub
971(RSA)
972in the user's home directory.
973The user should then copy the public key
974to
975.Pa ~/.ssh/authorized_keys
976in their home directory on the remote machine.
977The
978.Pa authorized_keys
979file corresponds to the conventional
980.Pa ~/.rhosts
981file, and has one key
982per line, though the lines can be very long.
983After this, the user can log in without giving the password.
984.Pp
985A variation on public key authentication
986is available in the form of certificate authentication:
987instead of a set of public/private keys,
988signed certificates are used.
989This has the advantage that a single trusted certification authority
990can be used in place of many public/private keys.
991See the CERTIFICATES section of
992.Xr ssh-keygen 1
993for more information.
994.Pp
995The most convenient way to use public key or certificate authentication
996may be with an authentication agent.
997See
998.Xr ssh-agent 1
999and (optionally) the
1000.Cm AddKeysToAgent
1001directive in
1002.Xr ssh_config 5
1003for more information.
1004.Pp
1005Keyboard-interactive authentication works as follows:
1006The server sends an arbitrary
1007.Qq challenge
1008text and prompts for a response, possibly multiple times.
1009Examples of keyboard-interactive authentication include
1010.Bx
1011Authentication (see
1012.Xr login.conf 5 )
1013and PAM (some
1014.Pf non- Ox
1015systems).
1016.Pp
1017Finally, if other authentication methods fail,
1018.Nm
1019prompts the user for a password.
1020The password is sent to the remote
1021host for checking; however, since all communications are encrypted,
1022the password cannot be seen by someone listening on the network.
1023.Pp
1024.Nm
1025automatically maintains and checks a database containing
1026identification for all hosts it has ever been used with.
1027Host keys are stored in
1028.Pa ~/.ssh/known_hosts
1029in the user's home directory.
1030Additionally, the file
1031.Pa /etc/ssh/ssh_known_hosts
1032is automatically checked for known hosts.
1033Any new hosts are automatically added to the user's file.
1034If a host's identification ever changes,
1035.Nm
1036warns about this and disables password authentication to prevent
1037server spoofing or man-in-the-middle attacks,
1038which could otherwise be used to circumvent the encryption.
1039The
1040.Cm StrictHostKeyChecking
1041option can be used to control logins to machines whose
1042host key is not known or has changed.
1043.Pp
1044When the user's identity has been accepted by the server, the server
1045either executes the given command in a non-interactive session or,
1046if no command has been specified, logs into the machine and gives
1047the user a normal shell as an interactive session.
1048All communication with
1049the remote command or shell will be automatically encrypted.
1050.Pp
1051If an interactive session is requested,
1052.Nm
1053by default will only request a pseudo-terminal (pty) for interactive
1054sessions when the client has one.
1055The flags
1056.Fl T
1057and
1058.Fl t
1059can be used to override this behaviour.
1060.Pp
1061If a pseudo-terminal has been allocated, the
1062user may use the escape characters noted below.
1063.Pp
1064If no pseudo-terminal has been allocated,
1065the session is transparent and can be used to reliably transfer binary data.
1066On most systems, setting the escape character to
1067.Dq none
1068will also make the session transparent even if a tty is used.
1069.Pp
1070The session terminates when the command or shell on the remote
1071machine exits and all X11 and TCP connections have been closed.
1072.Sh ESCAPE CHARACTERS
1073When a pseudo-terminal has been requested,
1074.Nm
1075supports a number of functions through the use of an escape character.
1076.Pp
1077A single tilde character can be sent as
1078.Ic ~~
1079or by following the tilde by a character other than those described below.
1080The escape character must always follow a newline to be interpreted as
1081special.
1082The escape character can be changed in configuration files using the
1083.Cm EscapeChar
1084configuration directive or on the command line by the
1085.Fl e
1086option.
1087.Pp
1088The supported escapes (assuming the default
1089.Ql ~ )
1090are:
1091.Bl -tag -width Ds
1092.It Cm ~.
1093Disconnect.
1094.It Cm ~^Z
1095Background
1096.Nm .
1097.It Cm ~#
1098List forwarded connections.
1099.It Cm ~&
1100Background
1101.Nm
1102at logout when waiting for forwarded connection / X11 sessions to terminate.
1103.It Cm ~?
1104Display a list of escape characters.
1105.It Cm ~B
1106Send a BREAK to the remote system
1107(only useful if the peer supports it).
1108.It Cm ~C
1109Open command line.
1110Currently this allows the addition of port forwardings using the
1111.Fl L ,
1112.Fl R
1113and
1114.Fl D
1115options (see above).
1116It also allows the cancellation of existing port-forwardings
1117with
1118.Sm off
1119.Fl KL Oo Ar bind_address : Oc Ar port
1120.Sm on
1121for local,
1122.Sm off
1123.Fl KR Oo Ar bind_address : Oc Ar port
1124.Sm on
1125for remote and
1126.Sm off
1127.Fl KD Oo Ar bind_address : Oc Ar port
1128.Sm on
1129for dynamic port-forwardings.
1130.Ic !\& Ns Ar command
1131allows the user to execute a local command if the
1132.Ic PermitLocalCommand
1133option is enabled in
1134.Xr ssh_config 5 .
1135Basic help is available, using the
1136.Fl h
1137option.
1138.It Cm ~R
1139Request rekeying of the connection
1140(only useful if the peer supports it).
1141.It Cm ~V
1142Decrease the verbosity
1143.Pq Ic LogLevel
1144when errors are being written to stderr.
1145.It Cm ~v
1146Increase the verbosity
1147.Pq Ic LogLevel
1148when errors are being written to stderr.
1149.El
1150.Sh TCP FORWARDING
1151Forwarding of arbitrary TCP connections over a secure channel
1152can be specified either on the command line or in a configuration file.
1153One possible application of TCP forwarding is a secure connection to a
1154mail server; another is going through firewalls.
1155.Pp
1156In the example below, we look at encrypting communication for an IRC client,
1157even though the IRC server it connects to does not directly
1158support encrypted communication.
1159This works as follows:
1160the user connects to the remote host using
1161.Nm ,
1162specifying the ports to be used to forward the connection.
1163After that it is possible to start the program locally,
1164and
1165.Nm
1166will encrypt and forward the connection to the remote server.
1167.Pp
1168The following example tunnels an IRC session from the client
1169to an IRC server at
1170.Dq server.example.com ,
1171joining channel
1172.Dq #users ,
1173nickname
1174.Dq pinky ,
1175using the standard IRC port, 6667:
1176.Bd -literal -offset 4n
1177$ ssh -f -L 6667:localhost:6667 server.example.com sleep 10
1178$ irc -c '#users' pinky IRC/127.0.0.1
1179.Ed
1180.Pp
1181The
1182.Fl f
1183option backgrounds
1184.Nm
1185and the remote command
1186.Dq sleep 10
1187is specified to allow an amount of time
1188(10 seconds, in the example)
1189to start the program which is going to use the tunnel.
1190If no connections are made within the time specified,
1191.Nm
1192will exit.
1193.Sh X11 FORWARDING
1194If the
1195.Cm ForwardX11
1196variable is set to
1197.Dq yes
1198(or see the description of the
1199.Fl X ,
1200.Fl x ,
1201and
1202.Fl Y
1203options above)
1204and the user is using X11 (the
1205.Ev DISPLAY
1206environment variable is set), the connection to the X11 display is
1207automatically forwarded to the remote side in such a way that any X11
1208programs started from the shell (or command) will go through the
1209encrypted channel, and the connection to the real X server will be made
1210from the local machine.
1211The user should not manually set
1212.Ev DISPLAY .
1213Forwarding of X11 connections can be
1214configured on the command line or in configuration files.
1215.Pp
1216The
1217.Ev DISPLAY
1218value set by
1219.Nm
1220will point to the server machine, but with a display number greater than zero.
1221This is normal, and happens because
1222.Nm
1223creates a
1224.Dq proxy
1225X server on the server machine for forwarding the
1226connections over the encrypted channel.
1227.Pp
1228.Nm
1229will also automatically set up Xauthority data on the server machine.
1230For this purpose, it will generate a random authorization cookie,
1231store it in Xauthority on the server, and verify that any forwarded
1232connections carry this cookie and replace it by the real cookie when
1233the connection is opened.
1234The real authentication cookie is never
1235sent to the server machine (and no cookies are sent in the plain).
1236.Pp
1237If the
1238.Cm ForwardAgent
1239variable is set to
1240.Dq yes
1241(or see the description of the
1242.Fl A
1243and
1244.Fl a
1245options above) and
1246the user is using an authentication agent, the connection to the agent
1247is automatically forwarded to the remote side.
1248.Sh VERIFYING HOST KEYS
1249When connecting to a server for the first time,
1250a fingerprint of the server's public key is presented to the user
1251(unless the option
1252.Cm StrictHostKeyChecking
1253has been disabled).
1254Fingerprints can be determined using
1255.Xr ssh-keygen 1 :
1256.Pp
1257.Dl $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
1258.Pp
1259If the fingerprint is already known, it can be matched
1260and the key can be accepted or rejected.
1261If only legacy (MD5) fingerprints for the server are available, the
1262.Xr ssh-keygen 1
1263.Fl E
1264option may be used to downgrade the fingerprint algorithm to match.
1265.Pp
1266Because of the difficulty of comparing host keys
1267just by looking at fingerprint strings,
1268there is also support to compare host keys visually,
1269using
1270.Em random art .
1271By setting the
1272.Cm VisualHostKey
1273option to
1274.Dq yes ,
1275a small ASCII graphic gets displayed on every login to a server, no matter
1276if the session itself is interactive or not.
1277By learning the pattern a known server produces, a user can easily
1278find out that the host key has changed when a completely different pattern
1279is displayed.
1280Because these patterns are not unambiguous however, a pattern that looks
1281similar to the pattern remembered only gives a good probability that the
1282host key is the same, not guaranteed proof.
1283.Pp
1284To get a listing of the fingerprints along with their random art for
1285all known hosts, the following command line can be used:
1286.Pp
1287.Dl $ ssh-keygen -lv -f ~/.ssh/known_hosts
1288.Pp
1289If the fingerprint is unknown,
1290an alternative method of verification is available:
1291SSH fingerprints verified by DNS.
1292An additional resource record (RR),
1293SSHFP,
1294is added to a zonefile
1295and the connecting client is able to match the fingerprint
1296with that of the key presented.
1297.Pp
1298In this example, we are connecting a client to a server,
1299.Dq host.example.com .
1300The SSHFP resource records should first be added to the zonefile for
1301host.example.com:
1302.Bd -literal -offset indent
1303$ ssh-keygen -r host.example.com.
1304.Ed
1305.Pp
1306The output lines will have to be added to the zonefile.
1307To check that the zone is answering fingerprint queries:
1308.Pp
1309.Dl $ dig -t SSHFP host.example.com
1310.Pp
1311Finally the client connects:
1312.Bd -literal -offset indent
1313$ ssh -o "VerifyHostKeyDNS ask" host.example.com
1314[...]
1315Matching host key fingerprint found in DNS.
1316Are you sure you want to continue connecting (yes/no)?
1317.Ed
1318.Pp
1319See the
1320.Cm VerifyHostKeyDNS
1321option in
1322.Xr ssh_config 5
1323for more information.
1324.Sh SSH-BASED VIRTUAL PRIVATE NETWORKS
1325.Nm
1326contains support for Virtual Private Network (VPN) tunnelling
1327using the
1328.Xr tun 4
1329network pseudo-device,
1330allowing two networks to be joined securely.
1331The
1332.Xr sshd_config 5
1333configuration option
1334.Cm PermitTunnel
1335controls whether the server supports this,
1336and at what level (layer 2 or 3 traffic).
1337.Pp
1338The following example would connect client network 10.0.50.0/24
1339with remote network 10.0.99.0/24 using a point-to-point connection
1340from 10.1.1.1 to 10.1.1.2,
1341provided that the SSH server running on the gateway to the remote network,
1342at 192.168.1.15, allows it.
1343.Pp
1344On the client:
1345.Bd -literal -offset indent
1346# ssh -f -w 0:1 192.168.1.15 true
1347# ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
1348# route add 10.0.99.0/24 10.1.1.2
1349.Ed
1350.Pp
1351On the server:
1352.Bd -literal -offset indent
1353# ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
1354# route add 10.0.50.0/24 10.1.1.1
1355.Ed
1356.Pp
1357Client access may be more finely tuned via the
1358.Pa /root/.ssh/authorized_keys
1359file (see below) and the
1360.Cm PermitRootLogin
1361server option.
1362The following entry would permit connections on
1363.Xr tun 4
1364device 1 from user
1365.Dq jane
1366and on tun device 2 from user
1367.Dq john ,
1368if
1369.Cm PermitRootLogin
1370is set to
1371.Dq forced-commands-only :
1372.Bd -literal -offset 2n
1373tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
1374tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
1375.Ed
1376.Pp
1377Since an SSH-based setup entails a fair amount of overhead,
1378it may be more suited to temporary setups,
1379such as for wireless VPNs.
1380More permanent VPNs are better provided by tools such as
1381.Xr ipsecctl 8
1382and
1383.Xr isakmpd 8 .
1384.Sh ENVIRONMENT
1385.Nm
1386will normally set the following environment variables:
1387.Bl -tag -width "SSH_ORIGINAL_COMMAND"
1388.It Ev DISPLAY
1389The
1390.Ev DISPLAY
1391variable indicates the location of the X11 server.
1392It is automatically set by
1393.Nm
1394to point to a value of the form
1395.Dq hostname:n ,
1396where
1397.Dq hostname
1398indicates the host where the shell runs, and
1399.Sq n
1400is an integer \*(Ge 1.
1401.Nm
1402uses this special value to forward X11 connections over the secure
1403channel.
1404The user should normally not set
1405.Ev DISPLAY
1406explicitly, as that
1407will render the X11 connection insecure (and will require the user to
1408manually copy any required authorization cookies).
1409.It Ev HOME
1410Set to the path of the user's home directory.
1411.It Ev LOGNAME
1412Synonym for
1413.Ev USER ;
1414set for compatibility with systems that use this variable.
1415.It Ev MAIL
1416Set to the path of the user's mailbox.
1417.It Ev PATH
1418Set to the default
1419.Ev PATH ,
1420as specified when compiling
1421.Nm .
1422.It Ev SSH_ASKPASS
1423If
1424.Nm
1425needs a passphrase, it will read the passphrase from the current
1426terminal if it was run from a terminal.
1427If
1428.Nm
1429does not have a terminal associated with it but
1430.Ev DISPLAY
1431and
1432.Ev SSH_ASKPASS
1433are set, it will execute the program specified by
1434.Ev SSH_ASKPASS
1435and open an X11 window to read the passphrase.
1436This is particularly useful when calling
1437.Nm
1438from a
1439.Pa .xsession
1440or related script.
1441(Note that on some machines it
1442may be necessary to redirect the input from
1443.Pa /dev/null
1444to make this work.)
1445.It Ev SSH_ASKPASS_REQUIRE
1446Allows further control over the use of an askpass program.
1447If this variable is set to
1448.Dq never
1449then
1450.Nm
1451will never attempt to use one.
1452If it is set to
1453.Dq prefer ,
1454then
1455.Nm
1456will prefer to use the askpass program instead of the TTY when requesting
1457passwords.
1458Finally, if the variable is set to
1459.Dq force ,
1460then the askpass program will be used for all passphrase input regardless
1461of whether
1462.Ev DISPLAY
1463is set.
1464.It Ev SSH_AUTH_SOCK
1465Identifies the path of a
1466.Ux Ns -domain
1467socket used to communicate with the agent.
1468.It Ev SSH_CONNECTION
1469Identifies the client and server ends of the connection.
1470The variable contains
1471four space-separated values: client IP address, client port number,
1472server IP address, and server port number.
1473.It Ev SSH_ORIGINAL_COMMAND
1474This variable contains the original command line if a forced command
1475is executed.
1476It can be used to extract the original arguments.
1477.It Ev SSH_TTY
1478This is set to the name of the tty (path to the device) associated
1479with the current shell or command.
1480If the current session has no tty,
1481this variable is not set.
1482.It Ev SSH_TUNNEL
1483Optionally set by
1484.Xr sshd 8
1485to contain the interface names assigned if tunnel forwarding was
1486requested by the client.
1487.It Ev SSH_USER_AUTH
1488Optionally set by
1489.Xr sshd 8 ,
1490this variable may contain a pathname to a file that lists the authentication
1491methods successfully used when the session was established, including any
1492public keys that were used.
1493.It Ev TZ
1494This variable is set to indicate the present time zone if it
1495was set when the daemon was started (i.e. the daemon passes the value
1496on to new connections).
1497.It Ev USER
1498Set to the name of the user logging in.
1499.El
1500.Pp
1501Additionally,
1502.Nm
1503reads
1504.Pa ~/.ssh/environment ,
1505and adds lines of the format
1506.Dq VARNAME=value
1507to the environment if the file exists and users are allowed to
1508change their environment.
1509For more information, see the
1510.Cm PermitUserEnvironment
1511option in
1512.Xr sshd_config 5 .
1513.Sh FILES
1514.Bl -tag -width Ds -compact
1515.It Pa ~/.rhosts
1516This file is used for host-based authentication (see above).
1517On some machines this file may need to be
1518world-readable if the user's home directory is on an NFS partition,
1519because
1520.Xr sshd 8
1521reads it as root.
1522Additionally, this file must be owned by the user,
1523and must not have write permissions for anyone else.
1524The recommended
1525permission for most machines is read/write for the user, and not
1526accessible by others.
1527.Pp
1528.It Pa ~/.shosts
1529This file is used in exactly the same way as
1530.Pa .rhosts ,
1531but allows host-based authentication without permitting login with
1532rlogin/rsh.
1533.Pp
1534.It Pa ~/.ssh/
1535This directory is the default location for all user-specific configuration
1536and authentication information.
1537There is no general requirement to keep the entire contents of this directory
1538secret, but the recommended permissions are read/write/execute for the user,
1539and not accessible by others.
1540.Pp
1541.It Pa ~/.ssh/authorized_keys
1542Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1543that can be used for logging in as this user.
1544The format of this file is described in the
1545.Xr sshd 8
1546manual page.
1547This file is not highly sensitive, but the recommended
1548permissions are read/write for the user, and not accessible by others.
1549.Pp
1550.It Pa ~/.ssh/config
1551This is the per-user configuration file.
1552The file format and configuration options are described in
1553.Xr ssh_config 5 .
1554Because of the potential for abuse, this file must have strict permissions:
1555read/write for the user, and not writable by others.
1556.Pp
1557.It Pa ~/.ssh/environment
1558Contains additional definitions for environment variables; see
1559.Sx ENVIRONMENT ,
1560above.
1561.Pp
1562.It Pa ~/.ssh/id_dsa
1563.It Pa ~/.ssh/id_ecdsa
1564.It Pa ~/.ssh/id_ecdsa_sk
1565.It Pa ~/.ssh/id_ed25519
1566.It Pa ~/.ssh/id_ed25519_sk
1567.It Pa ~/.ssh/id_rsa
1568Contains the private key for authentication.
1569These files
1570contain sensitive data and should be readable by the user but not
1571accessible by others (read/write/execute).
1572.Nm
1573will simply ignore a private key file if it is accessible by others.
1574It is possible to specify a passphrase when
1575generating the key which will be used to encrypt the
1576sensitive part of this file using AES-128.
1577.Pp
1578.It Pa ~/.ssh/id_dsa.pub
1579.It Pa ~/.ssh/id_ecdsa.pub
1580.It Pa ~/.ssh/id_ecdsa_sk.pub
1581.It Pa ~/.ssh/id_ed25519.pub
1582.It Pa ~/.ssh/id_ed25519_sk.pub
1583.It Pa ~/.ssh/id_rsa.pub
1584Contains the public key for authentication.
1585These files are not
1586sensitive and can (but need not) be readable by anyone.
1587.Pp
1588.It Pa ~/.ssh/known_hosts
1589Contains a list of host keys for all hosts the user has logged into
1590that are not already in the systemwide list of known host keys.
1591See
1592.Xr sshd 8
1593for further details of the format of this file.
1594.Pp
1595.It Pa ~/.ssh/rc
1596Commands in this file are executed by
1597.Nm
1598when the user logs in, just before the user's shell (or command) is
1599started.
1600See the
1601.Xr sshd 8
1602manual page for more information.
1603.Pp
1604.It Pa /etc/hosts.equiv
1605This file is for host-based authentication (see above).
1606It should only be writable by root.
1607.Pp
1608.It Pa /etc/shosts.equiv
1609This file is used in exactly the same way as
1610.Pa hosts.equiv ,
1611but allows host-based authentication without permitting login with
1612rlogin/rsh.
1613.Pp
1614.It Pa /etc/ssh/ssh_config
1615Systemwide configuration file.
1616The file format and configuration options are described in
1617.Xr ssh_config 5 .
1618.Pp
1619.It Pa /etc/ssh/ssh_host_key
1620.It Pa /etc/ssh/ssh_host_dsa_key
1621.It Pa /etc/ssh/ssh_host_ecdsa_key
1622.It Pa /etc/ssh/ssh_host_ed25519_key
1623.It Pa /etc/ssh/ssh_host_rsa_key
1624These files contain the private parts of the host keys
1625and are used for host-based authentication.
1626.Pp
1627.It Pa /etc/ssh/ssh_known_hosts
1628Systemwide list of known host keys.
1629This file should be prepared by the
1630system administrator to contain the public host keys of all machines in the
1631organization.
1632It should be world-readable.
1633See
1634.Xr sshd 8
1635for further details of the format of this file.
1636.Pp
1637.It Pa /etc/ssh/sshrc
1638Commands in this file are executed by
1639.Nm
1640when the user logs in, just before the user's shell (or command) is started.
1641See the
1642.Xr sshd 8
1643manual page for more information.
1644.El
1645.Sh EXIT STATUS
1646.Nm
1647exits with the exit status of the remote command or with 255
1648if an error occurred.
1649.Sh SEE ALSO
1650.Xr scp 1 ,
1651.Xr sftp 1 ,
1652.Xr ssh-add 1 ,
1653.Xr ssh-agent 1 ,
1654.Xr ssh-keygen 1 ,
1655.Xr ssh-keyscan 1 ,
1656.Xr tun 4 ,
1657.Xr ssh_config 5 ,
1658.Xr ssh-keysign 8 ,
1659.Xr sshd 8
1660.Sh STANDARDS
1661.Rs
1662.%A S. Lehtinen
1663.%A C. Lonvick
1664.%D January 2006
1665.%R RFC 4250
1666.%T The Secure Shell (SSH) Protocol Assigned Numbers
1667.Re
1668.Pp
1669.Rs
1670.%A T. Ylonen
1671.%A C. Lonvick
1672.%D January 2006
1673.%R RFC 4251
1674.%T The Secure Shell (SSH) Protocol Architecture
1675.Re
1676.Pp
1677.Rs
1678.%A T. Ylonen
1679.%A C. Lonvick
1680.%D January 2006
1681.%R RFC 4252
1682.%T The Secure Shell (SSH) Authentication Protocol
1683.Re
1684.Pp
1685.Rs
1686.%A T. Ylonen
1687.%A C. Lonvick
1688.%D January 2006
1689.%R RFC 4253
1690.%T The Secure Shell (SSH) Transport Layer Protocol
1691.Re
1692.Pp
1693.Rs
1694.%A T. Ylonen
1695.%A C. Lonvick
1696.%D January 2006
1697.%R RFC 4254
1698.%T The Secure Shell (SSH) Connection Protocol
1699.Re
1700.Pp
1701.Rs
1702.%A J. Schlyter
1703.%A W. Griffin
1704.%D January 2006
1705.%R RFC 4255
1706.%T Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
1707.Re
1708.Pp
1709.Rs
1710.%A F. Cusack
1711.%A M. Forssen
1712.%D January 2006
1713.%R RFC 4256
1714.%T Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
1715.Re
1716.Pp
1717.Rs
1718.%A J. Galbraith
1719.%A P. Remaker
1720.%D January 2006
1721.%R RFC 4335
1722.%T The Secure Shell (SSH) Session Channel Break Extension
1723.Re
1724.Pp
1725.Rs
1726.%A M. Bellare
1727.%A T. Kohno
1728.%A C. Namprempre
1729.%D January 2006
1730.%R RFC 4344
1731.%T The Secure Shell (SSH) Transport Layer Encryption Modes
1732.Re
1733.Pp
1734.Rs
1735.%A B. Harris
1736.%D January 2006
1737.%R RFC 4345
1738.%T Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol
1739.Re
1740.Pp
1741.Rs
1742.%A M. Friedl
1743.%A N. Provos
1744.%A W. Simpson
1745.%D March 2006
1746.%R RFC 4419
1747.%T Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
1748.Re
1749.Pp
1750.Rs
1751.%A J. Galbraith
1752.%A R. Thayer
1753.%D November 2006
1754.%R RFC 4716
1755.%T The Secure Shell (SSH) Public Key File Format
1756.Re
1757.Pp
1758.Rs
1759.%A D. Stebila
1760.%A J. Green
1761.%D December 2009
1762.%R RFC 5656
1763.%T Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
1764.Re
1765.Pp
1766.Rs
1767.%A A. Perrig
1768.%A D. Song
1769.%D 1999
1770.%O International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)
1771.%T Hash Visualization: a New Technique to improve Real-World Security
1772.Re
1773.Sh AUTHORS
1774OpenSSH is a derivative of the original and free
1775ssh 1.2.12 release by Tatu Ylonen.
1776Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1777Theo de Raadt and Dug Song
1778removed many bugs, re-added newer features and
1779created OpenSSH.
1780Markus Friedl contributed the support for SSH
1781protocol versions 1.5 and 2.0.
1782