summaryrefslogtreecommitdiff
path: root/ssh.0
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-09-14 15:08:28 +0100
committerColin Watson <cjwatson@debian.org>2013-09-14 15:08:28 +0100
commitc41345ad7ee5a22689e2c009595e85fa27b4b39a (patch)
tree55ee4e68932acc86eeec1594063783252680e640 /ssh.0
parent4425e64da7dee0b3e81f1ae301f56fa3a83fe221 (diff)
parent79524838f0d5eb1cdf9fc268ec4c0bce46ccb67f (diff)
Import 6.3p1 tarball
Diffstat (limited to 'ssh.0')
-rw-r--r--ssh.0935
1 files changed, 935 insertions, 0 deletions
diff --git a/ssh.0 b/ssh.0
new file mode 100644
index 000000000..adc1ee421
--- /dev/null
+++ b/ssh.0
@@ -0,0 +1,935 @@
1SSH(1) OpenBSD Reference Manual SSH(1)
2
3NAME
4 ssh - OpenSSH SSH client (remote login program)
5
6SYNOPSIS
7 ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
8 [-D [bind_address:]port] [-E log_file] [-e escape_char]
9 [-F configfile] [-I pkcs11] [-i identity_file]
10 [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
11 [-O ctl_cmd] [-o option] [-p port]
12 [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
13 [-w local_tun[:remote_tun]] [user@]hostname [command]
14 ssh -Q protocol_feature
15
16DESCRIPTION
17 ssh (SSH client) is a program for logging into a remote machine and for
18 executing commands on a remote machine. It is intended to replace rlogin
19 and rsh, and provide secure encrypted communications between two
20 untrusted hosts over an insecure network. X11 connections and arbitrary
21 TCP ports can also be forwarded over the secure channel.
22
23 ssh connects and logs into the specified hostname (with optional user
24 name). The user must prove his/her identity to the remote machine using
25 one of several methods depending on the protocol version used (see
26 below).
27
28 If command is specified, it is executed on the remote host instead of a
29 login shell.
30
31 The options are as follows:
32
33 -1 Forces ssh to try protocol version 1 only.
34
35 -2 Forces ssh to try protocol version 2 only.
36
37 -4 Forces ssh to use IPv4 addresses only.
38
39 -6 Forces ssh to use IPv6 addresses only.
40
41 -A Enables forwarding of the authentication agent connection. This
42 can also be specified on a per-host basis in a configuration
43 file.
44
45 Agent forwarding should be enabled with caution. Users with the
46 ability to bypass file permissions on the remote host (for the
47 agent's UNIX-domain socket) can access the local agent through
48 the forwarded connection. An attacker cannot obtain key material
49 from the agent, however they can perform operations on the keys
50 that enable them to authenticate using the identities loaded into
51 the agent.
52
53 -a Disables forwarding of the authentication agent connection.
54
55 -b bind_address
56 Use bind_address on the local machine as the source address of
57 the connection. Only useful on systems with more than one
58 address.
59
60 -C Requests compression of all data (including stdin, stdout,
61 stderr, and data for forwarded X11 and TCP connections). The
62 compression algorithm is the same used by gzip(1), and the
63 ``level'' can be controlled by the CompressionLevel option for
64 protocol version 1. Compression is desirable on modem lines and
65 other slow connections, but will only slow down things on fast
66 networks. The default value can be set on a host-by-host basis
67 in the configuration files; see the Compression option.
68
69 -c cipher_spec
70 Selects the cipher specification for encrypting the session.
71
72 Protocol version 1 allows specification of a single cipher. The
73 supported values are ``3des'', ``blowfish'', and ``des''. 3des
74 (triple-des) is an encrypt-decrypt-encrypt triple with three
75 different keys. It is believed to be secure. blowfish is a fast
76 block cipher; it appears very secure and is much faster than
77 3des. des is only supported in the ssh client for
78 interoperability with legacy protocol 1 implementations that do
79 not support the 3des cipher. Its use is strongly discouraged due
80 to cryptographic weaknesses. The default is ``3des''.
81
82 For protocol version 2, cipher_spec is a comma-separated list of
83 ciphers listed in order of preference. See the Ciphers keyword
84 in ssh_config(5) for more information.
85
86 -D [bind_address:]port
87 Specifies a local ``dynamic'' application-level port forwarding.
88 This works by allocating a socket to listen to port on the local
89 side, optionally bound to the specified bind_address. Whenever a
90 connection is made to this port, the connection is forwarded over
91 the secure channel, and the application protocol is then used to
92 determine where to connect to from the remote machine. Currently
93 the SOCKS4 and SOCKS5 protocols are supported, and ssh will act
94 as a SOCKS server. Only root can forward privileged ports.
95 Dynamic port forwardings can also be specified in the
96 configuration file.
97
98 IPv6 addresses can be specified by enclosing the address in
99 square brackets. Only the superuser can forward privileged
100 ports. By default, the local port is bound in accordance with
101 the GatewayPorts setting. However, an explicit bind_address may
102 be used to bind the connection to a specific address. The
103 bind_address of ``localhost'' indicates that the listening port
104 be bound for local use only, while an empty address or `*'
105 indicates that the port should be available from all interfaces.
106
107 -E log_file
108 Append debug logs to log_file instead of standard error.
109
110 -e escape_char
111 Sets the escape character for sessions with a pty (default: `~').
112 The escape character is only recognized at the beginning of a
113 line. The escape character followed by a dot (`.') closes the
114 connection; followed by control-Z suspends the connection; and
115 followed by itself sends the escape character once. Setting the
116 character to ``none'' disables any escapes and makes the session
117 fully transparent.
118
119 -F configfile
120 Specifies an alternative per-user configuration file. If a
121 configuration file is given on the command line, the system-wide
122 configuration file (/etc/ssh/ssh_config) will be ignored. The
123 default for the per-user configuration file is ~/.ssh/config.
124
125 -f Requests ssh to go to background just before command execution.
126 This is useful if ssh is going to ask for passwords or
127 passphrases, but the user wants it in the background. This
128 implies -n. The recommended way to start X11 programs at a
129 remote site is with something like ssh -f host xterm.
130
131 If the ExitOnForwardFailure configuration option is set to
132 ``yes'', then a client started with -f will wait for all remote
133 port forwards to be successfully established before placing
134 itself in the background.
135
136 -g Allows remote hosts to connect to local forwarded ports.
137
138 -I pkcs11
139 Specify the PKCS#11 shared library ssh should use to communicate
140 with a PKCS#11 token providing the user's private RSA key.
141
142 -i identity_file
143 Selects a file from which the identity (private key) for public
144 key authentication is read. The default is ~/.ssh/identity for
145 protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and
146 ~/.ssh/id_rsa for protocol version 2. Identity files may also be
147 specified on a per-host basis in the configuration file. It is
148 possible to have multiple -i options (and multiple identities
149 specified in configuration files). ssh will also try to load
150 certificate information from the filename obtained by appending
151 -cert.pub to identity filenames.
152
153 -K Enables GSSAPI-based authentication and forwarding (delegation)
154 of GSSAPI credentials to the server.
155
156 -k Disables forwarding (delegation) of GSSAPI credentials to the
157 server.
158
159 -L [bind_address:]port:host:hostport
160 Specifies that the given port on the local (client) host is to be
161 forwarded to the given host and port on the remote side. This
162 works by allocating a socket to listen to port on the local side,
163 optionally bound to the specified bind_address. Whenever a
164 connection is made to this port, the connection is forwarded over
165 the secure channel, and a connection is made to host port
166 hostport from the remote machine. Port forwardings can also be
167 specified in the configuration file. IPv6 addresses can be
168 specified by enclosing the address in square brackets. Only the
169 superuser can forward privileged ports. By default, the local
170 port is bound in accordance with the GatewayPorts setting.
171 However, an explicit bind_address may be used to bind the
172 connection to a specific address. The bind_address of
173 ``localhost'' indicates that the listening port be bound for
174 local use only, while an empty address or `*' indicates that the
175 port should be available from all interfaces.
176
177 -l login_name
178 Specifies the user to log in as on the remote machine. This also
179 may be specified on a per-host basis in the configuration file.
180
181 -M Places the ssh client into ``master'' mode for connection
182 sharing. Multiple -M options places ssh into ``master'' mode
183 with confirmation required before slave connections are accepted.
184 Refer to the description of ControlMaster in ssh_config(5) for
185 details.
186
187 -m mac_spec
188 Additionally, for protocol version 2 a comma-separated list of
189 MAC (message authentication code) algorithms can be specified in
190 order of preference. See the MACs keyword for more information.
191
192 -N Do not execute a remote command. This is useful for just
193 forwarding ports (protocol version 2 only).
194
195 -n Redirects stdin from /dev/null (actually, prevents reading from
196 stdin). This must be used when ssh is run in the background. A
197 common trick is to use this to run X11 programs on a remote
198 machine. For example, ssh -n shadows.cs.hut.fi emacs & will
199 start an emacs on shadows.cs.hut.fi, and the X11 connection will
200 be automatically forwarded over an encrypted channel. The ssh
201 program will be put in the background. (This does not work if
202 ssh needs to ask for a password or passphrase; see also the -f
203 option.)
204
205 -O ctl_cmd
206 Control an active connection multiplexing master process. When
207 the -O option is specified, the ctl_cmd argument is interpreted
208 and passed to the master process. Valid commands are: ``check''
209 (check that the master process is running), ``forward'' (request
210 forwardings without command execution), ``cancel'' (cancel
211 forwardings), ``exit'' (request the master to exit), and ``stop''
212 (request the master to stop accepting further multiplexing
213 requests).
214
215 -o option
216 Can be used to give options in the format used in the
217 configuration file. This is useful for specifying options for
218 which there is no separate command-line flag. For full details
219 of the options listed below, and their possible values, see
220 ssh_config(5).
221
222 AddressFamily
223 BatchMode
224 BindAddress
225 ChallengeResponseAuthentication
226 CheckHostIP
227 Cipher
228 Ciphers
229 ClearAllForwardings
230 Compression
231 CompressionLevel
232 ConnectionAttempts
233 ConnectTimeout
234 ControlMaster
235 ControlPath
236 ControlPersist
237 DynamicForward
238 EscapeChar
239 ExitOnForwardFailure
240 ForwardAgent
241 ForwardX11
242 ForwardX11Timeout
243 ForwardX11Trusted
244 GatewayPorts
245 GlobalKnownHostsFile
246 GSSAPIAuthentication
247 GSSAPIDelegateCredentials
248 HashKnownHosts
249 Host
250 HostbasedAuthentication
251 HostKeyAlgorithms
252 HostKeyAlias
253 HostName
254 IdentityFile
255 IdentitiesOnly
256 IPQoS
257 KbdInteractiveAuthentication
258 KbdInteractiveDevices
259 KexAlgorithms
260 LocalCommand
261 LocalForward
262 LogLevel
263 MACs
264 NoHostAuthenticationForLocalhost
265 NumberOfPasswordPrompts
266 PasswordAuthentication
267 PermitLocalCommand
268 PKCS11Provider
269 Port
270 PreferredAuthentications
271 Protocol
272 ProxyCommand
273 PubkeyAuthentication
274 RekeyLimit
275 RemoteForward
276 RequestTTY
277 RhostsRSAAuthentication
278 RSAAuthentication
279 SendEnv
280 ServerAliveInterval
281 ServerAliveCountMax
282 StrictHostKeyChecking
283 TCPKeepAlive
284 Tunnel
285 TunnelDevice
286 UsePrivilegedPort
287 User
288 UserKnownHostsFile
289 VerifyHostKeyDNS
290 VisualHostKey
291 XAuthLocation
292
293 -p port
294 Port to connect to on the remote host. This can be specified on
295 a per-host basis in the configuration file.
296
297 -Q protocol_feature
298 Queries ssh for the algorithms supported for the specified
299 version 2 protocol_feature. The queriable features are:
300 ``cipher'' (supported symmetric ciphers), ``MAC'' (supported
301 message integrity codes), ``KEX'' (key exchange algorithms),
302 ``key'' (key types). Protocol features are treated case-
303 insensitively.
304
305 -q Quiet mode. Causes most warning and diagnostic messages to be
306 suppressed.
307
308 -R [bind_address:]port:host:hostport
309 Specifies that the given port on the remote (server) host is to
310 be forwarded to the given host and port on the local side. This
311 works by allocating a socket to listen to port on the remote
312 side, and whenever a connection is made to this port, the
313 connection is forwarded over the secure channel, and a connection
314 is made to host port hostport from the local machine.
315
316 Port forwardings can also be specified in the configuration file.
317 Privileged ports can be forwarded only when logging in as root on
318 the remote machine. IPv6 addresses can be specified by enclosing
319 the address in square brackets.
320
321 By default, the listening socket on the server will be bound to
322 the loopback interface only. This may be overridden by
323 specifying a bind_address. An empty bind_address, or the address
324 `*', indicates that the remote socket should listen on all
325 interfaces. Specifying a remote bind_address will only succeed
326 if the server's GatewayPorts option is enabled (see
327 sshd_config(5)).
328
329 If the port argument is `0', the listen port will be dynamically
330 allocated on the server and reported to the client at run time.
331 When used together with -O forward the allocated port will be
332 printed to the standard output.
333
334 -S ctl_path
335 Specifies the location of a control socket for connection
336 sharing, or the string ``none'' to disable connection sharing.
337 Refer to the description of ControlPath and ControlMaster in
338 ssh_config(5) for details.
339
340 -s May be used to request invocation of a subsystem on the remote
341 system. Subsystems are a feature of the SSH2 protocol which
342 facilitate the use of SSH as a secure transport for other
343 applications (eg. sftp(1)). The subsystem is specified as the
344 remote command.
345
346 -T Disable pseudo-tty allocation.
347
348 -t Force pseudo-tty allocation. This can be used to execute
349 arbitrary screen-based programs on a remote machine, which can be
350 very useful, e.g. when implementing menu services. Multiple -t
351 options force tty allocation, even if ssh has no local tty.
352
353 -V Display the version number and exit.
354
355 -v Verbose mode. Causes ssh to print debugging messages about its
356 progress. This is helpful in debugging connection,
357 authentication, and configuration problems. Multiple -v options
358 increase the verbosity. The maximum is 3.
359
360 -W host:port
361 Requests that standard input and output on the client be
362 forwarded to host on port over the secure channel. Implies -N,
363 -T, ExitOnForwardFailure and ClearAllForwardings. Works with
364 Protocol version 2 only.
365
366 -w local_tun[:remote_tun]
367 Requests tunnel device forwarding with the specified tun(4)
368 devices between the client (local_tun) and the server
369 (remote_tun).
370
371 The devices may be specified by numerical ID or the keyword
372 ``any'', which uses the next available tunnel device. If
373 remote_tun is not specified, it defaults to ``any''. See also
374 the Tunnel and TunnelDevice directives in ssh_config(5). If the
375 Tunnel directive is unset, it is set to the default tunnel mode,
376 which is ``point-to-point''.
377
378 -X Enables X11 forwarding. This can also be specified on a per-host
379 basis in a configuration file.
380
381 X11 forwarding should be enabled with caution. Users with the
382 ability to bypass file permissions on the remote host (for the
383 user's X authorization database) can access the local X11 display
384 through the forwarded connection. An attacker may then be able
385 to perform activities such as keystroke monitoring.
386
387 For this reason, X11 forwarding is subjected to X11 SECURITY
388 extension restrictions by default. Please refer to the ssh -Y
389 option and the ForwardX11Trusted directive in ssh_config(5) for
390 more information.
391
392 -x Disables X11 forwarding.
393
394 -Y Enables trusted X11 forwarding. Trusted X11 forwardings are not
395 subjected to the X11 SECURITY extension controls.
396
397 -y Send log information using the syslog(3) system module. By
398 default this information is sent to stderr.
399
400 ssh may additionally obtain configuration data from a per-user
401 configuration file and a system-wide configuration file. The file format
402 and configuration options are described in ssh_config(5).
403
404AUTHENTICATION
405 The OpenSSH SSH client supports SSH protocols 1 and 2. The default is to
406 use protocol 2 only, though this can be changed via the Protocol option
407 in ssh_config(5) or the -1 and -2 options (see above). Both protocols
408 support similar authentication methods, but protocol 2 is the default
409 since it provides additional mechanisms for confidentiality (the traffic
410 is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour) and
411 integrity (hmac-md5, hmac-sha1, hmac-sha2-256, hmac-sha2-512, umac-64,
412 umac-128, hmac-ripemd160). Protocol 1 lacks a strong mechanism for
413 ensuring the integrity of the connection.
414
415 The methods available for authentication are: GSSAPI-based
416 authentication, host-based authentication, public key authentication,
417 challenge-response authentication, and password authentication.
418 Authentication methods are tried in the order specified above, though
419 protocol 2 has a configuration option to change the default order:
420 PreferredAuthentications.
421
422 Host-based authentication works as follows: If the machine the user logs
423 in from is listed in /etc/hosts.equiv or /etc/shosts.equiv on the remote
424 machine, and the user names are the same on both sides, or if the files
425 ~/.rhosts or ~/.shosts exist in the user's home directory on the remote
426 machine and contain a line containing the name of the client machine and
427 the name of the user on that machine, the user is considered for login.
428 Additionally, the server must be able to verify the client's host key
429 (see the description of /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts,
430 below) for login to be permitted. This authentication method closes
431 security holes due to IP spoofing, DNS spoofing, and routing spoofing.
432 [Note to the administrator: /etc/hosts.equiv, ~/.rhosts, and the
433 rlogin/rsh protocol in general, are inherently insecure and should be
434 disabled if security is desired.]
435
436 Public key authentication works as follows: The scheme is based on
437 public-key cryptography, using cryptosystems where encryption and
438 decryption are done using separate keys, and it is unfeasible to derive
439 the decryption key from the encryption key. The idea is that each user
440 creates a public/private key pair for authentication purposes. The
441 server knows the public key, and only the user knows the private key.
442 ssh implements public key authentication protocol automatically, using
443 one of the DSA, ECDSA or RSA algorithms. Protocol 1 is restricted to
444 using only RSA keys, but protocol 2 may use any. The HISTORY section of
445 ssl(8) contains a brief discussion of the DSA and RSA algorithms.
446
447 The file ~/.ssh/authorized_keys lists the public keys that are permitted
448 for logging in. When the user logs in, the ssh program tells the server
449 which key pair it would like to use for authentication. The client
450 proves that it has access to the private key and the server checks that
451 the corresponding public key is authorized to accept the account.
452
453 The user creates his/her key pair by running ssh-keygen(1). This stores
454 the private key in ~/.ssh/identity (protocol 1), ~/.ssh/id_dsa (protocol
455 2 DSA), ~/.ssh/id_ecdsa (protocol 2 ECDSA), or ~/.ssh/id_rsa (protocol 2
456 RSA) and stores the public key in ~/.ssh/identity.pub (protocol 1),
457 ~/.ssh/id_dsa.pub (protocol 2 DSA), ~/.ssh/id_ecdsa.pub (protocol 2
458 ECDSA), or ~/.ssh/id_rsa.pub (protocol 2 RSA) in the user's home
459 directory. The user should then copy the public key to
460 ~/.ssh/authorized_keys in his/her home directory on the remote machine.
461 The authorized_keys file corresponds to the conventional ~/.rhosts file,
462 and has one key per line, though the lines can be very long. After this,
463 the user can log in without giving the password.
464
465 A variation on public key authentication is available in the form of
466 certificate authentication: instead of a set of public/private keys,
467 signed certificates are used. This has the advantage that a single
468 trusted certification authority can be used in place of many
469 public/private keys. See the CERTIFICATES section of ssh-keygen(1) for
470 more information.
471
472 The most convenient way to use public key or certificate authentication
473 may be with an authentication agent. See ssh-agent(1) for more
474 information.
475
476 Challenge-response authentication works as follows: The server sends an
477 arbitrary "challenge" text, and prompts for a response. Protocol 2
478 allows multiple challenges and responses; protocol 1 is restricted to
479 just one challenge/response. Examples of challenge-response
480 authentication include BSD Authentication (see login.conf(5)) and PAM
481 (some non-OpenBSD systems).
482
483 Finally, if other authentication methods fail, ssh prompts the user for a
484 password. The password is sent to the remote host for checking; however,
485 since all communications are encrypted, the password cannot be seen by
486 someone listening on the network.
487
488 ssh automatically maintains and checks a database containing
489 identification for all hosts it has ever been used with. Host keys are
490 stored in ~/.ssh/known_hosts in the user's home directory. Additionally,
491 the file /etc/ssh/ssh_known_hosts is automatically checked for known
492 hosts. Any new hosts are automatically added to the user's file. If a
493 host's identification ever changes, ssh warns about this and disables
494 password authentication to prevent server spoofing or man-in-the-middle
495 attacks, which could otherwise be used to circumvent the encryption. The
496 StrictHostKeyChecking option can be used to control logins to machines
497 whose host key is not known or has changed.
498
499 When the user's identity has been accepted by the server, the server
500 either executes the given command, or logs into the machine and gives the
501 user a normal shell on the remote machine. All communication with the
502 remote command or shell will be automatically encrypted.
503
504 If a pseudo-terminal has been allocated (normal login session), the user
505 may use the escape characters noted below.
506
507 If no pseudo-tty has been allocated, the session is transparent and can
508 be used to reliably transfer binary data. On most systems, setting the
509 escape character to ``none'' will also make the session transparent even
510 if a tty is used.
511
512 The session terminates when the command or shell on the remote machine
513 exits and all X11 and TCP connections have been closed.
514
515ESCAPE CHARACTERS
516 When a pseudo-terminal has been requested, ssh supports a number of
517 functions through the use of an escape character.
518
519 A single tilde character can be sent as ~~ or by following the tilde by a
520 character other than those described below. The escape character must
521 always follow a newline to be interpreted as special. The escape
522 character can be changed in configuration files using the EscapeChar
523 configuration directive or on the command line by the -e option.
524
525 The supported escapes (assuming the default `~') are:
526
527 ~. Disconnect.
528
529 ~^Z Background ssh.
530
531 ~# List forwarded connections.
532
533 ~& Background ssh at logout when waiting for forwarded connection /
534 X11 sessions to terminate.
535
536 ~? Display a list of escape characters.
537
538 ~B Send a BREAK to the remote system (only useful for SSH protocol
539 version 2 and if the peer supports it).
540
541 ~C Open command line. Currently this allows the addition of port
542 forwardings using the -L, -R and -D options (see above). It also
543 allows the cancellation of existing port-forwardings with
544 -KL[bind_address:]port for local, -KR[bind_address:]port for
545 remote and -KD[bind_address:]port for dynamic port-forwardings.
546 !command allows the user to execute a local command if the
547 PermitLocalCommand option is enabled in ssh_config(5). Basic
548 help is available, using the -h option.
549
550 ~R Request rekeying of the connection (only useful for SSH protocol
551 version 2 and if the peer supports it).
552
553 ~V Decrease the verbosity (LogLevel) when errors are being written
554 to stderr.
555
556 ~v Increase the verbosity (LogLevel) when errors are being written
557 to stderr.
558
559TCP FORWARDING
560 Forwarding of arbitrary TCP connections over the secure channel can be
561 specified either on the command line or in a configuration file. One
562 possible application of TCP forwarding is a secure connection to a mail
563 server; another is going through firewalls.
564
565 In the example below, we look at encrypting communication between an IRC
566 client and server, even though the IRC server does not directly support
567 encrypted communications. This works as follows: the user connects to
568 the remote host using ssh, specifying a port to be used to forward
569 connections to the remote server. After that it is possible to start the
570 service which is to be encrypted on the client machine, connecting to the
571 same local port, and ssh will encrypt and forward the connection.
572
573 The following example tunnels an IRC session from client machine
574 ``127.0.0.1'' (localhost) to remote server ``server.example.com'':
575
576 $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
577 $ irc -c '#users' -p 1234 pinky 127.0.0.1
578
579 This tunnels a connection to IRC server ``server.example.com'', joining
580 channel ``#users'', nickname ``pinky'', using port 1234. It doesn't
581 matter which port is used, as long as it's greater than 1023 (remember,
582 only root can open sockets on privileged ports) and doesn't conflict with
583 any ports already in use. The connection is forwarded to port 6667 on
584 the remote server, since that's the standard port for IRC services.
585
586 The -f option backgrounds ssh and the remote command ``sleep 10'' is
587 specified to allow an amount of time (10 seconds, in the example) to
588 start the service which is to be tunnelled. If no connections are made
589 within the time specified, ssh will exit.
590
591X11 FORWARDING
592 If the ForwardX11 variable is set to ``yes'' (or see the description of
593 the -X, -x, and -Y options above) and the user is using X11 (the DISPLAY
594 environment variable is set), the connection to the X11 display is
595 automatically forwarded to the remote side in such a way that any X11
596 programs started from the shell (or command) will go through the
597 encrypted channel, and the connection to the real X server will be made
598 from the local machine. The user should not manually set DISPLAY.
599 Forwarding of X11 connections can be configured on the command line or in
600 configuration files.
601
602 The DISPLAY value set by ssh will point to the server machine, but with a
603 display number greater than zero. This is normal, and happens because
604 ssh creates a ``proxy'' X server on the server machine for forwarding the
605 connections over the encrypted channel.
606
607 ssh will also automatically set up Xauthority data on the server machine.
608 For this purpose, it will generate a random authorization cookie, store
609 it in Xauthority on the server, and verify that any forwarded connections
610 carry this cookie and replace it by the real cookie when the connection
611 is opened. The real authentication cookie is never sent to the server
612 machine (and no cookies are sent in the plain).
613
614 If the ForwardAgent variable is set to ``yes'' (or see the description of
615 the -A and -a options above) and the user is using an authentication
616 agent, the connection to the agent is automatically forwarded to the
617 remote side.
618
619VERIFYING HOST KEYS
620 When connecting to a server for the first time, a fingerprint of the
621 server's public key is presented to the user (unless the option
622 StrictHostKeyChecking has been disabled). Fingerprints can be determined
623 using ssh-keygen(1):
624
625 $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
626
627 If the fingerprint is already known, it can be matched and the key can be
628 accepted or rejected. Because of the difficulty of comparing host keys
629 just by looking at hex strings, there is also support to compare host
630 keys visually, using random art. By setting the VisualHostKey option to
631 ``yes'', a small ASCII graphic gets displayed on every login to a server,
632 no matter if the session itself is interactive or not. By learning the
633 pattern a known server produces, a user can easily find out that the host
634 key has changed when a completely different pattern is displayed.
635 Because these patterns are not unambiguous however, a pattern that looks
636 similar to the pattern remembered only gives a good probability that the
637 host key is the same, not guaranteed proof.
638
639 To get a listing of the fingerprints along with their random art for all
640 known hosts, the following command line can be used:
641
642 $ ssh-keygen -lv -f ~/.ssh/known_hosts
643
644 If the fingerprint is unknown, an alternative method of verification is
645 available: SSH fingerprints verified by DNS. An additional resource
646 record (RR), SSHFP, is added to a zonefile and the connecting client is
647 able to match the fingerprint with that of the key presented.
648
649 In this example, we are connecting a client to a server,
650 ``host.example.com''. The SSHFP resource records should first be added
651 to the zonefile for host.example.com:
652
653 $ ssh-keygen -r host.example.com.
654
655 The output lines will have to be added to the zonefile. To check that
656 the zone is answering fingerprint queries:
657
658 $ dig -t SSHFP host.example.com
659
660 Finally the client connects:
661
662 $ ssh -o "VerifyHostKeyDNS ask" host.example.com
663 [...]
664 Matching host key fingerprint found in DNS.
665 Are you sure you want to continue connecting (yes/no)?
666
667 See the VerifyHostKeyDNS option in ssh_config(5) for more information.
668
669SSH-BASED VIRTUAL PRIVATE NETWORKS
670 ssh contains support for Virtual Private Network (VPN) tunnelling using
671 the tun(4) network pseudo-device, allowing two networks to be joined
672 securely. The sshd_config(5) configuration option PermitTunnel controls
673 whether the server supports this, and at what level (layer 2 or 3
674 traffic).
675
676 The following example would connect client network 10.0.50.0/24 with
677 remote network 10.0.99.0/24 using a point-to-point connection from
678 10.1.1.1 to 10.1.1.2, provided that the SSH server running on the gateway
679 to the remote network, at 192.168.1.15, allows it.
680
681 On the client:
682
683 # ssh -f -w 0:1 192.168.1.15 true
684 # ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252
685 # route add 10.0.99.0/24 10.1.1.2
686
687 On the server:
688
689 # ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252
690 # route add 10.0.50.0/24 10.1.1.1
691
692 Client access may be more finely tuned via the /root/.ssh/authorized_keys
693 file (see below) and the PermitRootLogin server option. The following
694 entry would permit connections on tun(4) device 1 from user ``jane'' and
695 on tun device 2 from user ``john'', if PermitRootLogin is set to
696 ``forced-commands-only'':
697
698 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
699 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
700
701 Since an SSH-based setup entails a fair amount of overhead, it may be
702 more suited to temporary setups, such as for wireless VPNs. More
703 permanent VPNs are better provided by tools such as ipsecctl(8) and
704 isakmpd(8).
705
706ENVIRONMENT
707 ssh will normally set the following environment variables:
708
709 DISPLAY The DISPLAY variable indicates the location of the
710 X11 server. It is automatically set by ssh to
711 point to a value of the form ``hostname:n'', where
712 ``hostname'' indicates the host where the shell
713 runs, and `n' is an integer >= 1. ssh uses this
714 special value to forward X11 connections over the
715 secure channel. The user should normally not set
716 DISPLAY explicitly, as that will render the X11
717 connection insecure (and will require the user to
718 manually copy any required authorization cookies).
719
720 HOME Set to the path of the user's home directory.
721
722 LOGNAME Synonym for USER; set for compatibility with
723 systems that use this variable.
724
725 MAIL Set to the path of the user's mailbox.
726
727 PATH Set to the default PATH, as specified when
728 compiling ssh.
729
730 SSH_ASKPASS If ssh needs a passphrase, it will read the
731 passphrase from the current terminal if it was run
732 from a terminal. If ssh does not have a terminal
733 associated with it but DISPLAY and SSH_ASKPASS are
734 set, it will execute the program specified by
735 SSH_ASKPASS and open an X11 window to read the
736 passphrase. This is particularly useful when
737 calling ssh from a .xsession or related script.
738 (Note that on some machines it may be necessary to
739 redirect the input from /dev/null to make this
740 work.)
741
742 SSH_AUTH_SOCK Identifies the path of a UNIX-domain socket used to
743 communicate with the agent.
744
745 SSH_CONNECTION Identifies the client and server ends of the
746 connection. The variable contains four space-
747 separated values: client IP address, client port
748 number, server IP address, and server port number.
749
750 SSH_ORIGINAL_COMMAND This variable contains the original command line if
751 a forced command is executed. It can be used to
752 extract the original arguments.
753
754 SSH_TTY This is set to the name of the tty (path to the
755 device) associated with the current shell or
756 command. If the current session has no tty, this
757 variable is not set.
758
759 TZ This variable is set to indicate the present time
760 zone if it was set when the daemon was started
761 (i.e. the daemon passes the value on to new
762 connections).
763
764 USER Set to the name of the user logging in.
765
766 Additionally, ssh reads ~/.ssh/environment, and adds lines of the format
767 ``VARNAME=value'' to the environment if the file exists and users are
768 allowed to change their environment. For more information, see the
769 PermitUserEnvironment option in sshd_config(5).
770
771FILES
772 ~/.rhosts
773 This file is used for host-based authentication (see above). On
774 some machines this file may need to be world-readable if the
775 user's home directory is on an NFS partition, because sshd(8)
776 reads it as root. Additionally, this file must be owned by the
777 user, and must not have write permissions for anyone else. The
778 recommended permission for most machines is read/write for the
779 user, and not accessible by others.
780
781 ~/.shosts
782 This file is used in exactly the same way as .rhosts, but allows
783 host-based authentication without permitting login with
784 rlogin/rsh.
785
786 ~/.ssh/
787 This directory is the default location for all user-specific
788 configuration and authentication information. There is no
789 general requirement to keep the entire contents of this directory
790 secret, but the recommended permissions are read/write/execute
791 for the user, and not accessible by others.
792
793 ~/.ssh/authorized_keys
794 Lists the public keys (DSA/ECDSA/RSA) that can be used for
795 logging in as this user. The format of this file is described in
796 the sshd(8) manual page. This file is not highly sensitive, but
797 the recommended permissions are read/write for the user, and not
798 accessible by others.
799
800 ~/.ssh/config
801 This is the per-user configuration file. The file format and
802 configuration options are described in ssh_config(5). Because of
803 the potential for abuse, this file must have strict permissions:
804 read/write for the user, and not writable by others.
805
806 ~/.ssh/environment
807 Contains additional definitions for environment variables; see
808 ENVIRONMENT, above.
809
810 ~/.ssh/identity
811 ~/.ssh/id_dsa
812 ~/.ssh/id_ecdsa
813 ~/.ssh/id_rsa
814 Contains the private key for authentication. These files contain
815 sensitive data and should be readable by the user but not
816 accessible by others (read/write/execute). ssh will simply
817 ignore a private key file if it is accessible by others. It is
818 possible to specify a passphrase when generating the key which
819 will be used to encrypt the sensitive part of this file using
820 3DES.
821
822 ~/.ssh/identity.pub
823 ~/.ssh/id_dsa.pub
824 ~/.ssh/id_ecdsa.pub
825 ~/.ssh/id_rsa.pub
826 Contains the public key for authentication. These files are not
827 sensitive and can (but need not) be readable by anyone.
828
829 ~/.ssh/known_hosts
830 Contains a list of host keys for all hosts the user has logged
831 into that are not already in the systemwide list of known host
832 keys. See sshd(8) for further details of the format of this
833 file.
834
835 ~/.ssh/rc
836 Commands in this file are executed by ssh when the user logs in,
837 just before the user's shell (or command) is started. See the
838 sshd(8) manual page for more information.
839
840 /etc/hosts.equiv
841 This file is for host-based authentication (see above). It
842 should only be writable by root.
843
844 /etc/shosts.equiv
845 This file is used in exactly the same way as hosts.equiv, but
846 allows host-based authentication without permitting login with
847 rlogin/rsh.
848
849 /etc/ssh/ssh_config
850 Systemwide configuration file. The file format and configuration
851 options are described in ssh_config(5).
852
853 /etc/ssh/ssh_host_key
854 /etc/ssh/ssh_host_dsa_key
855 /etc/ssh/ssh_host_ecdsa_key
856 /etc/ssh/ssh_host_rsa_key
857 These files contain the private parts of the host keys and are
858 used for host-based authentication. If protocol version 1 is
859 used, ssh must be setuid root, since the host key is readable
860 only by root. For protocol version 2, ssh uses ssh-keysign(8) to
861 access the host keys, eliminating the requirement that ssh be
862 setuid root when host-based authentication is used. By default
863 ssh is not setuid root.
864
865 /etc/ssh/ssh_known_hosts
866 Systemwide list of known host keys. This file should be prepared
867 by the system administrator to contain the public host keys of
868 all machines in the organization. It should be world-readable.
869 See sshd(8) for further details of the format of this file.
870
871 /etc/ssh/sshrc
872 Commands in this file are executed by ssh when the user logs in,
873 just before the user's shell (or command) is started. See the
874 sshd(8) manual page for more information.
875
876EXIT STATUS
877 ssh exits with the exit status of the remote command or with 255 if an
878 error occurred.
879
880SEE ALSO
881 scp(1), sftp(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), ssh-keyscan(1),
882 tun(4), hosts.equiv(5), ssh_config(5), ssh-keysign(8), sshd(8)
883
884STANDARDS
885 S. Lehtinen and C. Lonvick, The Secure Shell (SSH) Protocol Assigned
886 Numbers, RFC 4250, January 2006.
887
888 T. Ylonen and C. Lonvick, The Secure Shell (SSH) Protocol Architecture,
889 RFC 4251, January 2006.
890
891 T. Ylonen and C. Lonvick, The Secure Shell (SSH) Authentication Protocol,
892 RFC 4252, January 2006.
893
894 T. Ylonen and C. Lonvick, The Secure Shell (SSH) Transport Layer
895 Protocol, RFC 4253, January 2006.
896
897 T. Ylonen and C. Lonvick, The Secure Shell (SSH) Connection Protocol, RFC
898 4254, January 2006.
899
900 J. Schlyter and W. Griffin, Using DNS to Securely Publish Secure Shell
901 (SSH) Key Fingerprints, RFC 4255, January 2006.
902
903 F. Cusack and M. Forssen, Generic Message Exchange Authentication for the
904 Secure Shell Protocol (SSH), RFC 4256, January 2006.
905
906 J. Galbraith and P. Remaker, The Secure Shell (SSH) Session Channel Break
907 Extension, RFC 4335, January 2006.
908
909 M. Bellare, T. Kohno, and C. Namprempre, The Secure Shell (SSH) Transport
910 Layer Encryption Modes, RFC 4344, January 2006.
911
912 B. Harris, Improved Arcfour Modes for the Secure Shell (SSH) Transport
913 Layer Protocol, RFC 4345, January 2006.
914
915 M. Friedl, N. Provos, and W. Simpson, Diffie-Hellman Group Exchange for
916 the Secure Shell (SSH) Transport Layer Protocol, RFC 4419, March 2006.
917
918 J. Galbraith and R. Thayer, The Secure Shell (SSH) Public Key File
919 Format, RFC 4716, November 2006.
920
921 D. Stebila and J. Green, Elliptic Curve Algorithm Integration in the
922 Secure Shell Transport Layer, RFC 5656, December 2009.
923
924 A. Perrig and D. Song, Hash Visualization: a New Technique to improve
925 Real-World Security, 1999, International Workshop on Cryptographic
926 Techniques and E-Commerce (CrypTEC '99).
927
928AUTHORS
929 OpenSSH is a derivative of the original and free ssh 1.2.12 release by
930 Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
931 de Raadt and Dug Song removed many bugs, re-added newer features and
932 created OpenSSH. Markus Friedl contributed the support for SSH protocol
933 versions 1.5 and 2.0.
934
935OpenBSD 5.4 July 18, 2013 OpenBSD 5.4