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