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