Annotation of src/usr.bin/ssh/ssh.1, Revision 1.304
1.1 deraadt 1: .\" -*- nroff -*-
2: .\"
3: .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4: .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5: .\" All rights reserved
6: .\"
1.59 deraadt 7: .\" As far as I am concerned, the code I have written for this software
8: .\" can be used freely for any purpose. Any derived versions of this
9: .\" software must be clearly marked as such, and if the derived work is
10: .\" incompatible with the protocol description in the RFC file, it must be
11: .\" called by a name other than "ssh" or "Secure Shell".
12: .\"
1.93 deraadt 13: .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
14: .\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
15: .\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
1.59 deraadt 16: .\"
17: .\" Redistribution and use in source and binary forms, with or without
18: .\" modification, are permitted provided that the following conditions
19: .\" are met:
20: .\" 1. Redistributions of source code must retain the above copyright
21: .\" notice, this list of conditions and the following disclaimer.
22: .\" 2. Redistributions in binary form must reproduce the above copyright
23: .\" notice, this list of conditions and the following disclaimer in the
24: .\" documentation and/or other materials provided with the distribution.
1.1 deraadt 25: .\"
1.59 deraadt 26: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27: .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28: .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29: .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30: .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31: .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32: .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33: .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34: .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35: .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.1 deraadt 36: .\"
1.304 ! jmc 37: .\" $OpenBSD: ssh.1,v 1.303 2010/03/26 00:26:58 djm Exp $
! 38: .Dd $Mdocdate: March 26 2010 $
1.2 deraadt 39: .Dt SSH 1
40: .Os
41: .Sh NAME
42: .Nm ssh
1.96 deraadt 43: .Nd OpenSSH SSH client (remote login program)
1.2 deraadt 44: .Sh SYNOPSIS
45: .Nm ssh
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.210 djm 49: .Oo Fl D\ \&
50: .Sm off
51: .Oo Ar bind_address : Oc
52: .Ar port
53: .Sm on
54: .Oc
1.2 deraadt 55: .Op Fl e Ar escape_char
1.176 jmc 56: .Op Fl F Ar configfile
1.292 jmc 57: .Op Fl I Ar pkcs11
1.211 jmc 58: .Bk -words
1.2 deraadt 59: .Op Fl i Ar identity_file
1.211 jmc 60: .Ek
1.202 jmc 61: .Oo Fl L\ \&
1.12 aaron 62: .Sm off
1.200 djm 63: .Oo Ar bind_address : Oc
1.202 jmc 64: .Ar port : host : hostport
1.12 aaron 65: .Sm on
66: .Oc
1.211 jmc 67: .Bk -words
1.176 jmc 68: .Op Fl l Ar login_name
1.211 jmc 69: .Ek
1.176 jmc 70: .Op Fl m Ar mac_spec
1.198 djm 71: .Op Fl O Ar ctl_cmd
1.176 jmc 72: .Op Fl o Ar option
73: .Op Fl p Ar port
1.202 jmc 74: .Oo Fl R\ \&
1.12 aaron 75: .Sm off
1.200 djm 76: .Oo Ar bind_address : Oc
1.202 jmc 77: .Ar port : host : hostport
1.12 aaron 78: .Sm on
79: .Oc
1.198 djm 80: .Op Fl S Ar ctl_path
1.290 dtucker 81: .Op Fl W Ar host : Ns Ar port
1.261 stevesk 82: .Oo Fl w Ar local_tun Ns
83: .Op : Ns Ar remote_tun Oc
1.176 jmc 84: .Oo Ar user Ns @ Oc Ns Ar hostname
1.2 deraadt 85: .Op Ar command
1.44 aaron 86: .Sh DESCRIPTION
1.2 deraadt 87: .Nm
1.96 deraadt 88: (SSH client) is a program for logging into a remote machine and for
1.40 aaron 89: executing commands on a remote machine.
1.176 jmc 90: It is intended to replace rlogin and rsh,
91: and provide secure encrypted communications between
1.40 aaron 92: two untrusted hosts over an insecure network.
1.247 jmc 93: X11 connections and arbitrary TCP ports
1.176 jmc 94: can also be forwarded over the secure channel.
1.2 deraadt 95: .Pp
96: .Nm
1.44 aaron 97: connects and logs into the specified
1.176 jmc 98: .Ar hostname
99: (with optional
100: .Ar user
101: name).
1.1 deraadt 102: The user must prove
1.49 markus 103: his/her identity to the remote machine using one of several methods
1.221 jmc 104: depending on the protocol version used (see below).
1.49 markus 105: .Pp
1.176 jmc 106: If
107: .Ar command
108: is specified,
1.219 jmc 109: it is executed on the remote host instead of a login shell.
1.2 deraadt 110: .Pp
1.218 jmc 111: The options are as follows:
112: .Bl -tag -width Ds
113: .It Fl 1
114: Forces
1.2 deraadt 115: .Nm
1.218 jmc 116: to try protocol version 1 only.
117: .It Fl 2
118: Forces
1.2 deraadt 119: .Nm
1.218 jmc 120: to try protocol version 2 only.
121: .It Fl 4
122: Forces
1.2 deraadt 123: .Nm
1.218 jmc 124: to use IPv4 addresses only.
125: .It Fl 6
126: Forces
1.2 deraadt 127: .Nm
1.218 jmc 128: to use IPv6 addresses only.
129: .It Fl A
130: Enables forwarding of the authentication agent connection.
131: This can also be specified on a per-host basis in a configuration file.
1.2 deraadt 132: .Pp
1.218 jmc 133: Agent forwarding should be enabled with caution.
134: Users with the ability to bypass file permissions on the remote host
1.285 sobrado 135: (for the agent's
1.286 sobrado 136: .Ux Ns -domain
137: socket) can access the local agent through the forwarded connection.
1.218 jmc 138: An attacker cannot obtain key material from the agent,
139: however they can perform operations on the keys that enable them to
140: authenticate using the identities loaded into the agent.
141: .It Fl a
142: Disables forwarding of the authentication agent connection.
143: .It Fl b Ar bind_address
144: Use
145: .Ar bind_address
146: on the local machine as the source address
147: of the connection.
148: Only useful on systems with more than one address.
149: .It Fl C
150: Requests compression of all data (including stdin, stdout, stderr, and
1.247 jmc 151: data for forwarded X11 and TCP connections).
1.218 jmc 152: The compression algorithm is the same used by
153: .Xr gzip 1 ,
154: and the
155: .Dq level
156: can be controlled by the
157: .Cm CompressionLevel
158: option for protocol version 1.
159: Compression is desirable on modem lines and other
160: slow connections, but will only slow down things on fast networks.
161: The default value can be set on a host-by-host basis in the
162: configuration files; see the
163: .Cm Compression
164: option.
165: .It Fl c Ar cipher_spec
166: Selects the cipher specification for encrypting the session.
1.2 deraadt 167: .Pp
1.218 jmc 168: Protocol version 1 allows specification of a single cipher.
169: The supported values are
170: .Dq 3des ,
1.220 jmc 171: .Dq blowfish ,
1.218 jmc 172: and
173: .Dq des .
174: .Ar 3des
175: (triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
176: It is believed to be secure.
177: .Ar blowfish
178: is a fast block cipher; it appears very secure and is much faster than
179: .Ar 3des .
180: .Ar des
181: is only supported in the
1.2 deraadt 182: .Nm
1.218 jmc 183: client for interoperability with legacy protocol 1 implementations
184: that do not support the
185: .Ar 3des
186: cipher.
187: Its use is strongly discouraged due to cryptographic weaknesses.
188: The default is
189: .Dq 3des .
1.49 markus 190: .Pp
1.230 jmc 191: For protocol version 2,
1.218 jmc 192: .Ar cipher_spec
193: is a comma-separated list of ciphers
194: listed in order of preference.
1.283 jmc 195: See the
196: .Cm Ciphers
197: keyword for more information.
1.218 jmc 198: .It Fl D Xo
199: .Sm off
200: .Oo Ar bind_address : Oc
201: .Ar port
202: .Sm on
203: .Xc
204: Specifies a local
205: .Dq dynamic
206: application-level port forwarding.
207: This works by allocating a socket to listen to
208: .Ar port
209: on the local side, optionally bound to the specified
210: .Ar bind_address .
211: Whenever a connection is made to this port, the
212: connection is forwarded over the secure channel, and the application
213: protocol is then used to determine where to connect to from the
214: remote machine.
215: Currently the SOCKS4 and SOCKS5 protocols are supported, and
1.107 markus 216: .Nm
1.218 jmc 217: will act as a SOCKS server.
218: Only root can forward privileged ports.
219: Dynamic port forwardings can also be specified in the configuration file.
1.49 markus 220: .Pp
1.218 jmc 221: IPv6 addresses can be specified with an alternative syntax:
222: .Sm off
223: .Xo
224: .Op Ar bind_address No /
225: .Ar port
226: .Xc
227: .Sm on
228: or by enclosing the address in square brackets.
229: Only the superuser can forward privileged ports.
230: By default, the local port is bound in accordance with the
231: .Cm GatewayPorts
232: setting.
233: However, an explicit
234: .Ar bind_address
235: may be used to bind the connection to a specific address.
236: The
237: .Ar bind_address
238: of
239: .Dq localhost
240: indicates that the listening port be bound for local use only, while an
241: empty address or
242: .Sq *
243: indicates that the port should be available from all interfaces.
1.229 jmc 244: .It Fl e Ar escape_char
1.218 jmc 245: Sets the escape character for sessions with a pty (default:
246: .Ql ~ ) .
247: The escape character is only recognized at the beginning of a line.
248: The escape character followed by a dot
249: .Pq Ql \&.
250: closes the connection;
251: followed by control-Z suspends the connection;
252: and followed by itself sends the escape character once.
253: Setting the character to
1.2 deraadt 254: .Dq none
1.218 jmc 255: disables any escapes and makes the session fully transparent.
256: .It Fl F Ar configfile
257: Specifies an alternative per-user configuration file.
258: If a configuration file is given on the command line,
259: the system-wide configuration file
260: .Pq Pa /etc/ssh/ssh_config
261: will be ignored.
262: The default for the per-user configuration file is
263: .Pa ~/.ssh/config .
264: .It Fl f
265: Requests
266: .Nm
267: to go to background just before command execution.
268: This is useful if
1.176 jmc 269: .Nm
1.218 jmc 270: is going to ask for passwords or passphrases, but the user
271: wants it in the background.
272: This implies
273: .Fl n .
274: The recommended way to start X11 programs at a remote site is with
275: something like
276: .Ic ssh -f host xterm .
1.277 djm 277: .Pp
278: If the
279: .Cm ExitOnForwardFailure
280: configuration option is set to
281: .Dq yes ,
282: then a client started with
283: .Fl f
284: will wait for all remote port forwards to be successfully established
285: before placing itself in the background.
1.218 jmc 286: .It Fl g
287: Allows remote hosts to connect to local forwarded ports.
1.291 markus 288: .It Fl I Ar pkcs11
1.294 jmc 289: Specify the PKCS#11 shared library
1.176 jmc 290: .Nm
1.293 markus 291: should use to communicate with a PKCS#11 token providing the user's
1.218 jmc 292: private RSA key.
293: .It Fl i Ar identity_file
294: Selects a file from which the identity (private key) for
295: RSA or DSA authentication is read.
296: The default is
297: .Pa ~/.ssh/identity
298: for protocol version 1, and
299: .Pa ~/.ssh/id_rsa
1.149 jakob 300: and
1.218 jmc 301: .Pa ~/.ssh/id_dsa
302: for protocol version 2.
303: Identity files may also be specified on
304: a per-host basis in the configuration file.
305: It is possible to have multiple
306: .Fl i
307: options (and multiple identities specified in
308: configuration files).
1.302 djm 309: .Nm
310: will also try to load certificate information from the filename obtained
311: by appending
312: .Pa -cert.pub
313: to identity filenames.
1.269 djm 314: .It Fl K
315: Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
316: credentials to the server.
1.218 jmc 317: .It Fl k
318: Disables forwarding (delegation) of GSSAPI credentials to the server.
319: .It Fl L Xo
320: .Sm off
321: .Oo Ar bind_address : Oc
322: .Ar port : host : hostport
323: .Sm on
324: .Xc
325: Specifies that the given port on the local (client) host is to be
326: forwarded to the given host and port on the remote side.
327: This works by allocating a socket to listen to
328: .Ar port
329: on the local side, optionally bound to the specified
330: .Ar bind_address .
331: Whenever a connection is made to this port, the
332: connection is forwarded over the secure channel, and a connection is
333: made to
334: .Ar host
335: port
336: .Ar hostport
337: from the remote machine.
338: Port forwardings can also be specified in the configuration file.
339: IPv6 addresses can be specified with an alternative syntax:
340: .Sm off
341: .Xo
342: .Op Ar bind_address No /
343: .Ar port No / Ar host No /
344: .Ar hostport
345: .Xc
346: .Sm on
347: or by enclosing the address in square brackets.
348: Only the superuser can forward privileged ports.
349: By default, the local port is bound in accordance with the
350: .Cm GatewayPorts
351: setting.
352: However, an explicit
353: .Ar bind_address
354: may be used to bind the connection to a specific address.
1.2 deraadt 355: The
1.218 jmc 356: .Ar bind_address
357: of
358: .Dq localhost
359: indicates that the listening port be bound for local use only, while an
360: empty address or
361: .Sq *
362: indicates that the port should be available from all interfaces.
363: .It Fl l Ar login_name
364: Specifies the user to log in as on the remote machine.
365: This also may be specified on a per-host basis in the configuration file.
366: .It Fl M
367: Places the
368: .Nm
369: client into
370: .Dq master
371: mode for connection sharing.
1.231 stevesk 372: Multiple
373: .Fl M
374: options places
375: .Nm
376: into
377: .Dq master
378: mode with confirmation required before slave connections are accepted.
1.218 jmc 379: Refer to the description of
380: .Cm ControlMaster
381: in
382: .Xr ssh_config 5
383: for details.
384: .It Fl m Ar mac_spec
385: Additionally, for protocol version 2 a comma-separated list of MAC
386: (message authentication code) algorithms can
387: be specified in order of preference.
388: See the
389: .Cm MACs
390: keyword for more information.
391: .It Fl N
392: Do not execute a remote command.
393: This is useful for just forwarding ports
394: (protocol version 2 only).
395: .It Fl n
396: Redirects stdin from
397: .Pa /dev/null
398: (actually, prevents reading from stdin).
399: This must be used when
1.2 deraadt 400: .Nm
1.218 jmc 401: is run in the background.
402: A common trick is to use this to run X11 programs on a remote machine.
403: For example,
404: .Ic ssh -n shadows.cs.hut.fi emacs &
405: will start an emacs on shadows.cs.hut.fi, and the X11
406: connection will be automatically forwarded over an encrypted channel.
407: The
1.2 deraadt 408: .Nm
1.218 jmc 409: program will be put in the background.
410: (This does not work if
1.2 deraadt 411: .Nm
1.218 jmc 412: needs to ask for a password or passphrase; see also the
413: .Fl f
414: option.)
415: .It Fl O Ar ctl_cmd
416: Control an active connection multiplexing master process.
417: When the
418: .Fl O
419: option is specified, the
420: .Ar ctl_cmd
421: argument is interpreted and passed to the master process.
422: Valid commands are:
423: .Dq check
424: (check that the master process is running) and
425: .Dq exit
426: (request the master to exit).
427: .It Fl o Ar option
428: Can be used to give options in the format used in the configuration file.
429: This is useful for specifying options for which there is no separate
430: command-line flag.
431: For full details of the options listed below, and their possible values, see
432: .Xr ssh_config 5 .
1.2 deraadt 433: .Pp
1.218 jmc 434: .Bl -tag -width Ds -offset indent -compact
435: .It AddressFamily
436: .It BatchMode
437: .It BindAddress
438: .It ChallengeResponseAuthentication
439: .It CheckHostIP
440: .It Cipher
441: .It Ciphers
442: .It ClearAllForwardings
443: .It Compression
444: .It CompressionLevel
445: .It ConnectionAttempts
446: .It ConnectTimeout
447: .It ControlMaster
448: .It ControlPath
449: .It DynamicForward
450: .It EscapeChar
1.263 markus 451: .It ExitOnForwardFailure
1.218 jmc 452: .It ForwardAgent
453: .It ForwardX11
454: .It ForwardX11Trusted
455: .It GatewayPorts
456: .It GlobalKnownHostsFile
457: .It GSSAPIAuthentication
458: .It GSSAPIDelegateCredentials
459: .It HashKnownHosts
460: .It Host
461: .It HostbasedAuthentication
462: .It HostKeyAlgorithms
463: .It HostKeyAlias
464: .It HostName
465: .It IdentityFile
466: .It IdentitiesOnly
467: .It KbdInteractiveDevices
468: .It LocalCommand
469: .It LocalForward
470: .It LogLevel
471: .It MACs
472: .It NoHostAuthenticationForLocalhost
473: .It NumberOfPasswordPrompts
474: .It PasswordAuthentication
475: .It PermitLocalCommand
1.291 markus 476: .It PKCS11Provider
1.218 jmc 477: .It Port
478: .It PreferredAuthentications
479: .It Protocol
480: .It ProxyCommand
481: .It PubkeyAuthentication
1.251 dtucker 482: .It RekeyLimit
1.218 jmc 483: .It RemoteForward
484: .It RhostsRSAAuthentication
485: .It RSAAuthentication
486: .It SendEnv
487: .It ServerAliveInterval
488: .It ServerAliveCountMax
489: .It StrictHostKeyChecking
490: .It TCPKeepAlive
491: .It Tunnel
492: .It TunnelDevice
493: .It UsePrivilegedPort
494: .It User
495: .It UserKnownHostsFile
496: .It VerifyHostKeyDNS
1.276 jmc 497: .It VisualHostKey
1.218 jmc 498: .It XAuthLocation
499: .El
500: .It Fl p Ar port
501: Port to connect to on the remote host.
502: This can be specified on a
503: per-host basis in the configuration file.
504: .It Fl q
505: Quiet mode.
1.271 djm 506: Causes most warning and diagnostic messages to be suppressed.
1.218 jmc 507: .It Fl R Xo
508: .Sm off
509: .Oo Ar bind_address : Oc
510: .Ar port : host : hostport
511: .Sm on
512: .Xc
513: Specifies that the given port on the remote (server) host is to be
514: forwarded to the given host and port on the local side.
515: This works by allocating a socket to listen to
516: .Ar port
517: on the remote side, and whenever a connection is made to this port, the
518: connection is forwarded over the secure channel, and a connection is
519: made to
520: .Ar host
521: port
522: .Ar hostport
523: from the local machine.
1.2 deraadt 524: .Pp
1.218 jmc 525: Port forwardings can also be specified in the configuration file.
526: Privileged ports can be forwarded only when
527: logging in as root on the remote machine.
528: IPv6 addresses can be specified by enclosing the address in square braces or
529: using an alternative syntax:
530: .Sm off
531: .Xo
532: .Op Ar bind_address No /
533: .Ar host No / Ar port No /
534: .Ar hostport
535: .Xc .
536: .Sm on
1.194 jakob 537: .Pp
1.218 jmc 538: By default, the listening socket on the server will be bound to the loopback
539: interface only.
1.280 tobias 540: This may be overridden by specifying a
1.218 jmc 541: .Ar bind_address .
542: An empty
543: .Ar bind_address ,
544: or the address
545: .Ql * ,
546: indicates that the remote socket should listen on all interfaces.
547: Specifying a remote
548: .Ar bind_address
549: will only succeed if the server's
550: .Cm GatewayPorts
551: option is enabled (see
552: .Xr sshd_config 5 ) .
1.281 djm 553: .Pp
554: If the
555: .Ar port
556: argument is
1.282 djm 557: .Ql 0 ,
1.281 djm 558: the listen port will be dynamically allocated on the server and reported
559: to the client at run time.
1.218 jmc 560: .It Fl S Ar ctl_path
1.304 ! jmc 561: Specifies the location of a control socket for connection sharing,
1.303 djm 562: or the string
563: .Dq none
564: to disable connection sharing.
1.218 jmc 565: Refer to the description of
566: .Cm ControlPath
567: and
568: .Cm ControlMaster
569: in
570: .Xr ssh_config 5
571: for details.
572: .It Fl s
573: May be used to request invocation of a subsystem on the remote system.
574: Subsystems are a feature of the SSH2 protocol which facilitate the use
575: of SSH as a secure transport for other applications (eg.\&
576: .Xr sftp 1 ) .
577: The subsystem is specified as the remote command.
578: .It Fl T
579: Disable pseudo-tty allocation.
580: .It Fl t
581: Force pseudo-tty allocation.
582: This can be used to execute arbitrary
583: screen-based programs on a remote machine, which can be very useful,
1.257 jmc 584: e.g. when implementing menu services.
1.218 jmc 585: Multiple
586: .Fl t
587: options force tty allocation, even if
1.194 jakob 588: .Nm
1.218 jmc 589: has no local tty.
590: .It Fl V
591: Display the version number and exit.
592: .It Fl v
593: Verbose mode.
594: Causes
1.176 jmc 595: .Nm
1.218 jmc 596: to print debugging messages about its progress.
597: This is helpful in
598: debugging connection, authentication, and configuration problems.
599: Multiple
600: .Fl v
601: options increase the verbosity.
602: The maximum is 3.
1.290 dtucker 603: .It Fl W Ar host : Ns Ar port
604: Requests that standard input and output on the client be forwarded to
605: .Ar host
606: on
607: .Ar port
608: over the secure channel.
609: Implies
610: .Fl N ,
611: .Fl T ,
612: .Cm ExitOnForwardFailure
613: and
614: .Cm ClearAllForwardings
615: and works with Protocol version 2 only.
1.261 stevesk 616: .It Fl w Xo
617: .Ar local_tun Ns Op : Ns Ar remote_tun
618: .Xc
619: Requests
620: tunnel
621: device forwarding with the specified
1.218 jmc 622: .Xr tun 4
1.261 stevesk 623: devices between the client
624: .Pq Ar local_tun
625: and the server
626: .Pq Ar remote_tun .
627: .Pp
1.228 jmc 628: The devices may be specified by numerical ID or the keyword
629: .Dq any ,
630: which uses the next available tunnel device.
1.261 stevesk 631: If
632: .Ar remote_tun
633: is not specified, it defaults to
634: .Dq any .
1.228 jmc 635: See also the
1.218 jmc 636: .Cm Tunnel
1.261 stevesk 637: and
638: .Cm TunnelDevice
639: directives in
1.218 jmc 640: .Xr ssh_config 5 .
1.261 stevesk 641: If the
642: .Cm Tunnel
643: directive is unset, it is set to the default tunnel mode, which is
644: .Dq point-to-point .
1.218 jmc 645: .It Fl X
646: Enables X11 forwarding.
1.54 markus 647: This can also be specified on a per-host basis in a configuration file.
1.165 stevesk 648: .Pp
1.218 jmc 649: X11 forwarding should be enabled with caution.
1.168 jmc 650: Users with the ability to bypass file permissions on the remote host
1.218 jmc 651: (for the user's X authorization database)
652: can access the local X11 display through the forwarded connection.
653: An attacker may then be able to perform activities such as keystroke monitoring.
654: .Pp
655: For this reason, X11 forwarding is subjected to X11 SECURITY extension
656: restrictions by default.
657: Please refer to the
658: .Nm
659: .Fl Y
660: option and the
661: .Cm ForwardX11Trusted
662: directive in
663: .Xr ssh_config 5
664: for more information.
665: .It Fl x
666: Disables X11 forwarding.
667: .It Fl Y
668: Enables trusted X11 forwarding.
669: Trusted X11 forwardings are not subjected to the X11 SECURITY extension
670: controls.
1.278 djm 671: .It Fl y
672: Send log information using the
673: .Xr syslog 3
674: system module.
675: By default this information is sent to stderr.
1.218 jmc 676: .El
1.224 jmc 677: .Pp
678: .Nm
679: may additionally obtain configuration data from
680: a per-user configuration file and a system-wide configuration file.
681: The file format and configuration options are described in
682: .Xr ssh_config 5 .
683: .Pp
684: .Nm
685: exits with the exit status of the remote command or with 255
686: if an error occurred.
1.222 jmc 687: .Sh AUTHENTICATION
1.249 jmc 688: The OpenSSH SSH client supports SSH protocols 1 and 2.
1.284 jmc 689: The default is to use protocol 2 only,
690: though this can be changed via the
1.222 jmc 691: .Cm Protocol
692: option in
1.284 jmc 693: .Xr ssh_config 5
694: or the
1.222 jmc 695: .Fl 1
696: and
697: .Fl 2
698: options (see above).
699: Both protocols support similar authentication methods,
1.284 jmc 700: but protocol 2 is the default since
1.222 jmc 701: it provides additional mechanisms for confidentiality
702: (the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
1.268 pvalchev 703: and integrity (hmac-md5, hmac-sha1, umac-64, hmac-ripemd160).
1.222 jmc 704: Protocol 1 lacks a strong mechanism for ensuring the
705: integrity of the connection.
706: .Pp
707: The methods available for authentication are:
1.260 jmc 708: GSSAPI-based authentication,
1.222 jmc 709: host-based authentication,
710: public key authentication,
711: challenge-response authentication,
712: and password authentication.
713: Authentication methods are tried in the order specified above,
714: though protocol 2 has a configuration option to change the default order:
715: .Cm PreferredAuthentications .
716: .Pp
717: Host-based authentication works as follows:
1.218 jmc 718: If the machine the user logs in from is listed in
719: .Pa /etc/hosts.equiv
720: or
721: .Pa /etc/shosts.equiv
722: on the remote machine, and the user names are
723: the same on both sides, or if the files
724: .Pa ~/.rhosts
725: or
726: .Pa ~/.shosts
727: exist in the user's home directory on the
728: remote machine and contain a line containing the name of the client
729: machine and the name of the user on that machine, the user is
1.222 jmc 730: considered for login.
731: Additionally, the server
732: .Em must
733: be able to verify the client's
734: host key (see the description of
1.218 jmc 735: .Pa /etc/ssh/ssh_known_hosts
1.189 dtucker 736: and
1.222 jmc 737: .Pa ~/.ssh/known_hosts ,
738: below)
739: for login to be permitted.
1.218 jmc 740: This authentication method closes security holes due to IP
1.222 jmc 741: spoofing, DNS spoofing, and routing spoofing.
1.218 jmc 742: [Note to the administrator:
743: .Pa /etc/hosts.equiv ,
744: .Pa ~/.rhosts ,
745: and the rlogin/rsh protocol in general, are inherently insecure and should be
746: disabled if security is desired.]
1.189 dtucker 747: .Pp
1.222 jmc 748: Public key authentication works as follows:
749: The scheme is based on public-key cryptography,
750: using cryptosystems
751: where encryption and decryption are done using separate keys,
752: and it is unfeasible to derive the decryption key from the encryption key.
1.218 jmc 753: The idea is that each user creates a public/private
754: key pair for authentication purposes.
755: The server knows the public key, and only the user knows the private key.
1.222 jmc 756: .Nm
757: implements public key authentication protocol automatically,
758: using either the RSA or DSA algorithms.
759: Protocol 1 is restricted to using only RSA keys,
760: but protocol 2 may use either.
761: The
762: .Sx HISTORY
763: section of
764: .Xr ssl 8
765: contains a brief discussion of the two algorithms.
1.210 djm 766: .Pp
1.218 jmc 767: The file
768: .Pa ~/.ssh/authorized_keys
769: lists the public keys that are permitted for logging in.
770: When the user logs in, the
1.2 deraadt 771: .Nm
1.218 jmc 772: program tells the server which key pair it would like to use for
773: authentication.
1.222 jmc 774: The client proves that it has access to the private key
775: and the server checks that the corresponding public key
776: is authorized to accept the account.
1.218 jmc 777: .Pp
1.222 jmc 778: The user creates his/her key pair by running
1.218 jmc 779: .Xr ssh-keygen 1 .
780: This stores the private key in
1.207 djm 781: .Pa ~/.ssh/identity
1.222 jmc 782: (protocol 1),
783: .Pa ~/.ssh/id_dsa
784: (protocol 2 DSA),
785: or
786: .Pa ~/.ssh/id_rsa
787: (protocol 2 RSA)
1.218 jmc 788: and stores the public key in
789: .Pa ~/.ssh/identity.pub
1.222 jmc 790: (protocol 1),
791: .Pa ~/.ssh/id_dsa.pub
792: (protocol 2 DSA),
793: or
794: .Pa ~/.ssh/id_rsa.pub
795: (protocol 2 RSA)
1.218 jmc 796: in the user's home directory.
1.222 jmc 797: The user should then copy the public key
1.218 jmc 798: to
799: .Pa ~/.ssh/authorized_keys
1.222 jmc 800: in his/her home directory on the remote machine.
801: The
1.218 jmc 802: .Pa authorized_keys
803: file corresponds to the conventional
804: .Pa ~/.rhosts
805: file, and has one key
1.222 jmc 806: per line, though the lines can be very long.
1.218 jmc 807: After this, the user can log in without giving the password.
808: .Pp
1.301 jmc 809: A variation on public key authentication
810: is available in the form of certificate authentication:
811: instead of a set of public/private keys,
812: signed certificates are used.
813: This has the advantage that a single trusted certification authority
814: can be used in place of many public/private keys.
815: See the
816: .Sx CERTIFICATES
817: section of
818: .Xr ssh-keygen 1
819: for more information.
820: .Pp
821: The most convenient way to use public key or certificate authentication
822: may be with an authentication agent.
1.218 jmc 823: See
824: .Xr ssh-agent 1
825: for more information.
826: .Pp
1.222 jmc 827: Challenge-response authentication works as follows:
828: The server sends an arbitrary
829: .Qq challenge
830: text, and prompts for a response.
831: Protocol 2 allows multiple challenges and responses;
832: protocol 1 is restricted to just one challenge/response.
833: Examples of challenge-response authentication include
834: BSD Authentication (see
835: .Xr login.conf 5 )
836: and PAM (some non-OpenBSD systems).
837: .Pp
838: Finally, if other authentication methods fail,
1.218 jmc 839: .Nm
840: prompts the user for a password.
841: The password is sent to the remote
842: host for checking; however, since all communications are encrypted,
843: the password cannot be seen by someone listening on the network.
1.232 jmc 844: .Pp
845: .Nm
846: automatically maintains and checks a database containing
847: identification for all hosts it has ever been used with.
848: Host keys are stored in
849: .Pa ~/.ssh/known_hosts
850: in the user's home directory.
851: Additionally, the file
852: .Pa /etc/ssh/ssh_known_hosts
853: is automatically checked for known hosts.
854: Any new hosts are automatically added to the user's file.
855: If a host's identification ever changes,
856: .Nm
857: warns about this and disables password authentication to prevent
858: server spoofing or man-in-the-middle attacks,
859: which could otherwise be used to circumvent the encryption.
860: The
861: .Cm StrictHostKeyChecking
862: option can be used to control logins to machines whose
863: host key is not known or has changed.
864: .Pp
1.218 jmc 865: When the user's identity has been accepted by the server, the server
866: either executes the given command, or logs into the machine and gives
867: the user a normal shell on the remote machine.
868: All communication with
869: the remote command or shell will be automatically encrypted.
870: .Pp
871: If a pseudo-terminal has been allocated (normal login session), the
872: user may use the escape characters noted below.
873: .Pp
874: If no pseudo-tty has been allocated,
875: the session is transparent and can be used to reliably transfer binary data.
876: On most systems, setting the escape character to
877: .Dq none
878: will also make the session transparent even if a tty is used.
879: .Pp
880: The session terminates when the command or shell on the remote
1.247 jmc 881: machine exits and all X11 and TCP connections have been closed.
1.223 jmc 882: .Sh ESCAPE CHARACTERS
1.218 jmc 883: When a pseudo-terminal has been requested,
1.2 deraadt 884: .Nm
1.218 jmc 885: supports a number of functions through the use of an escape character.
886: .Pp
887: A single tilde character can be sent as
888: .Ic ~~
889: or by following the tilde by a character other than those described below.
890: The escape character must always follow a newline to be interpreted as
891: special.
892: The escape character can be changed in configuration files using the
893: .Cm EscapeChar
894: configuration directive or on the command line by the
895: .Fl e
896: option.
897: .Pp
898: The supported escapes (assuming the default
899: .Ql ~ )
900: are:
901: .Bl -tag -width Ds
902: .It Cm ~.
903: Disconnect.
904: .It Cm ~^Z
905: Background
1.234 jmc 906: .Nm .
1.218 jmc 907: .It Cm ~#
908: List forwarded connections.
909: .It Cm ~&
910: Background
1.2 deraadt 911: .Nm
1.218 jmc 912: at logout when waiting for forwarded connection / X11 sessions to terminate.
913: .It Cm ~?
914: Display a list of escape characters.
915: .It Cm ~B
916: Send a BREAK to the remote system
917: (only useful for SSH protocol version 2 and if the peer supports it).
918: .It Cm ~C
919: Open command line.
920: Currently this allows the addition of port forwardings using the
1.279 stevesk 921: .Fl L ,
922: .Fl R
1.218 jmc 923: and
1.279 stevesk 924: .Fl D
1.225 jmc 925: options (see above).
1.218 jmc 926: It also allows the cancellation of existing remote port-forwardings
927: using
1.262 stevesk 928: .Sm off
929: .Fl KR Oo Ar bind_address : Oc Ar port .
930: .Sm on
1.218 jmc 931: .Ic !\& Ns Ar command
932: allows the user to execute a local command if the
933: .Ic PermitLocalCommand
934: option is enabled in
1.176 jmc 935: .Xr ssh_config 5 .
1.218 jmc 936: Basic help is available, using the
937: .Fl h
938: option.
939: .It Cm ~R
940: Request rekeying of the connection
941: (only useful for SSH protocol version 2 and if the peer supports it).
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
1287: .It ~/.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.236 jmc 1300: .It ~/.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
1306: .It ~/.ssh/
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.238 jmc 1313: .It ~/.ssh/authorized_keys
1314: Lists the public keys (RSA/DSA) that can be used for logging in as this user.
1315: The format of this file is described in the
1316: .Xr sshd 8
1317: manual page.
1318: This file is not highly sensitive, but the recommended
1319: permissions are read/write for the user, and not accessible by others.
1320: .Pp
1321: .It ~/.ssh/config
1322: This is the per-user configuration file.
1323: The file format and configuration options are described in
1324: .Xr ssh_config 5 .
1325: Because of the potential for abuse, this file must have strict permissions:
1326: read/write for the user, and not accessible by others.
1327: .Pp
1328: .It ~/.ssh/environment
1.239 jmc 1329: Contains additional definitions for environment variables; see
1330: .Sx ENVIRONMENT ,
1.238 jmc 1331: above.
1332: .Pp
1333: .It ~/.ssh/identity
1334: .It ~/.ssh/id_dsa
1335: .It ~/.ssh/id_rsa
1336: Contains the private key for authentication.
1337: These files
1338: contain sensitive data and should be readable by the user but not
1339: accessible by others (read/write/execute).
1340: .Nm
1341: will simply ignore a private key file if it is accessible by others.
1342: It is possible to specify a passphrase when
1343: generating the key which will be used to encrypt the
1344: sensitive part of this file using 3DES.
1345: .Pp
1346: .It ~/.ssh/identity.pub
1347: .It ~/.ssh/id_dsa.pub
1348: .It ~/.ssh/id_rsa.pub
1349: Contains the public key for authentication.
1350: These files are not
1351: sensitive and can (but need not) be readable by anyone.
1352: .Pp
1353: .It ~/.ssh/known_hosts
1.244 jmc 1354: Contains a list of host keys for all hosts the user has logged into
1355: that are not already in the systemwide list of known host keys.
1.238 jmc 1356: See
1.244 jmc 1357: .Xr sshd 8
1358: for further details of the format of this file.
1.238 jmc 1359: .Pp
1360: .It ~/.ssh/rc
1361: Commands in this file are executed by
1362: .Nm
1.245 jmc 1363: when the user logs in, just before the user's shell (or command) is
1.238 jmc 1364: started.
1365: See the
1366: .Xr sshd 8
1367: manual page for more information.
1368: .Pp
1.236 jmc 1369: .It /etc/hosts.equiv
1.240 jmc 1370: This file is for host-based authentication (see above).
1371: It should only be writable by root.
1.236 jmc 1372: .Pp
1373: .It /etc/shosts.equiv
1.240 jmc 1374: This file is used in exactly the same way as
1375: .Pa hosts.equiv ,
1376: but allows host-based authentication without permitting login with
1377: rlogin/rsh.
1.236 jmc 1378: .Pp
1.238 jmc 1379: .It Pa /etc/ssh/ssh_config
1380: Systemwide configuration file.
1381: The file format and configuration options are described in
1382: .Xr ssh_config 5 .
1383: .Pp
1384: .It /etc/ssh/ssh_host_key
1385: .It /etc/ssh/ssh_host_dsa_key
1386: .It /etc/ssh/ssh_host_rsa_key
1387: These three files contain the private parts of the host keys
1.245 jmc 1388: and are used for host-based authentication.
1389: If protocol version 1 is used,
1.238 jmc 1390: .Nm
1391: must be setuid root, since the host key is readable only by root.
1392: For protocol version 2,
1393: .Nm
1394: uses
1395: .Xr ssh-keysign 8
1.245 jmc 1396: to access the host keys,
1397: eliminating the requirement that
1.238 jmc 1398: .Nm
1.245 jmc 1399: be setuid root when host-based authentication is used.
1.238 jmc 1400: By default
1.2 deraadt 1401: .Nm
1.238 jmc 1402: is not setuid root.
1403: .Pp
1404: .It /etc/ssh/ssh_known_hosts
1405: Systemwide list of known host keys.
1406: This file should be prepared by the
1407: system administrator to contain the public host keys of all machines in the
1408: organization.
1.244 jmc 1409: It should be world-readable.
1410: See
1.238 jmc 1411: .Xr sshd 8
1.244 jmc 1412: for further details of the format of this file.
1.236 jmc 1413: .Pp
1.238 jmc 1414: .It /etc/ssh/sshrc
1.1 deraadt 1415: Commands in this file are executed by
1.2 deraadt 1416: .Nm
1.245 jmc 1417: when the user logs in, just before the user's shell (or command) is started.
1.44 aaron 1418: See the
1.2 deraadt 1419: .Xr sshd 8
1.1 deraadt 1420: manual page for more information.
1.58 itojun 1421: .El
1.2 deraadt 1422: .Sh SEE ALSO
1423: .Xr scp 1 ,
1.83 djm 1424: .Xr sftp 1 ,
1.2 deraadt 1425: .Xr ssh-add 1 ,
1426: .Xr ssh-agent 1 ,
1427: .Xr ssh-keygen 1 ,
1.242 jmc 1428: .Xr ssh-keyscan 1 ,
1.250 jmc 1429: .Xr tun 4 ,
1.176 jmc 1430: .Xr hosts.equiv 5 ,
1.159 stevesk 1431: .Xr ssh_config 5 ,
1.160 naddy 1432: .Xr ssh-keysign 8 ,
1.87 itojun 1433: .Xr sshd 8
1.106 markus 1434: .Rs
1.256 jmc 1435: .%R RFC 4250
1436: .%T "The Secure Shell (SSH) Protocol Assigned Numbers"
1437: .%D 2006
1438: .Re
1439: .Rs
1440: .%R RFC 4251
1441: .%T "The Secure Shell (SSH) Protocol Architecture"
1442: .%D 2006
1443: .Re
1444: .Rs
1445: .%R RFC 4252
1446: .%T "The Secure Shell (SSH) Authentication Protocol"
1447: .%D 2006
1448: .Re
1449: .Rs
1450: .%R RFC 4253
1451: .%T "The Secure Shell (SSH) Transport Layer Protocol"
1452: .%D 2006
1453: .Re
1454: .Rs
1455: .%R RFC 4254
1456: .%T "The Secure Shell (SSH) Connection Protocol"
1457: .%D 2006
1458: .Re
1459: .Rs
1460: .%R RFC 4255
1461: .%T "Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints"
1462: .%D 2006
1463: .Re
1464: .Rs
1465: .%R RFC 4256
1466: .%T "Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)"
1467: .%D 2006
1468: .Re
1469: .Rs
1470: .%R RFC 4335
1471: .%T "The Secure Shell (SSH) Session Channel Break Extension"
1472: .%D 2006
1473: .Re
1474: .Rs
1475: .%R RFC 4344
1476: .%T "The Secure Shell (SSH) Transport Layer Encryption Modes"
1477: .%D 2006
1478: .Re
1479: .Rs
1480: .%R RFC 4345
1481: .%T "Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol"
1.258 djm 1482: .%D 2006
1483: .Re
1484: .Rs
1485: .%R RFC 4419
1486: .%T "Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol"
1.266 markus 1487: .%D 2006
1488: .Re
1489: .Rs
1490: .%R RFC 4716
1491: .%T "The Secure Shell (SSH) Public Key File Format"
1.256 jmc 1492: .%D 2006
1.274 grunk 1493: .Re
1494: .Rs
1495: .%T "Hash Visualization: a New Technique to improve Real-World Security"
1496: .%A A. Perrig
1497: .%A D. Song
1498: .%D 1999
1499: .%O "International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)"
1.106 markus 1500: .Re
1.173 jmc 1501: .Sh AUTHORS
1502: OpenSSH is a derivative of the original and free
1503: ssh 1.2.12 release by Tatu Ylonen.
1504: Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1505: Theo de Raadt and Dug Song
1506: removed many bugs, re-added newer features and
1507: created OpenSSH.
1508: Markus Friedl contributed the support for SSH
1509: protocol versions 1.5 and 2.0.