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