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