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