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