]> andersk Git - gssapi-openssh.git/blame - openssh/ssh.1
Import of OpenSSH 3.9p1
[gssapi-openssh.git] / openssh / ssh.1
CommitLineData
3c0ef626 1.\" -*- nroff -*-
2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5.\" All rights reserved
6.\"
7.\" As far as I am concerned, the code I have written for this software
8.\" can be used freely for any purpose. Any derived versions of this
9.\" software must be clearly marked as such, and if the derived work is
10.\" incompatible with the protocol description in the RFC file, it must be
11.\" called by a name other than "ssh" or "Secure Shell".
12.\"
13.\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
14.\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
15.\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
16.\"
17.\" Redistribution and use in source and binary forms, with or without
18.\" modification, are permitted provided that the following conditions
19.\" are met:
20.\" 1. Redistributions of source code must retain the above copyright
21.\" notice, this list of conditions and the following disclaimer.
22.\" 2. Redistributions in binary form must reproduce the above copyright
23.\" notice, this list of conditions and the following disclaimer in the
24.\" documentation and/or other materials provided with the distribution.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\"
c9f39d2c 37.\" $OpenBSD: ssh.1,v 1.194 2004/08/12 21:41:13 jakob Exp $
3c0ef626 38.Dd September 25, 1999
39.Dt SSH 1
40.Os
41.Sh NAME
42.Nm ssh
43.Nd OpenSSH SSH client (remote login program)
44.Sh SYNOPSIS
45.Nm ssh
c9f39d2c 46.Op Fl 1246AaCfgkMNnqsTtVvXxY
3c0ef626 47.Op Fl b Ar bind_address
48.Op Fl c Ar cipher_spec
c9f39d2c 49.Bk -words
cdd66111 50.Op Fl D Ar port
3c0ef626 51.Op Fl e Ar escape_char
9cb1827b 52.Op Fl F Ar configfile
cdd66111 53.Op Fl i Ar identity_file
3c0ef626 54.Oo Fl L Xo
55.Sm off
56.Ar port :
57.Ar host :
58.Ar hostport
59.Sm on
60.Xc
61.Oc
6a9b3198 62.Ek
cdd66111 63.Op Fl l Ar login_name
64.Op Fl m Ar mac_spec
65.Op Fl o Ar option
6a9b3198 66.Bk -words
cdd66111 67.Op Fl p Ar port
68.Ek
3c0ef626 69.Oo Fl R Xo
70.Sm off
71.Ar port :
72.Ar host :
73.Ar hostport
74.Sm on
75.Xc
76.Oc
c9f39d2c 77.Op Fl S Ar ctl
cdd66111 78.Oo Ar user Ns @ Oc Ns Ar hostname
3c0ef626 79.Op Ar command
80.Sh DESCRIPTION
81.Nm
82(SSH client) is a program for logging into a remote machine and for
83executing commands on a remote machine.
cdd66111 84It is intended to replace rlogin and rsh,
85and provide secure encrypted communications between
3c0ef626 86two untrusted hosts over an insecure network.
cdd66111 87X11 connections and arbitrary TCP/IP ports
88can also be forwarded over the secure channel.
3c0ef626 89.Pp
90.Nm
91connects and logs into the specified
cdd66111 92.Ar hostname
93(with optional
94.Ar user
95name).
3c0ef626 96The user must prove
97his/her identity to the remote machine using one of several methods
cdd66111 98depending on the protocol version used.
3c0ef626 99.Pp
cdd66111 100If
101.Ar command
102is specified,
103.Ar command
104is executed on the remote host instead of a login shell.
3c0ef626 105.Ss SSH protocol version 1
3c0ef626 106First, if the machine the user logs in from is listed in
107.Pa /etc/hosts.equiv
108or
109.Pa /etc/shosts.equiv
110on the remote machine, and the user names are
111the same on both sides, the user is immediately permitted to log in.
112Second, if
cdd66111 113.Pa .rhosts
3c0ef626 114or
cdd66111 115.Pa .shosts
3c0ef626 116exists in the user's home directory on the
117remote machine and contains a line containing the name of the client
118machine and the name of the user on that machine, the user is
119permitted to log in.
120This form of authentication alone is normally not
121allowed by the server because it is not secure.
122.Pp
123The second authentication method is the
cdd66111 124.Em rhosts
3c0ef626 125or
cdd66111 126.Em hosts.equiv
3c0ef626 127method combined with RSA-based host authentication.
128It means that if the login would be permitted by
129.Pa $HOME/.rhosts ,
130.Pa $HOME/.shosts ,
131.Pa /etc/hosts.equiv ,
132or
133.Pa /etc/shosts.equiv ,
134and if additionally the server can verify the client's
135host key (see
e9a17296 136.Pa /etc/ssh/ssh_known_hosts
3c0ef626 137and
138.Pa $HOME/.ssh/known_hosts
139in the
140.Sx FILES
cdd66111 141section), only then is login permitted.
3c0ef626 142This authentication method closes security holes due to IP
143spoofing, DNS spoofing and routing spoofing.
144[Note to the administrator:
145.Pa /etc/hosts.equiv ,
146.Pa $HOME/.rhosts ,
147and the rlogin/rsh protocol in general, are inherently insecure and should be
148disabled if security is desired.]
149.Pp
150As a third authentication method,
151.Nm
152supports RSA based authentication.
153The scheme is based on public-key cryptography: there are cryptosystems
154where encryption and decryption are done using separate keys, and it
155is not possible to derive the decryption key from the encryption key.
156RSA is one such system.
157The idea is that each user creates a public/private
158key pair for authentication purposes.
159The server knows the public key, and only the user knows the private key.
cdd66111 160.Pp
3c0ef626 161The file
162.Pa $HOME/.ssh/authorized_keys
cdd66111 163lists the public keys that are permitted for logging in.
3c0ef626 164When the user logs in, the
165.Nm
166program tells the server which key pair it would like to use for
167authentication.
cdd66111 168The server checks if this key is permitted, and if so,
169sends the user (actually the
3c0ef626 170.Nm
171program running on behalf of the user) a challenge, a random number,
172encrypted by the user's public key.
cdd66111 173The challenge can only be decrypted using the proper private key.
174The user's client then decrypts the challenge using the private key,
175proving that he/she knows the private key
176but without disclosing it to the server.
3c0ef626 177.Pp
178.Nm
179implements the RSA authentication protocol automatically.
180The user creates his/her RSA key pair by running
181.Xr ssh-keygen 1 .
182This stores the private key in
183.Pa $HOME/.ssh/identity
cdd66111 184and stores the public key in
3c0ef626 185.Pa $HOME/.ssh/identity.pub
186in the user's home directory.
187The user should then copy the
188.Pa identity.pub
189to
190.Pa $HOME/.ssh/authorized_keys
191in his/her home directory on the remote machine (the
192.Pa authorized_keys
193file corresponds to the conventional
194.Pa $HOME/.rhosts
195file, and has one key
196per line, though the lines can be very long).
197After this, the user can log in without giving the password.
cdd66111 198RSA authentication is much more secure than
199.Em rhosts
200authentication.
3c0ef626 201.Pp
202The most convenient way to use RSA authentication may be with an
203authentication agent.
204See
205.Xr ssh-agent 1
206for more information.
207.Pp
208If other authentication methods fail,
209.Nm
210prompts the user for a password.
211The password is sent to the remote
212host for checking; however, since all communications are encrypted,
213the password cannot be seen by someone listening on the network.
3c0ef626 214.Ss SSH protocol version 2
cdd66111 215When a user connects using protocol version 2,
e9a17296 216similar authentication methods are available.
3c0ef626 217Using the default values for
218.Cm PreferredAuthentications ,
219the client will try to authenticate first using the hostbased method;
cdd66111 220if this method fails, public key authentication is attempted,
221and finally if this method fails, keyboard-interactive and
3c0ef626 222password authentication are tried.
223.Pp
224The public key method is similar to RSA authentication described
225in the previous section and allows the RSA or DSA algorithm to be used:
226The client uses his private key,
227.Pa $HOME/.ssh/id_dsa
228or
229.Pa $HOME/.ssh/id_rsa ,
230to sign the session identifier and sends the result to the server.
231The server checks whether the matching public key is listed in
232.Pa $HOME/.ssh/authorized_keys
233and grants access if both the key is found and the signature is correct.
234The session identifier is derived from a shared Diffie-Hellman value
235and is only known to the client and the server.
236.Pp
cdd66111 237If public key authentication fails or is not available, a password
238can be sent encrypted to the remote host to prove the user's identity.
3c0ef626 239.Pp
240Additionally,
241.Nm
242supports hostbased or challenge response authentication.
243.Pp
244Protocol 2 provides additional mechanisms for confidentiality
c9f39d2c 245(the traffic is encrypted using AES, 3DES, Blowfish, CAST128 or Arcfour)
246and integrity (hmac-md5, hmac-sha1, hmac-ripemd160).
3c0ef626 247Note that protocol 1 lacks a strong mechanism for ensuring the
248integrity of the connection.
3c0ef626 249.Ss Login session and remote execution
3c0ef626 250When the user's identity has been accepted by the server, the server
251either executes the given command, or logs into the machine and gives
252the user a normal shell on the remote machine.
253All communication with
254the remote command or shell will be automatically encrypted.
255.Pp
256If a pseudo-terminal has been allocated (normal login session), the
257user may use the escape characters noted below.
258.Pp
cdd66111 259If no pseudo-tty has been allocated,
260the session is transparent and can be used to reliably transfer binary data.
3c0ef626 261On most systems, setting the escape character to
262.Dq none
263will also make the session transparent even if a tty is used.
264.Pp
265The session terminates when the command or shell on the remote
266machine exits and all X11 and TCP/IP connections have been closed.
cdd66111 267The exit status of the remote program is returned as the exit status of
3c0ef626 268.Nm ssh .
3c0ef626 269.Ss Escape Characters
cdd66111 270When a pseudo-terminal has been requested,
271.Nm
272supports a number of functions through the use of an escape character.
3c0ef626 273.Pp
274A single tilde character can be sent as
275.Ic ~~
276or by following the tilde by a character other than those described below.
277The escape character must always follow a newline to be interpreted as
278special.
279The escape character can be changed in configuration files using the
280.Cm EscapeChar
281configuration directive or on the command line by the
282.Fl e
283option.
284.Pp
285The supported escapes (assuming the default
286.Ql ~ )
287are:
288.Bl -tag -width Ds
289.It Cm ~.
cdd66111 290Disconnect.
3c0ef626 291.It Cm ~^Z
cdd66111 292Background
293.Nm ssh .
3c0ef626 294.It Cm ~#
cdd66111 295List forwarded connections.
3c0ef626 296.It Cm ~&
cdd66111 297Background
298.Nm
299at logout when waiting for forwarded connection / X11 sessions to terminate.
3c0ef626 300.It Cm ~?
cdd66111 301Display a list of escape characters.
0fff78ff 302.It Cm ~B
cdd66111 303Send a BREAK to the remote system
304(only useful for SSH protocol version 2 and if the peer supports it).
700318f3 305.It Cm ~C
c9f39d2c 306Open command line.
307Currently this allows the addition of port forwardings using the
700318f3 308.Fl L
309and
310.Fl R
c9f39d2c 311options (see below).
312It also allows the cancellation of existing remote port-forwardings
313using
314.Fl KR Ar hostport .
315Basic help is available, using the
316.Fl h
317option.
3c0ef626 318.It Cm ~R
cdd66111 319Request rekeying of the connection
320(only useful for SSH protocol version 2 and if the peer supports it).
3c0ef626 321.El
3c0ef626 322.Ss X11 and TCP forwarding
3c0ef626 323If the
324.Cm ForwardX11
325variable is set to
326.Dq yes
cdd66111 327(or see the description of the
3c0ef626 328.Fl X
329and
330.Fl x
331options described later)
332and the user is using X11 (the
333.Ev DISPLAY
334environment variable is set), the connection to the X11 display is
335automatically forwarded to the remote side in such a way that any X11
336programs started from the shell (or command) will go through the
337encrypted channel, and the connection to the real X server will be made
338from the local machine.
339The user should not manually set
340.Ev DISPLAY .
341Forwarding of X11 connections can be
342configured on the command line or in configuration files.
343.Pp
344The
345.Ev DISPLAY
346value set by
347.Nm
cdd66111 348will point to the server machine, but with a display number greater than zero.
3c0ef626 349This is normal, and happens because
350.Nm
351creates a
352.Dq proxy
353X server on the server machine for forwarding the
354connections over the encrypted channel.
355.Pp
356.Nm
357will also automatically set up Xauthority data on the server machine.
358For this purpose, it will generate a random authorization cookie,
359store it in Xauthority on the server, and verify that any forwarded
360connections carry this cookie and replace it by the real cookie when
361the connection is opened.
362The real authentication cookie is never
363sent to the server machine (and no cookies are sent in the plain).
364.Pp
41b2f314 365If the
366.Cm ForwardAgent
367variable is set to
368.Dq yes
cdd66111 369(or see the description of the
41b2f314 370.Fl A
371and
372.Fl a
6a9b3198 373options described later) and
41b2f314 374the user is using an authentication agent, the connection to the agent
375is automatically forwarded to the remote side.
3c0ef626 376.Pp
377Forwarding of arbitrary TCP/IP connections over the secure channel can
378be specified either on the command line or in a configuration file.
379One possible application of TCP/IP forwarding is a secure connection to an
380electronic purse; another is going through firewalls.
3c0ef626 381.Ss Server authentication
3c0ef626 382.Nm
383automatically maintains and checks a database containing
384identifications for all hosts it has ever been used with.
385Host keys are stored in
386.Pa $HOME/.ssh/known_hosts
387in the user's home directory.
388Additionally, the file
e9a17296 389.Pa /etc/ssh/ssh_known_hosts
3c0ef626 390is automatically checked for known hosts.
391Any new hosts are automatically added to the user's file.
cdd66111 392If a host's identification ever changes,
3c0ef626 393.Nm
394warns about this and disables password authentication to prevent a
395trojan horse from getting the user's password.
cdd66111 396Another purpose of this mechanism is to prevent man-in-the-middle attacks
397which could otherwise be used to circumvent the encryption.
3c0ef626 398The
399.Cm StrictHostKeyChecking
f5799ae1 400option can be used to prevent logins to machines whose
3c0ef626 401host key is not known or has changed.
402.Pp
c9f39d2c 403.Nm
404can be configured to verify host identification using fingerprint resource
405records (SSHFP) published in DNS.
406The
407.Cm VerifyHostKeyDNS
408option can be used to control how DNS lookups are performed.
409SSHFP resource records can be generated using
410.Xr ssh-keygen 1 .
411.Pp
3c0ef626 412The options are as follows:
413.Bl -tag -width Ds
cdd66111 414.It Fl 1
415Forces
416.Nm
417to try protocol version 1 only.
418.It Fl 2
419Forces
420.Nm
421to try protocol version 2 only.
422.It Fl 4
423Forces
424.Nm
425to use IPv4 addresses only.
426.It Fl 6
427Forces
428.Nm
429to use IPv6 addresses only.
3c0ef626 430.It Fl A
431Enables forwarding of the authentication agent connection.
432This can also be specified on a per-host basis in a configuration file.
41b2f314 433.Pp
6a9b3198 434Agent forwarding should be enabled with caution.
435Users with the ability to bypass file permissions on the remote host
436(for the agent's Unix-domain socket)
437can access the local agent through the forwarded connection.
438An attacker cannot obtain key material from the agent,
41b2f314 439however they can perform operations on the keys that enable them to
440authenticate using the identities loaded into the agent.
cdd66111 441.It Fl a
442Disables forwarding of the authentication agent connection.
3c0ef626 443.It Fl b Ar bind_address
444Specify the interface to transmit from on machines with multiple
445interfaces or aliased addresses.
cdd66111 446.It Fl C
447Requests compression of all data (including stdin, stdout, stderr, and
448data for forwarded X11 and TCP/IP connections).
449The compression algorithm is the same used by
450.Xr gzip 1 ,
451and the
452.Dq level
453can be controlled by the
454.Cm CompressionLevel
455option for protocol version 1.
456Compression is desirable on modem lines and other
457slow connections, but will only slow down things on fast networks.
458The default value can be set on a host-by-host basis in the
459configuration files; see the
460.Cm Compression
461option.
c9f39d2c 462.It Fl c Ar cipher_spec
463Selects the cipher specification for encrypting the session.
464.Pp
465Protocol version 1 allows specification of a single cipher.
466The suported values are
467.Dq 3des ,
468.Dq blowfish
469and
470.Dq des .
3c0ef626 471.Ar 3des
472(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
c9f39d2c 473It is believed to be secure.
3c0ef626 474.Ar blowfish
cdd66111 475is a fast block cipher; it appears very secure and is much faster than
3c0ef626 476.Ar 3des .
477.Ar des
478is only supported in the
479.Nm
480client for interoperability with legacy protocol 1 implementations
481that do not support the
482.Ar 3des
6a9b3198 483cipher.
484Its use is strongly discouraged due to cryptographic weaknesses.
c9f39d2c 485The default is
486.Dq 3des .
487.Pp
488For protocol version 2
489.Ar cipher_spec
490is a comma-separated list of ciphers
491listed in order of preference.
492The supported ciphers are
493.Dq 3des-cbc ,
494.Dq aes128-cbc ,
495.Dq aes192-cbc ,
496.Dq aes256-cbc ,
497.Dq aes128-ctr ,
498.Dq aes192-ctr ,
499.Dq aes256-ctr ,
500.Dq arcfour ,
501.Dq blowfish-cbc ,
502and
503.Dq cast128-cbc .
504The default is
505.Bd -literal
506 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
507 aes192-cbc,aes256-cbc''
508.Ed
cdd66111 509.It Fl D Ar port
510Specifies a local
511.Dq dynamic
512application-level port forwarding.
513This works by allocating a socket to listen to
514.Ar port
515on the local side, and whenever a connection is made to this port, the
516connection is forwarded over the secure channel, and the application
517protocol is then used to determine where to connect to from the
518remote machine.
519Currently the SOCKS4 and SOCKS5 protocols are supported, and
520.Nm
521will act as a SOCKS server.
522Only root can forward privileged ports.
523Dynamic port forwardings can also be specified in the configuration file.
524.It Fl e Ar ch | ^ch | none
3c0ef626 525Sets the escape character for sessions with a pty (default:
526.Ql ~ ) .
527The escape character is only recognized at the beginning of a line.
528The escape character followed by a dot
529.Pq Ql \&.
cdd66111 530closes the connection;
531followed by control-Z suspends the connection;
532and followed by itself sends the escape character once.
3c0ef626 533Setting the character to
534.Dq none
535disables any escapes and makes the session fully transparent.
cdd66111 536.It Fl F Ar configfile
537Specifies an alternative per-user configuration file.
538If a configuration file is given on the command line,
539the system-wide configuration file
540.Pq Pa /etc/ssh/ssh_config
541will be ignored.
542The default for the per-user configuration file is
543.Pa $HOME/.ssh/config .
3c0ef626 544.It Fl f
545Requests
546.Nm
547to go to background just before command execution.
548This is useful if
549.Nm
550is going to ask for passwords or passphrases, but the user
551wants it in the background.
552This implies
553.Fl n .
554The recommended way to start X11 programs at a remote site is with
555something like
556.Ic ssh -f host xterm .
557.It Fl g
558Allows remote hosts to connect to local forwarded ports.
cdd66111 559.It Fl I Ar smartcard_device
560Specifies which smartcard device to use.
561The argument is the device
562.Nm
563should use to communicate with a smartcard used for storing the user's
564private RSA key.
3c0ef626 565.It Fl i Ar identity_file
e9a17296 566Selects a file from which the identity (private key) for
3c0ef626 567RSA or DSA authentication is read.
e9a17296 568The default is
3c0ef626 569.Pa $HOME/.ssh/identity
e9a17296 570for protocol version 1, and
571.Pa $HOME/.ssh/id_rsa
572and
573.Pa $HOME/.ssh/id_dsa
574for protocol version 2.
3c0ef626 575Identity files may also be specified on
576a per-host basis in the configuration file.
577It is possible to have multiple
578.Fl i
579options (and multiple identities specified in
580configuration files).
3c0ef626 581.It Fl k
cdd66111 582Disables forwarding (delegation) of GSSAPI credentials to the server.
583.It Fl L Xo
584.Sm off
585.Ar port : host : hostport
586.Sm on
587.Xc
588Specifies that the given port on the local (client) host is to be
589forwarded to the given host and port on the remote side.
590This works by allocating a socket to listen to
591.Ar port
592on the local side, and whenever a connection is made to this port, the
593connection is forwarded over the secure channel, and a connection is
594made to
595.Ar host
596port
597.Ar hostport
598from the remote machine.
599Port forwardings can also be specified in the configuration file.
600Only root can forward privileged ports.
601IPv6 addresses can be specified with an alternative syntax:
602.Sm off
603.Xo
604.Ar port No / Ar host No /
605.Ar hostport .
606.Xc
607.Sm on
3c0ef626 608.It Fl l Ar login_name
609Specifies the user to log in as on the remote machine.
610This also may be specified on a per-host basis in the configuration file.
c9f39d2c 611.It Fl M
612Places the
613.Nm
614client into
615.Dq master
616mode for connection sharing.
617Refer to the description of
618.Cm ControlMaster
619in
620.Xr ssh_config 5
621for details.
3c0ef626 622.It Fl m Ar mac_spec
623Additionally, for protocol version 2 a comma-separated list of MAC
624(message authentication code) algorithms can
625be specified in order of preference.
626See the
627.Cm MACs
628keyword for more information.
cdd66111 629.It Fl N
630Do not execute a remote command.
631This is useful for just forwarding ports
632(protocol version 2 only).
3c0ef626 633.It Fl n
634Redirects stdin from
635.Pa /dev/null
636(actually, prevents reading from stdin).
637This must be used when
638.Nm
639is run in the background.
640A common trick is to use this to run X11 programs on a remote machine.
641For example,
642.Ic ssh -n shadows.cs.hut.fi emacs &
643will start an emacs on shadows.cs.hut.fi, and the X11
644connection will be automatically forwarded over an encrypted channel.
645The
646.Nm
647program will be put in the background.
648(This does not work if
649.Nm
650needs to ask for a password or passphrase; see also the
651.Fl f
652option.)
3c0ef626 653.It Fl o Ar option
654Can be used to give options in the format used in the configuration file.
655This is useful for specifying options for which there is no separate
656command-line flag.
cdd66111 657For full details of the options listed below, and their possible values, see
658.Xr ssh_config 5 .
659.Pp
660.Bl -tag -width Ds -offset indent -compact
661.It AddressFamily
662.It BatchMode
663.It BindAddress
664.It ChallengeResponseAuthentication
665.It CheckHostIP
666.It Cipher
667.It Ciphers
668.It ClearAllForwardings
669.It Compression
670.It CompressionLevel
671.It ConnectionAttempts
c9f39d2c 672.It ConnectTimeout
673.It ControlMaster
674.It ControlPath
cdd66111 675.It DynamicForward
676.It EscapeChar
677.It ForwardAgent
678.It ForwardX11
679.It ForwardX11Trusted
680.It GatewayPorts
681.It GlobalKnownHostsFile
682.It GSSAPIAuthentication
683.It GSSAPIDelegateCredentials
684.It Host
685.It HostbasedAuthentication
686.It HostKeyAlgorithms
687.It HostKeyAlias
688.It HostName
689.It IdentityFile
99be0775 690.It IdentitiesOnly
cdd66111 691.It LocalForward
692.It LogLevel
693.It MACs
694.It NoHostAuthenticationForLocalhost
695.It NumberOfPasswordPrompts
696.It PasswordAuthentication
697.It Port
698.It PreferredAuthentications
699.It Protocol
700.It ProxyCommand
701.It PubkeyAuthentication
702.It RemoteForward
703.It RhostsRSAAuthentication
704.It RSAAuthentication
c9f39d2c 705.It SendEnv
cdd66111 706.It ServerAliveInterval
707.It ServerAliveCountMax
708.It SmartcardDevice
709.It StrictHostKeyChecking
710.It TCPKeepAlive
711.It UsePrivilegedPort
712.It User
713.It UserKnownHostsFile
714.It VerifyHostKeyDNS
715.It XAuthLocation
716.El
3c0ef626 717.It Fl p Ar port
718Port to connect to on the remote host.
719This can be specified on a
720per-host basis in the configuration file.
3c0ef626 721.It Fl q
722Quiet mode.
723Causes all warning and diagnostic messages to be suppressed.
cdd66111 724.It Fl R Xo
725.Sm off
726.Ar port : host : hostport
727.Sm on
728.Xc
729Specifies that the given port on the remote (server) host is to be
730forwarded to the given host and port on the local side.
731This works by allocating a socket to listen to
732.Ar port
733on the remote side, and whenever a connection is made to this port, the
734connection is forwarded over the secure channel, and a connection is
735made to
736.Ar host
737port
738.Ar hostport
739from the local machine.
740Port forwardings can also be specified in the configuration file.
741Privileged ports can be forwarded only when
742logging in as root on the remote machine.
743IPv6 addresses can be specified with an alternative syntax:
744.Sm off
745.Xo
746.Ar port No / Ar host No /
747.Ar hostport .
748.Xc
749.Sm on
c9f39d2c 750.It Fl S Ar ctl
751Specifies the location of a control socket for connection sharing.
752Refer to the description of
753.Cm ControlPath
754and
755.Cm ControlMaster
756in
757.Xr ssh_config 5
758for details.
3c0ef626 759.It Fl s
0fff78ff 760May be used to request invocation of a subsystem on the remote system.
761Subsystems are a feature of the SSH2 protocol which facilitate the use
cdd66111 762of SSH as a secure transport for other applications (eg.\&
763.Xr sftp 1 ) .
0fff78ff 764The subsystem is specified as the remote command.
cdd66111 765.It Fl T
766Disable pseudo-tty allocation.
3c0ef626 767.It Fl t
768Force pseudo-tty allocation.
769This can be used to execute arbitrary
770screen-based programs on a remote machine, which can be very useful,
771e.g., when implementing menu services.
772Multiple
773.Fl t
774options force tty allocation, even if
775.Nm
776has no local tty.
cdd66111 777.It Fl V
778Display the version number and exit.
3c0ef626 779.It Fl v
780Verbose mode.
781Causes
782.Nm
783to print debugging messages about its progress.
784This is helpful in
785debugging connection, authentication, and configuration problems.
786Multiple
787.Fl v
0fff78ff 788options increase the verbosity.
789The maximum is 3.
3c0ef626 790.It Fl X
791Enables X11 forwarding.
792This can also be specified on a per-host basis in a configuration file.
41b2f314 793.Pp
6a9b3198 794X11 forwarding should be enabled with caution.
795Users with the ability to bypass file permissions on the remote host
796(for the user's X authorization database)
797can access the local X11 display through the forwarded connection.
798An attacker may then be able to perform activities such as keystroke monitoring.
cdd66111 799.It Fl x
800Disables X11 forwarding.
801.It Fl Y
802Enables trusted X11 forwarding.
3c0ef626 803.El
804.Sh CONFIGURATION FILES
805.Nm
f5799ae1 806may additionally obtain configuration data from
807a per-user configuration file and a system-wide configuration file.
808The file format and configuration options are described in
809.Xr ssh_config 5 .
3c0ef626 810.Sh ENVIRONMENT
811.Nm
812will normally set the following environment variables:
cdd66111 813.Bl -tag -width LOGNAME
3c0ef626 814.It Ev DISPLAY
815The
816.Ev DISPLAY
817variable indicates the location of the X11 server.
818It is automatically set by
819.Nm
820to point to a value of the form
821.Dq hostname:n
822where hostname indicates
cdd66111 823the host where the shell runs, and n is an integer \*(Ge 1.
3c0ef626 824.Nm
825uses this special value to forward X11 connections over the secure
826channel.
827The user should normally not set
828.Ev DISPLAY
829explicitly, as that
830will render the X11 connection insecure (and will require the user to
831manually copy any required authorization cookies).
832.It Ev HOME
833Set to the path of the user's home directory.
834.It Ev LOGNAME
835Synonym for
836.Ev USER ;
837set for compatibility with systems that use this variable.
838.It Ev MAIL
839Set to the path of the user's mailbox.
840.It Ev PATH
841Set to the default
842.Ev PATH ,
843as specified when compiling
844.Nm ssh .
845.It Ev SSH_ASKPASS
846If
847.Nm
848needs a passphrase, it will read the passphrase from the current
849terminal if it was run from a terminal.
850If
851.Nm
852does not have a terminal associated with it but
853.Ev DISPLAY
854and
855.Ev SSH_ASKPASS
856are set, it will execute the program specified by
857.Ev SSH_ASKPASS
858and open an X11 window to read the passphrase.
859This is particularly useful when calling
860.Nm
861from a
862.Pa .Xsession
863or related script.
864(Note that on some machines it
865may be necessary to redirect the input from
866.Pa /dev/null
867to make this work.)
868.It Ev SSH_AUTH_SOCK
869Identifies the path of a unix-domain socket used to communicate with the
870agent.
41b2f314 871.It Ev SSH_CONNECTION
872Identifies the client and server ends of the connection.
3c0ef626 873The variable contains
41b2f314 874four space-separated values: client ip-address, client port number,
875server ip-address and server port number.
3c0ef626 876.It Ev SSH_ORIGINAL_COMMAND
877The variable contains the original command line if a forced command
878is executed.
879It can be used to extract the original arguments.
880.It Ev SSH_TTY
881This is set to the name of the tty (path to the device) associated
882with the current shell or command.
883If the current session has no tty,
884this variable is not set.
885.It Ev TZ
886The timezone variable is set to indicate the present timezone if it
887was set when the daemon was started (i.e., the daemon passes the value
888on to new connections).
889.It Ev USER
890Set to the name of the user logging in.
891.El
892.Pp
893Additionally,
894.Nm
895reads
896.Pa $HOME/.ssh/environment ,
897and adds lines of the format
898.Dq VARNAME=value
41b2f314 899to the environment if the file exists and if users are allowed to
900change their environment.
cdd66111 901For more information, see the
41b2f314 902.Cm PermitUserEnvironment
903option in
904.Xr sshd_config 5 .
3c0ef626 905.Sh FILES
906.Bl -tag -width Ds
907.It Pa $HOME/.ssh/known_hosts
908Records host keys for all hosts the user has logged into that are not
909in
e9a17296 910.Pa /etc/ssh/ssh_known_hosts .
3c0ef626 911See
912.Xr sshd 8 .
913.It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa
914Contains the authentication identity of the user.
915They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively.
916These files
917contain sensitive data and should be readable by the user but not
918accessible by others (read/write/execute).
919Note that
920.Nm
921ignores a private key file if it is accessible by others.
922It is possible to specify a passphrase when
923generating the key; the passphrase will be used to encrypt the
924sensitive part of this file using 3DES.
925.It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub
926Contains the public key for authentication (public part of the
927identity file in human-readable form).
928The contents of the
929.Pa $HOME/.ssh/identity.pub
cdd66111 930file should be added to the file
3c0ef626 931.Pa $HOME/.ssh/authorized_keys
932on all machines
933where the user wishes to log in using protocol version 1 RSA authentication.
934The contents of the
935.Pa $HOME/.ssh/id_dsa.pub
936and
937.Pa $HOME/.ssh/id_rsa.pub
938file should be added to
939.Pa $HOME/.ssh/authorized_keys
940on all machines
941where the user wishes to log in using protocol version 2 DSA/RSA authentication.
942These files are not
943sensitive and can (but need not) be readable by anyone.
944These files are
945never used automatically and are not necessary; they are only provided for
946the convenience of the user.
947.It Pa $HOME/.ssh/config
948This is the per-user configuration file.
f5799ae1 949The file format and configuration options are described in
950.Xr ssh_config 5 .
c9f39d2c 951Because of the potential for abuse, this file must have strict permissions:
952read/write for the user, and not accessible by others.
3c0ef626 953.It Pa $HOME/.ssh/authorized_keys
954Lists the public keys (RSA/DSA) that can be used for logging in as this user.
955The format of this file is described in the
956.Xr sshd 8
957manual page.
cdd66111 958In the simplest form the format is the same as the
959.Pa .pub
3c0ef626 960identity files.
961This file is not highly sensitive, but the recommended
962permissions are read/write for the user, and not accessible by others.
e9a17296 963.It Pa /etc/ssh/ssh_known_hosts
3c0ef626 964Systemwide list of known host keys.
965This file should be prepared by the
966system administrator to contain the public host keys of all machines in the
967organization.
968This file should be world-readable.
969This file contains
970public keys, one per line, in the following format (fields separated
971by spaces): system name, public key and optional comment field.
972When different names are used
973for the same machine, all such names should be listed, separated by
974commas.
cdd66111 975The format is described in the
3c0ef626 976.Xr sshd 8
977manual page.
978.Pp
979The canonical system name (as returned by name servers) is used by
980.Xr sshd 8
981to verify the client host when logging in; other names are needed because
982.Nm
983does not convert the user-supplied name to a canonical name before
984checking the key, because someone with access to the name servers
985would then be able to fool host authentication.
e9a17296 986.It Pa /etc/ssh/ssh_config
3c0ef626 987Systemwide configuration file.
f5799ae1 988The file format and configuration options are described in
989.Xr ssh_config 5 .
e9a17296 990.It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
3c0ef626 991These three files contain the private parts of the host keys
992and are used for
993.Cm RhostsRSAAuthentication
994and
995.Cm HostbasedAuthentication .
f5799ae1 996If the protocol version 1
997.Cm RhostsRSAAuthentication
998method is used,
999.Nm
1000must be setuid root, since the host key is readable only by root.
1001For protocol version 2,
1002.Nm
1003uses
1004.Xr ssh-keysign 8
1005to access the host keys for
1006.Cm HostbasedAuthentication .
1007This eliminates the requirement that
1008.Nm
1009be setuid root when that authentication method is used.
1010By default
3c0ef626 1011.Nm
f5799ae1 1012is not setuid root.
3c0ef626 1013.It Pa $HOME/.rhosts
1014This file is used in
cdd66111 1015.Em rhosts
3c0ef626 1016authentication to list the
1017host/user pairs that are permitted to log in.
1018(Note that this file is
1019also used by rlogin and rsh, which makes using this file insecure.)
1020Each line of the file contains a host name (in the canonical form
1021returned by name servers), and then a user name on that host,
1022separated by a space.
1023On some machines this file may need to be
1024world-readable if the user's home directory is on a NFS partition,
1025because
1026.Xr sshd 8
1027reads it as root.
1028Additionally, this file must be owned by the user,
1029and must not have write permissions for anyone else.
1030The recommended
1031permission for most machines is read/write for the user, and not
1032accessible by others.
1033.Pp
1034Note that by default
1035.Xr sshd 8
1036will be installed so that it requires successful RSA host
cdd66111 1037authentication before permitting
1038.Em rhosts
1039authentication.
3c0ef626 1040If the server machine does not have the client's host key in
e9a17296 1041.Pa /etc/ssh/ssh_known_hosts ,
3c0ef626 1042it can be stored in
1043.Pa $HOME/.ssh/known_hosts .
1044The easiest way to do this is to
1045connect back to the client from the server machine using ssh; this
1046will automatically add the host key to
1047.Pa $HOME/.ssh/known_hosts .
1048.It Pa $HOME/.shosts
1049This file is used exactly the same way as
cdd66111 1050.Pa .rhosts .
3c0ef626 1051The purpose for
1052having this file is to be able to use rhosts authentication with
1053.Nm
1054without permitting login with
cdd66111 1055.Xr rlogin
3c0ef626 1056or
1057.Xr rsh 1 .
1058.It Pa /etc/hosts.equiv
1059This file is used during
cdd66111 1060.Em rhosts
0fff78ff 1061authentication.
3c0ef626 1062It contains
cdd66111 1063canonical hosts names, one per line (the full format is described in the
3c0ef626 1064.Xr sshd 8
1065manual page).
1066If the client host is found in this file, login is
1067automatically permitted provided client and server user names are the
1068same.
1069Additionally, successful RSA host authentication is normally
1070required.
1071This file should only be writable by root.
1072.It Pa /etc/shosts.equiv
1073This file is processed exactly as
1074.Pa /etc/hosts.equiv .
1075This file may be useful to permit logins using
1076.Nm
1077but not using rsh/rlogin.
e9a17296 1078.It Pa /etc/ssh/sshrc
3c0ef626 1079Commands in this file are executed by
1080.Nm
1081when the user logs in just before the user's shell (or command) is started.
1082See the
1083.Xr sshd 8
1084manual page for more information.
1085.It Pa $HOME/.ssh/rc
1086Commands in this file are executed by
1087.Nm
1088when the user logs in just before the user's shell (or command) is
1089started.
1090See the
1091.Xr sshd 8
1092manual page for more information.
1093.It Pa $HOME/.ssh/environment
1094Contains additional definitions for environment variables, see section
1095.Sx ENVIRONMENT
1096above.
1097.El
e9a17296 1098.Sh DIAGNOSTICS
1099.Nm
1100exits with the exit status of the remote command or with 255
1101if an error occurred.
3c0ef626 1102.Sh SEE ALSO
cdd66111 1103.Xr gzip 1 ,
3c0ef626 1104.Xr rsh 1 ,
1105.Xr scp 1 ,
1106.Xr sftp 1 ,
1107.Xr ssh-add 1 ,
1108.Xr ssh-agent 1 ,
1109.Xr ssh-keygen 1 ,
1110.Xr telnet 1 ,
cdd66111 1111.Xr hosts.equiv 5 ,
680cee3b 1112.Xr ssh_config 5 ,
1113.Xr ssh-keysign 8 ,
3c0ef626 1114.Xr sshd 8
1115.Rs
1116.%A T. Ylonen
1117.%A T. Kivinen
1118.%A M. Saarinen
1119.%A T. Rinne
1120.%A S. Lehtinen
1121.%T "SSH Protocol Architecture"
700318f3 1122.%N draft-ietf-secsh-architecture-12.txt
1123.%D January 2002
3c0ef626 1124.%O work in progress material
1125.Re
0fff78ff 1126.Sh AUTHORS
1127OpenSSH is a derivative of the original and free
1128ssh 1.2.12 release by Tatu Ylonen.
1129Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1130Theo de Raadt and Dug Song
1131removed many bugs, re-added newer features and
1132created OpenSSH.
1133Markus Friedl contributed the support for SSH
1134protocol versions 1.5 and 2.0.
This page took 0.568371 seconds and 5 git commands to generate.