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