summaryrefslogtreecommitdiff
path: root/ssh.0
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.0')
-rw-r--r--ssh.0482
1 files changed, 245 insertions, 237 deletions
diff --git a/ssh.0 b/ssh.0
index 9c793b843..8d53ad289 100644
--- a/ssh.0
+++ b/ssh.0
@@ -14,14 +14,14 @@ SYNOPSIS
14DESCRIPTION 14DESCRIPTION
15 ssh (SSH client) is a program for logging into a remote machine and for 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 16 executing commands on a remote machine. It is intended to replace rlogin
17 and rsh, and provide secure encrypted communications between two untrust- 17 and rsh, and provide secure encrypted communications between two
18 ed hosts over an insecure network. X11 connections and arbitrary TCP 18 untrusted hosts over an insecure network. X11 connections and arbitrary
19 ports can also be forwarded over the secure channel. 19 TCP ports can also be forwarded over the secure channel.
20 20
21 ssh connects and logs into the specified hostname (with optional user 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 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 be- 23 one of several methods depending on the protocol version used (see
24 low). 24 below).
25 25
26 If command is specified, it is executed on the remote host instead of a 26 If command is specified, it is executed on the remote host instead of a
27 login shell. 27 login shell.
@@ -52,8 +52,8 @@ DESCRIPTION
52 52
53 -b bind_address 53 -b bind_address
54 Use bind_address on the local machine as the source address of 54 Use bind_address on the local machine as the source address of
55 the connection. Only useful on systems with more than one ad- 55 the connection. Only useful on systems with more than one
56 dress. 56 address.
57 57
58 -C Requests compression of all data (including stdin, stdout, 58 -C Requests compression of all data (including stdin, stdout,
59 stderr, and data for forwarded X11 and TCP connections). The 59 stderr, and data for forwarded X11 and TCP connections). The
@@ -69,17 +69,17 @@ DESCRIPTION
69 69
70 Protocol version 1 allows specification of a single cipher. The 70 Protocol version 1 allows specification of a single cipher. The
71 supported values are ``3des'', ``blowfish'', and ``des''. 3des 71 supported values are ``3des'', ``blowfish'', and ``des''. 3des
72 (triple-des) is an encrypt-decrypt-encrypt triple with three dif- 72 (triple-des) is an encrypt-decrypt-encrypt triple with three
73 ferent keys. It is believed to be secure. blowfish is a fast 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 74 block cipher; it appears very secure and is much faster than
75 3des. des is only supported in the ssh client for interoperabil- 75 3des. des is only supported in the ssh client for
76 ity with legacy protocol 1 implementations that do not support 76 interoperability with legacy protocol 1 implementations that do
77 the 3des cipher. Its use is strongly discouraged due to crypto- 77 not support the 3des cipher. Its use is strongly discouraged due
78 graphic weaknesses. The default is ``3des''. 78 to cryptographic weaknesses. The default is ``3des''.
79 79
80 For protocol version 2, cipher_spec is a comma-separated list of 80 For protocol version 2, cipher_spec is a comma-separated list of
81 ciphers listed in order of preference. See the Ciphers keyword 81 ciphers listed in order of preference. See the Ciphers keyword
82 for more information. 82 in ssh_config(5) for more information.
83 83
84 -D [bind_address:]port 84 -D [bind_address:]port
85 Specifies a local ``dynamic'' application-level port forwarding. 85 Specifies a local ``dynamic'' application-level port forwarding.
@@ -89,19 +89,18 @@ DESCRIPTION
89 the secure channel, and the application protocol is then used to 89 the secure channel, and the application protocol is then used to
90 determine where to connect to from the remote machine. Currently 90 determine where to connect to from the remote machine. Currently
91 the SOCKS4 and SOCKS5 protocols are supported, and ssh will act 91 the SOCKS4 and SOCKS5 protocols are supported, and ssh will act
92 as a SOCKS server. Only root can forward privileged ports. Dy- 92 as a SOCKS server. Only root can forward privileged ports.
93 namic port forwardings can also be specified in the configuration 93 Dynamic port forwardings can also be specified in the
94 file. 94 configuration file.
95 95
96 IPv6 addresses can be specified with an alternative syntax: 96 IPv6 addresses can be specified by enclosing the address in
97 [bind_address/]port or by enclosing the address in square brack- 97 square brackets. Only the superuser can forward privileged
98 ets. Only the superuser can forward privileged ports. By de- 98 ports. By default, the local port is bound in accordance with
99 fault, the local port is bound in accordance with the 99 the GatewayPorts setting. However, an explicit bind_address may
100 GatewayPorts setting. However, an explicit bind_address may be 100 be used to bind the connection to a specific address. The
101 used to bind the connection to a specific address. The
102 bind_address of ``localhost'' indicates that the listening port 101 bind_address of ``localhost'' indicates that the listening port
103 be bound for local use only, while an empty address or `*' indi- 102 be bound for local use only, while an empty address or `*'
104 cates that the port should be available from all interfaces. 103 indicates that the port should be available from all interfaces.
105 104
106 -e escape_char 105 -e escape_char
107 Sets the escape character for sessions with a pty (default: `~'). 106 Sets the escape character for sessions with a pty (default: `~').
@@ -113,21 +112,21 @@ DESCRIPTION
113 fully transparent. 112 fully transparent.
114 113
115 -F configfile 114 -F configfile
116 Specifies an alternative per-user configuration file. If a con- 115 Specifies an alternative per-user configuration file. If a
117 figuration file is given on the command line, the system-wide 116 configuration file is given on the command line, the system-wide
118 configuration file (/etc/ssh/ssh_config) will be ignored. The 117 configuration file (/etc/ssh/ssh_config) will be ignored. The
119 default for the per-user configuration file is ~/.ssh/config. 118 default for the per-user configuration file is ~/.ssh/config.
120 119
121 -f Requests ssh to go to background just before command execution. 120 -f Requests ssh to go to background just before command execution.
122 This is useful if ssh is going to ask for passwords or passphras- 121 This is useful if ssh is going to ask for passwords or
123 es, but the user wants it in the background. This implies -n. 122 passphrases, but the user wants it in the background. This
124 The recommended way to start X11 programs at a remote site is 123 implies -n. The recommended way to start X11 programs at a
125 with something like ssh -f host xterm. 124 remote site is with something like ssh -f host xterm.
126 125
127 If the ExitOnForwardFailure configuration option is set to 126 If the ExitOnForwardFailure configuration option is set to
128 ``yes'', then a client started with -f will wait for all remote 127 ``yes'', then a client started with -f will wait for all remote
129 port forwards to be successfully established before placing it- 128 port forwards to be successfully established before placing
130 self in the background. 129 itself in the background.
131 130
132 -g Allows remote hosts to connect to local forwarded ports. 131 -g Allows remote hosts to connect to local forwarded ports.
133 132
@@ -138,13 +137,13 @@ DESCRIPTION
138 -i identity_file 137 -i identity_file
139 Selects a file from which the identity (private key) for RSA or 138 Selects a file from which the identity (private key) for RSA or
140 DSA authentication is read. The default is ~/.ssh/identity for 139 DSA authentication is read. The default is ~/.ssh/identity for
141 protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for pro- 140 protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for
142 tocol version 2. Identity files may also be specified on a per- 141 protocol version 2. Identity files may also be specified on a
143 host basis in the configuration file. It is possible to have 142 per-host basis in the configuration file. It is possible to have
144 multiple -i options (and multiple identities specified in config- 143 multiple -i options (and multiple identities specified in
145 uration files). ssh will also try to load certificate informa- 144 configuration files). ssh will also try to load certificate
146 tion from the filename obtained by appending -cert.pub to identi- 145 information from the filename obtained by appending -cert.pub to
147 ty filenames. 146 identity filenames.
148 147
149 -K Enables GSSAPI-based authentication and forwarding (delegation) 148 -K Enables GSSAPI-based authentication and forwarding (delegation)
150 of GSSAPI credentials to the server. 149 of GSSAPI credentials to the server.
@@ -156,60 +155,62 @@ DESCRIPTION
156 Specifies that the given port on the local (client) host is to be 155 Specifies that the given port on the local (client) host is to be
157 forwarded to the given host and port on the remote side. This 156 forwarded to the given host and port on the remote side. This
158 works by allocating a socket to listen to port on the local side, 157 works by allocating a socket to listen to port on the local side,
159 optionally bound to the specified bind_address. Whenever a con- 158 optionally bound to the specified bind_address. Whenever a
160 nection is made to this port, the connection is forwarded over 159 connection is made to this port, the connection is forwarded over
161 the secure channel, and a connection is made to host port 160 the secure channel, and a connection is made to host port
162 hostport from the remote machine. Port forwardings can also be 161 hostport from the remote machine. Port forwardings can also be
163 specified in the configuration file. IPv6 addresses can be spec- 162 specified in the configuration file. IPv6 addresses can be
164 ified with an alternative syntax: [bind_address/]port/host/host- 163 specified by enclosing the address in square brackets. Only the
165 port or by enclosing the address in square brackets. Only the
166 superuser can forward privileged ports. By default, the local 164 superuser can forward privileged ports. By default, the local
167 port is bound in accordance with the GatewayPorts setting. How- 165 port is bound in accordance with the GatewayPorts setting.
168 ever, an explicit bind_address may be used to bind the connection 166 However, an explicit bind_address may be used to bind the
169 to a specific address. The bind_address of ``localhost'' indi- 167 connection to a specific address. The bind_address of
170 cates that the listening port be bound for local use only, while 168 ``localhost'' indicates that the listening port be bound for
171 an empty address or `*' indicates that the port should be avail- 169 local use only, while an empty address or `*' indicates that the
172 able from all interfaces. 170 port should be available from all interfaces.
173 171
174 -l login_name 172 -l login_name
175 Specifies the user to log in as on the remote machine. This also 173 Specifies the user to log in as on the remote machine. This also
176 may be specified on a per-host basis in the configuration file. 174 may be specified on a per-host basis in the configuration file.
177 175
178 -M Places the ssh client into ``master'' mode for connection shar- 176 -M Places the ssh client into ``master'' mode for connection
179 ing. Multiple -M options places ssh into ``master'' mode with 177 sharing. Multiple -M options places ssh into ``master'' mode
180 confirmation required before slave connections are accepted. Re- 178 with confirmation required before slave connections are accepted.
181 fer to the description of ControlMaster in ssh_config(5) for de- 179 Refer to the description of ControlMaster in ssh_config(5) for
182 tails. 180 details.
183 181
184 -m mac_spec 182 -m mac_spec
185 Additionally, for protocol version 2 a comma-separated list of 183 Additionally, for protocol version 2 a comma-separated list of
186 MAC (message authentication code) algorithms can be specified in 184 MAC (message authentication code) algorithms can be specified in
187 order of preference. See the MACs keyword for more information. 185 order of preference. See the MACs keyword for more information.
188 186
189 -N Do not execute a remote command. This is useful for just for- 187 -N Do not execute a remote command. This is useful for just
190 warding ports (protocol version 2 only). 188 forwarding ports (protocol version 2 only).
191 189
192 -n Redirects stdin from /dev/null (actually, prevents reading from 190 -n Redirects stdin from /dev/null (actually, prevents reading from
193 stdin). This must be used when ssh is run in the background. A 191 stdin). This must be used when ssh is run in the background. A
194 common trick is to use this to run X11 programs on a remote ma- 192 common trick is to use this to run X11 programs on a remote
195 chine. For example, ssh -n shadows.cs.hut.fi emacs & will start 193 machine. For example, ssh -n shadows.cs.hut.fi emacs & will
196 an emacs on shadows.cs.hut.fi, and the X11 connection will be au- 194 start an emacs on shadows.cs.hut.fi, and the X11 connection will
197 tomatically forwarded over an encrypted channel. The ssh program 195 be automatically forwarded over an encrypted channel. The ssh
198 will be put in the background. (This does not work if ssh needs 196 program will be put in the background. (This does not work if
199 to ask for a password or passphrase; see also the -f option.) 197 ssh needs to ask for a password or passphrase; see also the -f
198 option.)
200 199
201 -O ctl_cmd 200 -O ctl_cmd
202 Control an active connection multiplexing master process. When 201 Control an active connection multiplexing master process. When
203 the -O option is specified, the ctl_cmd argument is interpreted 202 the -O option is specified, the ctl_cmd argument is interpreted
204 and passed to the master process. Valid commands are: ``check'' 203 and passed to the master process. Valid commands are: ``check''
205 (check that the master process is running) and ``exit'' (request 204 (check that the master process is running), ``forward'' (request
206 the master to exit). 205 forwardings without command execution) and ``exit'' (request the
206 master to exit).
207 207
208 -o option 208 -o option
209 Can be used to give options in the format used in the configura- 209 Can be used to give options in the format used in the
210 tion file. This is useful for specifying options for which there 210 configuration file. This is useful for specifying options for
211 is no separate command-line flag. For full details of the op- 211 which there is no separate command-line flag. For full details
212 tions listed below, and their possible values, see ssh_config(5). 212 of the options listed below, and their possible values, see
213 ssh_config(5).
213 214
214 AddressFamily 215 AddressFamily
215 BatchMode 216 BatchMode
@@ -287,61 +288,64 @@ DESCRIPTION
287 Specifies that the given port on the remote (server) host is to 288 Specifies that the given port on the remote (server) host is to
288 be forwarded to the given host and port on the local side. This 289 be forwarded to the given host and port on the local side. This
289 works by allocating a socket to listen to port on the remote 290 works by allocating a socket to listen to port on the remote
290 side, and whenever a connection is made to this port, the connec- 291 side, and whenever a connection is made to this port, the
291 tion is forwarded over the secure channel, and a connection is 292 connection is forwarded over the secure channel, and a connection
292 made to host port hostport from the local machine. 293 is made to host port hostport from the local machine.
293 294
294 Port forwardings can also be specified in the configuration file. 295 Port forwardings can also be specified in the configuration file.
295 Privileged ports can be forwarded only when logging in as root on 296 Privileged ports can be forwarded only when logging in as root on
296 the remote machine. IPv6 addresses can be specified by enclosing 297 the remote machine. IPv6 addresses can be specified by enclosing
297 the address in square braces or using an alternative syntax: 298 the address in square braces.
298 [bind_address/]host/port/hostport.
299 299
300 By default, the listening socket on the server will be bound to 300 By default, the listening socket on the server will be bound to
301 the loopback interface only. This may be overridden by specify- 301 the loopback interface only. This may be overridden by
302 ing a bind_address. An empty bind_address, or the address `*', 302 specifying a bind_address. An empty bind_address, or the address
303 indicates that the remote socket should listen on all interfaces. 303 `*', indicates that the remote socket should listen on all
304 Specifying a remote bind_address will only succeed if the serv- 304 interfaces. Specifying a remote bind_address will only succeed
305 er's GatewayPorts option is enabled (see sshd_config(5)). 305 if the server's GatewayPorts option is enabled (see
306 sshd_config(5)).
306 307
307 If the port argument is `0', the listen port will be dynamically 308 If the port argument is `0', the listen port will be dynamically
308 allocated on the server and reported to the client at run time. 309 allocated on the server and reported to the client at run time.
310 When used together with -O forward the allocated port will be
311 printed to the standard output.
309 312
310 -S ctl_path 313 -S ctl_path
311 Specifies the location of a control socket for connection sharing 314 Specifies the location of a control socket for connection
312 or the string ``none'' to disable connection sharing. Refer to 315 sharing, or the string ``none'' to disable connection sharing.
313 the description of ControlPath and ControlMaster in ssh_config(5) 316 Refer to the description of ControlPath and ControlMaster in
314 for details. 317 ssh_config(5) for details.
315 318
316 -s May be used to request invocation of a subsystem on the remote 319 -s May be used to request invocation of a subsystem on the remote
317 system. Subsystems are a feature of the SSH2 protocol which fa- 320 system. Subsystems are a feature of the SSH2 protocol which
318 cilitate the use of SSH as a secure transport for other applica- 321 facilitate the use of SSH as a secure transport for other
319 tions (eg. sftp(1)). The subsystem is specified as the remote 322 applications (eg. sftp(1)). The subsystem is specified as the
320 command. 323 remote command.
321 324
322 -T Disable pseudo-tty allocation. 325 -T Disable pseudo-tty allocation.
323 326
324 -t Force pseudo-tty allocation. This can be used to execute arbi- 327 -t Force pseudo-tty allocation. This can be used to execute
325 trary screen-based programs on a remote machine, which can be 328 arbitrary screen-based programs on a remote machine, which can be
326 very useful, e.g. when implementing menu services. Multiple -t 329 very useful, e.g. when implementing menu services. Multiple -t
327 options force tty allocation, even if ssh has no local tty. 330 options force tty allocation, even if ssh has no local tty.
328 331
329 -V Display the version number and exit. 332 -V Display the version number and exit.
330 333
331 -v Verbose mode. Causes ssh to print debugging messages about its 334 -v Verbose mode. Causes ssh to print debugging messages about its
332 progress. This is helpful in debugging connection, authentica- 335 progress. This is helpful in debugging connection,
333 tion, and configuration problems. Multiple -v options increase 336 authentication, and configuration problems. Multiple -v options
334 the verbosity. The maximum is 3. 337 increase the verbosity. The maximum is 3.
335 338
336 -W host:port 339 -W host:port
337 Requests that standard input and output on the client be forward- 340 Requests that standard input and output on the client be
338 ed to host on port over the secure channel. Implies -N, -T, 341 forwarded to host on port over the secure channel. Implies -N,
339 ExitOnForwardFailure and ClearAllForwardings and works with Pro- 342 -T, ExitOnForwardFailure and ClearAllForwardings and works with
340 tocol version 2 only. 343 Protocol version 2 only.
341 344
342 -w local_tun[:remote_tun] 345 -w local_tun[:remote_tun]
343 Requests tunnel device forwarding with the specified tun(4) de- 346 Requests tunnel device forwarding with the specified tun(4)
344 vices between the client (local_tun) and the server (remote_tun). 347 devices between the client (local_tun) and the server
348 (remote_tun).
345 349
346 The devices may be specified by numerical ID or the keyword 350 The devices may be specified by numerical ID or the keyword
347 ``any'', which uses the next available tunnel device. If 351 ``any'', which uses the next available tunnel device. If
@@ -359,9 +363,9 @@ DESCRIPTION
359 through the forwarded connection. An attacker may then be able 363 through the forwarded connection. An attacker may then be able
360 to perform activities such as keystroke monitoring. 364 to perform activities such as keystroke monitoring.
361 365
362 For this reason, X11 forwarding is subjected to X11 SECURITY ex- 366 For this reason, X11 forwarding is subjected to X11 SECURITY
363 tension restrictions by default. Please refer to the ssh -Y op- 367 extension restrictions by default. Please refer to the ssh -Y
364 tion and the ForwardX11Trusted directive in ssh_config(5) for 368 option and the ForwardX11Trusted directive in ssh_config(5) for
365 more information. 369 more information.
366 370
367 -x Disables X11 forwarding. 371 -x Disables X11 forwarding.
@@ -369,12 +373,12 @@ DESCRIPTION
369 -Y Enables trusted X11 forwarding. Trusted X11 forwardings are not 373 -Y Enables trusted X11 forwarding. Trusted X11 forwardings are not
370 subjected to the X11 SECURITY extension controls. 374 subjected to the X11 SECURITY extension controls.
371 375
372 -y Send log information using the syslog(3) system module. By de- 376 -y Send log information using the syslog(3) system module. By
373 fault this information is sent to stderr. 377 default this information is sent to stderr.
374 378
375 ssh may additionally obtain configuration data from a per-user configura- 379 ssh may additionally obtain configuration data from a per-user
376 tion file and a system-wide configuration file. The file format and con- 380 configuration file and a system-wide configuration file. The file format
377 figuration options are described in ssh_config(5). 381 and configuration options are described in ssh_config(5).
378 382
379 ssh exits with the exit status of the remote command or with 255 if an 383 ssh exits with the exit status of the remote command or with 255 if an
380 error occurred. 384 error occurred.
@@ -385,15 +389,16 @@ AUTHENTICATION
385 in ssh_config(5) or the -1 and -2 options (see above). Both protocols 389 in ssh_config(5) or the -1 and -2 options (see above). Both protocols
386 support similar authentication methods, but protocol 2 is the default 390 support similar authentication methods, but protocol 2 is the default
387 since it provides additional mechanisms for confidentiality (the traffic 391 since it provides additional mechanisms for confidentiality (the traffic
388 is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour) and integri- 392 is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour) and
389 ty (hmac-md5, hmac-sha1, umac-64, hmac-ripemd160). Protocol 1 lacks a 393 integrity (hmac-md5, hmac-sha1, umac-64, hmac-ripemd160). Protocol 1
390 strong mechanism for ensuring the integrity of the connection. 394 lacks a strong mechanism for ensuring the integrity of the connection.
391 395
392 The methods available for authentication are: GSSAPI-based authentica- 396 The methods available for authentication are: GSSAPI-based
393 tion, host-based authentication, public key authentication, challenge-re- 397 authentication, host-based authentication, public key authentication,
394 sponse authentication, and password authentication. Authentication meth- 398 challenge-response authentication, and password authentication.
395 ods are tried in the order specified above, though protocol 2 has a con- 399 Authentication methods are tried in the order specified above, though
396 figuration option to change the default order: PreferredAuthentications. 400 protocol 2 has a configuration option to change the default order:
401 PreferredAuthentications.
397 402
398 Host-based authentication works as follows: If the machine the user logs 403 Host-based authentication works as follows: If the machine the user logs
399 in from is listed in /etc/hosts.equiv or /etc/shosts.equiv on the remote 404 in from is listed in /etc/hosts.equiv or /etc/shosts.equiv on the remote
@@ -403,22 +408,22 @@ AUTHENTICATION
403 the name of the user on that machine, the user is considered for login. 408 the name of the user on that machine, the user is considered for login.
404 Additionally, the server must be able to verify the client's host key 409 Additionally, the server must be able to verify the client's host key
405 (see the description of /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts, 410 (see the description of /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts,
406 below) for login to be permitted. This authentication method closes se- 411 below) for login to be permitted. This authentication method closes
407 curity holes due to IP spoofing, DNS spoofing, and routing spoofing. 412 security holes due to IP spoofing, DNS spoofing, and routing spoofing.
408 [Note to the administrator: /etc/hosts.equiv, ~/.rhosts, and the 413 [Note to the administrator: /etc/hosts.equiv, ~/.rhosts, and the
409 rlogin/rsh protocol in general, are inherently insecure and should be 414 rlogin/rsh protocol in general, are inherently insecure and should be
410 disabled if security is desired.] 415 disabled if security is desired.]
411 416
412 Public key authentication works as follows: The scheme is based on pub- 417 Public key authentication works as follows: The scheme is based on
413 lic-key cryptography, using cryptosystems where encryption and decryption 418 public-key cryptography, using cryptosystems where encryption and
414 are done using separate keys, and it is unfeasible to derive the decryp- 419 decryption are done using separate keys, and it is unfeasible to derive
415 tion key from the encryption key. The idea is that each user creates a 420 the decryption key from the encryption key. The idea is that each user
416 public/private key pair for authentication purposes. The server knows 421 creates a public/private key pair for authentication purposes. The
417 the public key, and only the user knows the private key. ssh implements 422 server knows the public key, and only the user knows the private key.
418 public key authentication protocol automatically, using either the RSA or 423 ssh implements public key authentication protocol automatically, using
419 DSA algorithms. Protocol 1 is restricted to using only RSA keys, but 424 either the RSA or DSA algorithms. Protocol 1 is restricted to using only
420 protocol 2 may use either. The HISTORY section of ssl(8) contains a 425 RSA keys, but protocol 2 may use either. The HISTORY section of ssl(8)
421 brief discussion of the two algorithms. 426 contains a brief discussion of the two algorithms.
422 427
423 The file ~/.ssh/authorized_keys lists the public keys that are permitted 428 The file ~/.ssh/authorized_keys lists the public keys that are permitted
424 for logging in. When the user logs in, the ssh program tells the server 429 for logging in. When the user logs in, the ssh program tells the server
@@ -430,48 +435,49 @@ AUTHENTICATION
430 the private key in ~/.ssh/identity (protocol 1), ~/.ssh/id_dsa (protocol 435 the private key in ~/.ssh/identity (protocol 1), ~/.ssh/id_dsa (protocol
431 2 DSA), or ~/.ssh/id_rsa (protocol 2 RSA) and stores the public key in 436 2 DSA), or ~/.ssh/id_rsa (protocol 2 RSA) and stores the public key in
432 ~/.ssh/identity.pub (protocol 1), ~/.ssh/id_dsa.pub (protocol 2 DSA), or 437 ~/.ssh/identity.pub (protocol 1), ~/.ssh/id_dsa.pub (protocol 2 DSA), or
433 ~/.ssh/id_rsa.pub (protocol 2 RSA) in the user's home directory. The us- 438 ~/.ssh/id_rsa.pub (protocol 2 RSA) in the user's home directory. The
434 er should then copy the public key to ~/.ssh/authorized_keys in his/her 439 user should then copy the public key to ~/.ssh/authorized_keys in his/her
435 home directory on the remote machine. The authorized_keys file corre- 440 home directory on the remote machine. The authorized_keys file
436 sponds to the conventional ~/.rhosts file, and has one key per line, 441 corresponds to the conventional ~/.rhosts file, and has one key per line,
437 though the lines can be very long. After this, the user can log in with- 442 though the lines can be very long. After this, the user can log in
438 out giving the password. 443 without giving the password.
439 444
440 A variation on public key authentication is available in the form of cer- 445 A variation on public key authentication is available in the form of
441 tificate authentication: instead of a set of public/private keys, signed 446 certificate authentication: instead of a set of public/private keys,
442 certificates are used. This has the advantage that a single trusted cer- 447 signed certificates are used. This has the advantage that a single
443 tification authority can be used in place of many public/private keys. 448 trusted certification authority can be used in place of many
444 See the CERTIFICATES section of ssh-keygen(1) for more information. 449 public/private keys. See the CERTIFICATES section of ssh-keygen(1) for
450 more information.
445 451
446 The most convenient way to use public key or certificate authentication 452 The most convenient way to use public key or certificate authentication
447 may be with an authentication agent. See ssh-agent(1) for more informa- 453 may be with an authentication agent. See ssh-agent(1) for more
448 tion. 454 information.
449 455
450 Challenge-response authentication works as follows: The server sends an 456 Challenge-response authentication works as follows: The server sends an
451 arbitrary "challenge" text, and prompts for a response. Protocol 2 al- 457 arbitrary "challenge" text, and prompts for a response. Protocol 2
452 lows multiple challenges and responses; protocol 1 is restricted to just 458 allows multiple challenges and responses; protocol 1 is restricted to
453 one challenge/response. Examples of challenge-response authentication 459 just one challenge/response. Examples of challenge-response
454 include BSD Authentication (see login.conf(5)) and PAM (some non-OpenBSD 460 authentication include BSD Authentication (see login.conf(5)) and PAM
455 systems). 461 (some non-OpenBSD systems).
456 462
457 Finally, if other authentication methods fail, ssh prompts the user for a 463 Finally, if other authentication methods fail, ssh prompts the user for a
458 password. The password is sent to the remote host for checking; however, 464 password. The password is sent to the remote host for checking; however,
459 since all communications are encrypted, the password cannot be seen by 465 since all communications are encrypted, the password cannot be seen by
460 someone listening on the network. 466 someone listening on the network.
461 467
462 ssh automatically maintains and checks a database containing identifica- 468 ssh automatically maintains and checks a database containing
463 tion for all hosts it has ever been used with. Host keys are stored in 469 identification for all hosts it has ever been used with. Host keys are
464 ~/.ssh/known_hosts in the user's home directory. Additionally, the file 470 stored in ~/.ssh/known_hosts in the user's home directory. Additionally,
465 /etc/ssh/ssh_known_hosts is automatically checked for known hosts. Any 471 the file /etc/ssh/ssh_known_hosts is automatically checked for known
466 new hosts are automatically added to the user's file. If a host's iden- 472 hosts. Any new hosts are automatically added to the user's file. If a
467 tification ever changes, ssh warns about this and disables password au- 473 host's identification ever changes, ssh warns about this and disables
468 thentication to prevent server spoofing or man-in-the-middle attacks, 474 password authentication to prevent server spoofing or man-in-the-middle
469 which could otherwise be used to circumvent the encryption. The 475 attacks, which could otherwise be used to circumvent the encryption. The
470 StrictHostKeyChecking option can be used to control logins to machines 476 StrictHostKeyChecking option can be used to control logins to machines
471 whose host key is not known or has changed. 477 whose host key is not known or has changed.
472 478
473 When the user's identity has been accepted by the server, the server ei- 479 When the user's identity has been accepted by the server, the server
474 ther executes the given command, or logs into the machine and gives the 480 either executes the given command, or logs into the machine and gives the
475 user a normal shell on the remote machine. All communication with the 481 user a normal shell on the remote machine. All communication with the
476 remote command or shell will be automatically encrypted. 482 remote command or shell will be automatically encrypted.
477 483
@@ -487,14 +493,14 @@ AUTHENTICATION
487 exits and all X11 and TCP connections have been closed. 493 exits and all X11 and TCP connections have been closed.
488 494
489ESCAPE CHARACTERS 495ESCAPE CHARACTERS
490 When a pseudo-terminal has been requested, ssh supports a number of func- 496 When a pseudo-terminal has been requested, ssh supports a number of
491 tions through the use of an escape character. 497 functions through the use of an escape character.
492 498
493 A single tilde character can be sent as ~~ or by following the tilde by a 499 A single tilde character can be sent as ~~ or by following the tilde by a
494 character other than those described below. The escape character must 500 character other than those described below. The escape character must
495 always follow a newline to be interpreted as special. The escape charac- 501 always follow a newline to be interpreted as special. The escape
496 ter can be changed in configuration files using the EscapeChar configura- 502 character can be changed in configuration files using the EscapeChar
497 tion directive or on the command line by the -e option. 503 configuration directive or on the command line by the -e option.
498 504
499 The supported escapes (assuming the default `~') are: 505 The supported escapes (assuming the default `~') are:
500 506
@@ -531,8 +537,8 @@ TCP FORWARDING
531 In the example below, we look at encrypting communication between an IRC 537 In the example below, we look at encrypting communication between an IRC
532 client and server, even though the IRC server does not directly support 538 client and server, even though the IRC server does not directly support
533 encrypted communications. This works as follows: the user connects to 539 encrypted communications. This works as follows: the user connects to
534 the remote host using ssh, specifying a port to be used to forward con- 540 the remote host using ssh, specifying a port to be used to forward
535 nections to the remote server. After that it is possible to start the 541 connections to the remote server. After that it is possible to start the
536 service which is to be encrypted on the client machine, connecting to the 542 service which is to be encrypted on the client machine, connecting to the
537 same local port, and ssh will encrypt and forward the connection. 543 same local port, and ssh will encrypt and forward the connection.
538 544
@@ -543,11 +549,11 @@ TCP FORWARDING
543 $ irc -c '#users' -p 1234 pinky 127.0.0.1 549 $ irc -c '#users' -p 1234 pinky 127.0.0.1
544 550
545 This tunnels a connection to IRC server ``server.example.com'', joining 551 This tunnels a connection to IRC server ``server.example.com'', joining
546 channel ``#users'', nickname ``pinky'', using port 1234. It doesn't mat- 552 channel ``#users'', nickname ``pinky'', using port 1234. It doesn't
547 ter which port is used, as long as it's greater than 1023 (remember, only 553 matter which port is used, as long as it's greater than 1023 (remember,
548 root can open sockets on privileged ports) and doesn't conflict with any 554 only root can open sockets on privileged ports) and doesn't conflict with
549 ports already in use. The connection is forwarded to port 6667 on the 555 any ports already in use. The connection is forwarded to port 6667 on
550 remote server, since that's the standard port for IRC services. 556 the remote server, since that's the standard port for IRC services.
551 557
552 The -f option backgrounds ssh and the remote command ``sleep 10'' is 558 The -f option backgrounds ssh and the remote command ``sleep 10'' is
553 specified to allow an amount of time (10 seconds, in the example) to 559 specified to allow an amount of time (10 seconds, in the example) to
@@ -557,13 +563,13 @@ TCP FORWARDING
557X11 FORWARDING 563X11 FORWARDING
558 If the ForwardX11 variable is set to ``yes'' (or see the description of 564 If the ForwardX11 variable is set to ``yes'' (or see the description of
559 the -X, -x, and -Y options above) and the user is using X11 (the DISPLAY 565 the -X, -x, and -Y options above) and the user is using X11 (the DISPLAY
560 environment variable is set), the connection to the X11 display is auto- 566 environment variable is set), the connection to the X11 display is
561 matically forwarded to the remote side in such a way that any X11 pro- 567 automatically forwarded to the remote side in such a way that any X11
562 grams started from the shell (or command) will go through the encrypted 568 programs started from the shell (or command) will go through the
563 channel, and the connection to the real X server will be made from the 569 encrypted channel, and the connection to the real X server will be made
564 local machine. The user should not manually set DISPLAY. Forwarding of 570 from the local machine. The user should not manually set DISPLAY.
565 X11 connections can be configured on the command line or in configuration 571 Forwarding of X11 connections can be configured on the command line or in
566 files. 572 configuration files.
567 573
568 The DISPLAY value set by ssh will point to the server machine, but with a 574 The DISPLAY value set by ssh will point to the server machine, but with a
569 display number greater than zero. This is normal, and happens because 575 display number greater than zero. This is normal, and happens because
@@ -579,8 +585,8 @@ X11 FORWARDING
579 585
580 If the ForwardAgent variable is set to ``yes'' (or see the description of 586 If the ForwardAgent variable is set to ``yes'' (or see the description of
581 the -A and -a options above) and the user is using an authentication 587 the -A and -a options above) and the user is using an authentication
582 agent, the connection to the agent is automatically forwarded to the re- 588 agent, the connection to the agent is automatically forwarded to the
583 mote side. 589 remote side.
584 590
585VERIFYING HOST KEYS 591VERIFYING HOST KEYS
586 When connecting to a server for the first time, a fingerprint of the 592 When connecting to a server for the first time, a fingerprint of the
@@ -597,8 +603,8 @@ VERIFYING HOST KEYS
597 ``yes'', a small ASCII graphic gets displayed on every login to a server, 603 ``yes'', a small ASCII graphic gets displayed on every login to a server,
598 no matter if the session itself is interactive or not. By learning the 604 no matter if the session itself is interactive or not. By learning the
599 pattern a known server produces, a user can easily find out that the host 605 pattern a known server produces, a user can easily find out that the host
600 key has changed when a completely different pattern is displayed. Be- 606 key has changed when a completely different pattern is displayed.
601 cause these patterns are not unambiguous however, a pattern that looks 607 Because these patterns are not unambiguous however, a pattern that looks
602 similar to the pattern remembered only gives a good probability that the 608 similar to the pattern remembered only gives a good probability that the
603 host key is the same, not guaranteed proof. 609 host key is the same, not guaranteed proof.
604 610
@@ -634,15 +640,15 @@ VERIFYING HOST KEYS
634 640
635SSH-BASED VIRTUAL PRIVATE NETWORKS 641SSH-BASED VIRTUAL PRIVATE NETWORKS
636 ssh contains support for Virtual Private Network (VPN) tunnelling using 642 ssh contains support for Virtual Private Network (VPN) tunnelling using
637 the tun(4) network pseudo-device, allowing two networks to be joined se- 643 the tun(4) network pseudo-device, allowing two networks to be joined
638 curely. The sshd_config(5) configuration option PermitTunnel controls 644 securely. The sshd_config(5) configuration option PermitTunnel controls
639 whether the server supports this, and at what level (layer 2 or 3 traf- 645 whether the server supports this, and at what level (layer 2 or 3
640 fic). 646 traffic).
641 647
642 The following example would connect client network 10.0.50.0/24 with re- 648 The following example would connect client network 10.0.50.0/24 with
643 mote network 10.0.99.0/24 using a point-to-point connection from 10.1.1.1 649 remote network 10.0.99.0/24 using a point-to-point connection from
644 to 10.1.1.2, provided that the SSH server running on the gateway to the 650 10.1.1.1 to 10.1.1.2, provided that the SSH server running on the gateway
645 remote network, at 192.168.1.15, allows it. 651 to the remote network, at 192.168.1.15, allows it.
646 652
647 On the client: 653 On the client:
648 654
@@ -665,8 +671,8 @@ SSH-BASED VIRTUAL PRIVATE NETWORKS
665 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john 671 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
666 672
667 Since an SSH-based setup entails a fair amount of overhead, it may be 673 Since an SSH-based setup entails a fair amount of overhead, it may be
668 more suited to temporary setups, such as for wireless VPNs. More perma- 674 more suited to temporary setups, such as for wireless VPNs. More
669 nent VPNs are better provided by tools such as ipsecctl(8) and 675 permanent VPNs are better provided by tools such as ipsecctl(8) and
670 isakmpd(8). 676 isakmpd(8).
671 677
672ENVIRONMENT 678ENVIRONMENT
@@ -685,13 +691,13 @@ ENVIRONMENT
685 691
686 HOME Set to the path of the user's home directory. 692 HOME Set to the path of the user's home directory.
687 693
688 LOGNAME Synonym for USER; set for compatibility with sys- 694 LOGNAME Synonym for USER; set for compatibility with
689 tems that use this variable. 695 systems that use this variable.
690 696
691 MAIL Set to the path of the user's mailbox. 697 MAIL Set to the path of the user's mailbox.
692 698
693 PATH Set to the default PATH, as specified when compil- 699 PATH Set to the default PATH, as specified when
694 ing ssh. 700 compiling ssh.
695 701
696 SSH_ASKPASS If ssh needs a passphrase, it will read the 702 SSH_ASKPASS If ssh needs a passphrase, it will read the
697 passphrase from the current terminal if it was run 703 passphrase from the current terminal if it was run
@@ -699,49 +705,50 @@ ENVIRONMENT
699 associated with it but DISPLAY and SSH_ASKPASS are 705 associated with it but DISPLAY and SSH_ASKPASS are
700 set, it will execute the program specified by 706 set, it will execute the program specified by
701 SSH_ASKPASS and open an X11 window to read the 707 SSH_ASKPASS and open an X11 window to read the
702 passphrase. This is particularly useful when call- 708 passphrase. This is particularly useful when
703 ing ssh from a .xsession or related script. (Note 709 calling ssh from a .xsession or related script.
704 that on some machines it may be necessary to redi- 710 (Note that on some machines it may be necessary to
705 rect the input from /dev/null to make this work.) 711 redirect the input from /dev/null to make this
712 work.)
706 713
707 SSH_AUTH_SOCK Identifies the path of a UNIX-domain socket used to 714 SSH_AUTH_SOCK Identifies the path of a UNIX-domain socket used to
708 communicate with the agent. 715 communicate with the agent.
709 716
710 SSH_CONNECTION Identifies the client and server ends of the con- 717 SSH_CONNECTION Identifies the client and server ends of the
711 nection. The variable contains four space-separat- 718 connection. The variable contains four space-
712 ed values: client IP address, client port number, 719 separated values: client IP address, client port
713 server IP address, and server port number. 720 number, server IP address, and server port number.
714 721
715 SSH_ORIGINAL_COMMAND This variable contains the original command line if 722 SSH_ORIGINAL_COMMAND This variable contains the original command line if
716 a forced command is executed. It can be used to 723 a forced command is executed. It can be used to
717 extract the original arguments. 724 extract the original arguments.
718 725
719 SSH_TTY This is set to the name of the tty (path to the de- 726 SSH_TTY This is set to the name of the tty (path to the
720 vice) associated with the current shell or command. 727 device) associated with the current shell or
721 If the current session has no tty, this variable is 728 command. If the current session has no tty, this
722 not set. 729 variable is not set.
723 730
724 TZ This variable is set to indicate the present time 731 TZ This variable is set to indicate the present time
725 zone if it was set when the daemon was started 732 zone if it was set when the daemon was started
726 (i.e. the daemon passes the value on to new connec- 733 (i.e. the daemon passes the value on to new
727 tions). 734 connections).
728 735
729 USER Set to the name of the user logging in. 736 USER Set to the name of the user logging in.
730 737
731 Additionally, ssh reads ~/.ssh/environment, and adds lines of the format 738 Additionally, ssh reads ~/.ssh/environment, and adds lines of the format
732 ``VARNAME=value'' to the environment if the file exists and users are al- 739 ``VARNAME=value'' to the environment if the file exists and users are
733 lowed to change their environment. For more information, see the 740 allowed to change their environment. For more information, see the
734 PermitUserEnvironment option in sshd_config(5). 741 PermitUserEnvironment option in sshd_config(5).
735 742
736FILES 743FILES
737 ~/.rhosts 744 ~/.rhosts
738 This file is used for host-based authentication (see above). On 745 This file is used for host-based authentication (see above). On
739 some machines this file may need to be world-readable if the us- 746 some machines this file may need to be world-readable if the
740 er's home directory is on an NFS partition, because sshd(8) reads 747 user's home directory is on an NFS partition, because sshd(8)
741 it as root. Additionally, this file must be owned by the user, 748 reads it as root. Additionally, this file must be owned by the
742 and must not have write permissions for anyone else. The recom- 749 user, and must not have write permissions for anyone else. The
743 mended permission for most machines is read/write for the user, 750 recommended permission for most machines is read/write for the
744 and not accessible by others. 751 user, and not accessible by others.
745 752
746 ~/.shosts 753 ~/.shosts
747 This file is used in exactly the same way as .rhosts, but allows 754 This file is used in exactly the same way as .rhosts, but allows
@@ -749,18 +756,18 @@ FILES
749 rlogin/rsh. 756 rlogin/rsh.
750 757
751 ~/.ssh/ 758 ~/.ssh/
752 This directory is the default location for all user-specific con- 759 This directory is the default location for all user-specific
753 figuration and authentication information. There is no general 760 configuration and authentication information. There is no
754 requirement to keep the entire contents of this directory secret, 761 general requirement to keep the entire contents of this directory
755 but the recommended permissions are read/write/execute for the 762 secret, but the recommended permissions are read/write/execute
756 user, and not accessible by others. 763 for the user, and not accessible by others.
757 764
758 ~/.ssh/authorized_keys 765 ~/.ssh/authorized_keys
759 Lists the public keys (RSA/DSA) that can be used for logging in 766 Lists the public keys (RSA/DSA) that can be used for logging in
760 as this user. The format of this file is described in the 767 as this user. The format of this file is described in the
761 sshd(8) manual page. This file is not highly sensitive, but the 768 sshd(8) manual page. This file is not highly sensitive, but the
762 recommended permissions are read/write for the user, and not ac- 769 recommended permissions are read/write for the user, and not
763 cessible by others. 770 accessible by others.
764 771
765 ~/.ssh/config 772 ~/.ssh/config
766 This is the per-user configuration file. The file format and 773 This is the per-user configuration file. The file format and
@@ -776,11 +783,12 @@ FILES
776 ~/.ssh/id_dsa 783 ~/.ssh/id_dsa
777 ~/.ssh/id_rsa 784 ~/.ssh/id_rsa
778 Contains the private key for authentication. These files contain 785 Contains the private key for authentication. These files contain
779 sensitive data and should be readable by the user but not acces- 786 sensitive data and should be readable by the user but not
780 sible by others (read/write/execute). ssh will simply ignore a 787 accessible by others (read/write/execute). ssh will simply
781 private key file if it is accessible by others. It is possible 788 ignore a private key file if it is accessible by others. It is
782 to specify a passphrase when generating the key which will be 789 possible to specify a passphrase when generating the key which
783 used to encrypt the sensitive part of this file using 3DES. 790 will be used to encrypt the sensitive part of this file using
791 3DES.
784 792
785 ~/.ssh/identity.pub 793 ~/.ssh/identity.pub
786 ~/.ssh/id_dsa.pub 794 ~/.ssh/id_dsa.pub
@@ -804,8 +812,8 @@ FILES
804 should only be writable by root. 812 should only be writable by root.
805 813
806 /etc/shosts.equiv 814 /etc/shosts.equiv
807 This file is used in exactly the same way as hosts.equiv, but al- 815 This file is used in exactly the same way as hosts.equiv, but
808 lows host-based authentication without permitting login with 816 allows host-based authentication without permitting login with
809 rlogin/rsh. 817 rlogin/rsh.
810 818
811 /etc/ssh/ssh_config 819 /etc/ssh/ssh_config
@@ -817,11 +825,11 @@ FILES
817 /etc/ssh/ssh_host_rsa_key 825 /etc/ssh/ssh_host_rsa_key
818 These three files contain the private parts of the host keys and 826 These three files contain the private parts of the host keys and
819 are used for host-based authentication. If protocol version 1 is 827 are used for host-based authentication. If protocol version 1 is
820 used, ssh must be setuid root, since the host key is readable on- 828 used, ssh must be setuid root, since the host key is readable
821 ly by root. For protocol version 2, ssh uses ssh-keysign(8) to 829 only by root. For protocol version 2, ssh uses ssh-keysign(8) to
822 access the host keys, eliminating the requirement that ssh be se- 830 access the host keys, eliminating the requirement that ssh be
823 tuid root when host-based authentication is used. By default ssh 831 setuid root when host-based authentication is used. By default
824 is not setuid root. 832 ssh is not setuid root.
825 833
826 /etc/ssh/ssh_known_hosts 834 /etc/ssh/ssh_known_hosts
827 Systemwide list of known host keys. This file should be prepared 835 Systemwide list of known host keys. This file should be prepared
@@ -866,7 +874,7 @@ SEE ALSO
866 874
867 The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006. 875 The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006.
868 876
869 A. Perrig and D. Song, Hash Visualization: a New Technique to improve 877 A. Perrig, D. Song, Hash Visualization: a New Technique to improve
870 Real-World Security, 1999, International Workshop on Cryptographic 878 Real-World Security, 1999, International Workshop on Cryptographic
871 Techniques and E-Commerce (CrypTEC '99). 879 Techniques and E-Commerce (CrypTEC '99).
872 880
@@ -877,4 +885,4 @@ AUTHORS
877 created OpenSSH. Markus Friedl contributed the support for SSH protocol 885 created OpenSSH. Markus Friedl contributed the support for SSH protocol
878 versions 1.5 and 2.0. 886 versions 1.5 and 2.0.
879 887
880OpenBSD 4.7 March 26, 2010 14 888OpenBSD 4.8 August 4, 2010 OpenBSD 4.8