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