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