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