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