Debian Codegraph @

upstream/fedora-rawhide/man1/ssh.1

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