Debian Codegraph @

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