xref: /freebsd/crypto/openssh/ssh.1 (revision 56ca39961bd1c9946a505c41c3fc634ef63fdd42)
1.\"  -*- nroff -*-
2.\"
3.\" ssh.1.in
4.\"
5.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
6.\"
7.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8.\"                    All rights reserved
9.\"
10.\" Created: Sat Apr 22 21:55:14 1995 ylo
11.\"
12.\" $Id: ssh.1,v 1.43 2000/03/24 03:04:46 brad Exp $
13.\" $FreeBSD$
14.\"
15.Dd September 25, 1999
16.Dt SSH 1
17.Os
18.Sh NAME
19.Nm ssh
20.Nd OpenSSH secure shell client (remote login program)
21.Sh SYNOPSIS
22.Nm ssh
23.Op Fl l Ar login_name
24.Op Ar hostname | user@hostname
25.Op Ar command
26.Pp
27.Nm ssh
28.Op Fl afgknqtvxCPX46
29.Op Fl c Ar blowfish | 3des
30.Op Fl e Ar escape_char
31.Op Fl i Ar identity_file
32.Op Fl l Ar login_name
33.Op Fl o Ar option
34.Op Fl p Ar port
35.Oo Fl L Xo
36.Sm off
37.Ar port :
38.Ar host :
39.Ar hostport
40.Sm on
41.Xc
42.Oc
43.Oo Fl R Xo
44.Sm off
45.Ar port :
46.Ar host :
47.Ar hostport
48.Sm on
49.Xc
50.Oc
51.Op Ar hostname | user@hostname
52.Op Ar command
53.Sh DESCRIPTION
54.Nm
55(Secure Shell) is a program for logging into a remote machine and for
56executing commands on a remote machine.
57It is intended to replace
58rlogin and rsh, and provide secure encrypted communications between
59two untrusted hosts over an insecure network.
60X11 connections and
61arbitrary TCP/IP ports can also be forwarded over the secure channel.
62.Pp
63.Nm
64connects and logs into the specified
65.Ar hostname .
66The user must prove
67his/her identity to the remote machine using one of several methods.
68.Pp
69First, if the machine the user logs in from is listed in
70.Pa /etc/hosts.equiv
71or
72.Pa /etc/ssh/shosts.equiv
73on the remote machine, and the user names are
74the same on both sides, the user is immediately permitted to log in.
75Second, if
76.Pa \&.rhosts
77or
78.Pa \&.shosts
79exists in the user's home directory on the
80remote machine and contains a line containing the name of the client
81machine and the name of the user on that machine, the user is
82permitted to log in.
83This form of authentication alone is normally not
84allowed by the server because it is not secure.
85.Pp
86The second (and primary) authentication method is the
87.Pa rhosts
88or
89.Pa hosts.equiv
90method combined with RSA-based host authentication.
91It means that if the login would be permitted by
92.Pa \&.rhosts ,
93.Pa \&.shosts ,
94.Pa /etc/hosts.equiv ,
95or
96.Pa /etc/ssh/shosts.equiv ,
97and if additionally the server can verify the client's
98host key (see
99.Pa /etc/ssh/ssh_known_hosts
100and
101.Pa $HOME/.ssh/known_hosts
102in the
103.Sx FILES
104section), only then login is permitted.
105This authentication method closes security holes due to IP
106spoofing, DNS spoofing and routing spoofing.
107[Note to the administrator:
108.Pa /etc/hosts.equiv ,
109.Pa \&.rhosts ,
110and the rlogin/rsh protocol in general, are inherently insecure and should be
111disabled if security is desired.]
112.Pp
113As a third authentication method,
114.Nm
115supports RSA based authentication.
116The scheme is based on public-key cryptography: there are cryptosystems
117where encryption and decryption are done using separate keys, and it
118is not possible to derive the decryption key from the encryption key.
119RSA is one such system.
120The idea is that each user creates a public/private
121key pair for authentication purposes.
122The server knows the public key, and only the user knows the private key.
123The file
124.Pa $HOME/.ssh/authorized_keys
125lists the public keys that are permitted for logging
126in.
127When the user logs in, the
128.Nm
129program tells the server which key pair it would like to use for
130authentication.
131The server checks if this key is permitted, and if
132so, sends the user (actually the
133.Nm
134program running on behalf of the user) a challenge, a random number,
135encrypted by the user's public key.
136The challenge can only be
137decrypted using the proper private key.
138The user's client then decrypts the
139challenge using the private key, proving that he/she knows the private
140key but without disclosing it to the server.
141.Pp
142.Nm
143implements the RSA authentication protocol automatically.
144The user creates his/her RSA key pair by running
145.Xr ssh-keygen 1 .
146This stores the private key in
147.Pa \&.ssh/identity
148and the public key in
149.Pa \&.ssh/identity.pub
150in the user's home directory.
151The user should then copy the
152.Pa identity.pub
153to
154.Pa \&.ssh/authorized_keys
155in his/her home directory on the remote machine (the
156.Pa authorized_keys
157file corresponds to the conventional
158.Pa \&.rhosts
159file, and has one key
160per line, though the lines can be very long).
161After this, the user can log in without giving the password.
162RSA authentication is much
163more secure than rhosts authentication.
164.Pp
165The most convenient way to use RSA authentication may be with an
166authentication agent.
167See
168.Xr ssh-agent 1
169for more information.
170.Pp
171If other authentication methods fail,
172.Nm
173prompts the user for a password.
174The password is sent to the remote
175host for checking; however, since all communications are encrypted,
176the password cannot be seen by someone listening on the network.
177.Pp
178When the user's identity has been accepted by the server, the server
179either executes the given command, or logs into the machine and gives
180the user a normal shell on the remote machine.
181All communication with
182the remote command or shell will be automatically encrypted.
183.Pp
184If a pseudo-terminal has been allocated (normal login session), the
185user can disconnect with
186.Ic ~. ,
187and suspend
188.Nm
189with
190.Ic ~^Z .
191All forwarded connections can be listed with
192.Ic ~#
193and if
194the session blocks waiting for forwarded X11 or TCP/IP
195connections to terminate, it can be backgrounded with
196.Ic ~&
197(this should not be used while the user shell is active, as it can cause the
198shell to hang).
199All available escapes can be listed with
200.Ic ~? .
201.Pp
202A single tilde character can be sent as
203.Ic ~~
204(or by following the tilde by a character other than those described above).
205The escape character must always follow a newline to be interpreted as
206special.
207The escape character can be changed in configuration files
208or on the command line.
209.Pp
210If no pseudo tty has been allocated, the
211session is transparent and can be used to reliably transfer binary
212data.
213On most systems, setting the escape character to
214.Dq none
215will also make the session transparent even if a tty is used.
216.Pp
217The session terminates when the command or shell in on the remote
218machine exists and all X11 and TCP/IP connections have been closed.
219The exit status of the remote program is returned as the exit status
220of
221.Nm ssh .
222.Pp
223If the user is using X11 (the
224.Ev DISPLAY
225environment variable is set), the connection to the X11 display can
226be forwarded to the remote side in such a way that any X11
227programs started from the shell (or command) will go through the
228encrypted channel, and the connection to the real X server will be made
229from the local machine.
230The user should not manually set
231.Ev DISPLAY .
232Forwarding of X11 connections weakens the security of ssh and is
233disabled by default.  X11 forwarding can be enabled on the command line
234or in configuration files.
235.Pp
236The
237.Ev DISPLAY
238value set by
239.Nm
240will point to the server machine, but with a display number greater
241than zero.
242This is normal, and happens because
243.Nm
244creates a
245.Dq proxy
246X server on the server machine for forwarding the
247connections over the encrypted channel.
248.Pp
249.Nm
250will also automatically set up Xauthority data on the server machine.
251For this purpose, it will generate a random authorization cookie,
252store it in Xauthority on the server, and verify that any forwarded
253connections carry this cookie and replace it by the real cookie when
254the connection is opened.
255The real authentication cookie is never
256sent to the server machine (and no cookies are sent in the plain).
257.Pp
258If the user is using an authentication agent, the connection to the agent
259is automatically forwarded to the remote side unless disabled on
260command line or in a configuration file.
261.Pp
262Forwarding of arbitrary TCP/IP connections over the secure channel can
263be specified either on command line or in a configuration file.
264One possible application of TCP/IP forwarding is a secure connection to an
265electronic purse; another is going trough firewalls.
266.Pp
267.Nm
268automatically maintains and checks a database containing RSA-based
269identifications for all hosts it has ever been used with.
270The database is stored in
271.Pa \&.ssh/known_hosts
272in the user's home directory.
273Additionally, the file
274.Pa /etc/ssh/ssh_known_hosts
275is automatically checked for known hosts.
276Any new hosts are automatically added to the user's file.
277If a host's identification
278ever changes,
279.Nm
280warns about this and disables password authentication to prevent a
281trojan horse from getting the user's password.
282Another purpose of
283this mechanism is to prevent man-in-the-middle attacks which could
284otherwise be used to circumvent the encryption.
285The
286.Cm StrictHostKeyChecking
287option (see below) can be used to prevent logins to machines whose
288host key is not known or has changed.
289.Sh OPTIONS
290.Bl -tag -width Ds
291.It Fl a
292Disables forwarding of the authentication agent connection.
293This may also be specified on a per-host basis in the configuration file.
294.It Fl c Ar blowfish|3des
295Selects the cipher to use for encrypting the session.
296.Ar 3des
297is used by default.
298It is believed to be secure.
299.Ar 3des
300(triple-des) is an encrypt-decrypt-encrypt triple with three different keys.
301It is presumably more secure than the
302.Ar des
303cipher which is no longer supported in ssh.
304.Ar blowfish
305is a fast block cipher, it appears very secure and is much faster than
306.Ar 3des .
307.It Fl e Ar ch|^ch|none
308Sets the escape character for sessions with a pty (default:
309.Ql ~ ) .
310The escape character is only recognized at the beginning of a line.
311The escape character followed by a dot
312.Pq Ql \&.
313closes the connection, followed
314by control-Z suspends the connection, and followed by itself sends the
315escape character once.
316Setting the character to
317.Dq none
318disables any escapes and makes the session fully transparent.
319.It Fl f
320Requests
321.Nm
322to go to background just before command execution.
323This is useful if
324.Nm
325is going to ask for passwords or passphrases, but the user
326wants it in the background.
327This implies
328.Fl n .
329The recommended way to start X11 programs at a remote site is with
330something like
331.Ic ssh -f host xterm .
332.It Fl g
333Allows remote hosts to connect to local forwarded ports.
334.It Fl i Ar identity_file
335Selects the file from which the identity (private key) for
336RSA authentication is read.
337Default is
338.Pa \&.ssh/identity
339in the user's home directory.
340Identity files may also be specified on
341a per-host basis in the configuration file.
342It is possible to have multiple
343.Fl i
344options (and multiple identities specified in
345configuration files).
346.It Fl k
347Disables forwarding of Kerberos tickets and AFS tokens.
348This may also be specified on a per-host basis in the configuration file.
349.It Fl l Ar login_name
350Specifies the user to log in as on the remote machine.
351This also may be specified on a per-host basis in the configuration file.
352.It Fl n
353Redirects stdin from
354.Pa /dev/null
355(actually, prevents reading from stdin).
356This must be used when
357.Nm
358is run in the background.
359A common trick is to use this to run X11 programs on a remote machine.
360For example,
361.Ic ssh -n shadows.cs.hut.fi emacs &
362will start an emacs on shadows.cs.hut.fi, and the X11
363connection will be automatically forwarded over an encrypted channel.
364The
365.Nm
366program will be put in the background.
367(This does not work if
368.Nm
369needs to ask for a password or passphrase; see also the
370.Fl f
371option.)
372.It Fl o Ar option
373Can be used to give options in the format used in the config file.
374This is useful for specifying options for which there is no separate
375command-line flag.
376The option has the same format as a line in the configuration file.
377.It Fl p Ar port
378Port to connect to on the remote host.
379This can be specified on a
380per-host basis in the configuration file.
381.It Fl P
382Use a non-privileged port for outgoing connections.
383This can be used if your firewall does
384not permit connections from privileged ports.
385Note that this option turns off
386.Cm RhostsAuthentication
387and
388.Cm RhostsRSAAuthentication .
389.It Fl q
390Quiet mode.
391Causes all warning and diagnostic messages to be suppressed.
392Only fatal errors are displayed.
393.It Fl t
394Force pseudo-tty allocation.
395This can be used to execute arbitrary
396screen-based programs on a remote machine, which can be very useful,
397e.g., when implementing menu services.
398.It Fl v
399Verbose mode.
400Causes
401.Nm
402to print debugging messages about its progress.
403This is helpful in
404debugging connection, authentication, and configuration problems.
405The verbose mode is also used to display
406.Xr skey 1
407challenges, if the user entered "s/key" as password.
408.It Fl x
409Disables X11 forwarding.
410This can also be specified on a per-host basis in a configuration file.
411.It Fl X
412Enables X11 forwarding.
413.It Fl C
414Requests compression of all data (including stdin, stdout, stderr, and
415data for forwarded X11 and TCP/IP connections).
416The compression algorithm is the same used by
417.Xr gzip 1 ,
418and the
419.Dq level
420can be controlled by the
421.Cm CompressionLevel
422option (see below).
423Compression is desirable on modem lines and other
424slow connections, but will only slow down things on fast networks.
425The default value can be set on a host-by-host basis in the
426configuration files; see the
427.Cm Compress
428option below.
429.It Fl L Ar port:host:hostport
430Specifies that the given port on the local (client) host is to be
431forwarded to the given host and port on the remote side.
432This works by allocating a socket to listen to
433.Ar port
434on the local side, and whenever a connection is made to this port, the
435connection is forwarded over the secure channel, and a connection is
436made to
437.Ar host
438port
439.Ar hostport
440from the remote machine.
441Port forwardings can also be specified in the configuration file.
442Only root can forward privileged ports.
443IPv6 addresses can be specified with an alternative syntax:
444.Ar port/host/hostport
445.It Fl R Ar port:host:hostport
446Specifies that the given port on the remote (server) host is to be
447forwarded to the given host and port on the local side.
448This works by allocating a socket to listen to
449.Ar port
450on the remote side, and whenever a connection is made to this port, the
451connection is forwarded over the secure channel, and a connection is
452made to
453.Ar host
454port
455.Ar hostport
456from the local machine.
457Port forwardings can also be specified in the configuration file.
458Privileged ports can be forwarded only when
459logging in as root on the remote machine.
460.It Fl 4
461Forces
462.Nm
463to use IPv4 addresses only.
464.It Fl 6
465Forces
466.Nm
467to use IPv6 addresses only.
468.El
469.Sh CONFIGURATION FILES
470.Nm
471obtains configuration data from the following sources (in this order):
472command line options, user's configuration file
473.Pq Pa $HOME/.ssh/config ,
474and system-wide configuration file
475.Pq Pa /etc/ssh/ssh_config .
476For each parameter, the first obtained value
477will be used.
478The configuration files contain sections bracketed by
479.Dq Host
480specifications, and that section is only applied for hosts that
481match one of the patterns given in the specification.
482The matched host name is the one given on the command line.
483.Pp
484Since the first obtained value for each parameter is used, more
485host-specific declarations should be given near the beginning of the
486file, and general defaults at the end.
487.Pp
488The configuration file has the following format:
489.Pp
490Empty lines and lines starting with
491.Ql #
492are comments.
493.Pp
494Otherwise a line is of the format
495.Dq keyword arguments .
496The possible
497keywords and their meanings are as follows (note that the
498configuration files are case-sensitive):
499.Bl -tag -width Ds
500.It Cm Host
501Restricts the following declarations (up to the next
502.Cm Host
503keyword) to be only for those hosts that match one of the patterns
504given after the keyword.
505.Ql \&*
506and
507.Ql ?
508can be used as wildcards in the
509patterns.
510A single
511.Ql \&*
512as a pattern can be used to provide global
513defaults for all hosts.
514The host is the
515.Ar hostname
516argument given on the command line (i.e., the name is not converted to
517a canonicalized host name before matching).
518.It Cm AFSTokenPassing
519Specifies whether to pass AFS tokens to remote host.
520The argument to this keyword must be
521.Dq yes
522or
523.Dq no .
524.It Cm BatchMode
525If set to
526.Dq yes ,
527passphrase/password querying will be disabled.
528This option is useful in scripts and other batch jobs where you have no
529user to supply the password.
530The argument must be
531.Dq yes
532or
533.Dq no .
534.It Cm CheckHostIP
535If this flag is set to
536.Dq yes ,
537ssh will additionally check the host ip address in the
538.Pa known_hosts
539file.
540This allows ssh to detect if a host key changed due to DNS spoofing.
541If the option is set to
542.Dq no ,
543the check will not be executed.
544.It Cm Cipher
545Specifies the cipher to use for encrypting the session.
546Currently,
547.Dq blowfish ,
548and
549.Dq 3des
550are supported.
551The default is
552.Dq 3des .
553.It Cm Compression
554Specifies whether to use compression.
555The argument must be
556.Dq yes
557or
558.Dq no .
559.It Cm CompressionLevel
560Specifies the compression level to use if compression is enable.
561The argument must be an integer from 1 (fast) to 9 (slow, best).
562The default level is 6, which is good for most applications.
563The meaning of the values is the same as in
564.Xr gzip 1 .
565.It Cm ConnectionAttempts
566Specifies the number of tries (one per second) to make before falling
567back to rsh or exiting.
568The argument must be an integer.
569This may be useful in scripts if the connection sometimes fails.
570.It Cm EscapeChar
571Sets the escape character (default:
572.Ql ~ ) .
573The escape character can also
574be set on the command line.
575The argument should be a single character,
576.Ql ^
577followed by a letter, or
578.Dq none
579to disable the escape
580character entirely (making the connection transparent for binary
581data).
582.It Cm FallBackToRsh
583Specifies that if connecting via
584.Nm
585fails due to a connection refused error (there is no
586.Xr sshd 8
587listening on the remote host),
588.Xr rsh 1
589should automatically be used instead (after a suitable warning about
590the session being unencrypted).
591The argument must be
592.Dq yes
593or
594.Dq no .
595.It Cm ForwardAgent
596Specifies whether the connection to the authentication agent (if any)
597will be forwarded to the remote machine.
598The argument must be
599.Dq yes
600or
601.Dq no .
602.It Cm ForwardX11
603Specifies whether X11 connections will be automatically redirected
604over the secure channel and
605.Ev DISPLAY
606set.
607The argument must be
608.Dq yes
609or
610.Dq no .
611The default is
612.Dq no .
613.It Cm GatewayPorts
614Specifies whether remote hosts are allowed to connect to local
615forwarded ports.
616The argument must be
617.Dq yes
618or
619.Dq no .
620The default is
621.Dq no .
622.It Cm GlobalKnownHostsFile
623Specifies a file to use instead of
624.Pa /etc/ssh/ssh_known_hosts .
625.It Cm HostName
626Specifies the real host name to log into.
627This can be used to specify nicknames or abbreviations for hosts.
628Default is the name given on the command line.
629Numeric IP addresses are also permitted (both on the command line and in
630.Cm HostName
631specifications).
632.It Cm IdentityFile
633Specifies the file from which the user's RSA authentication identity
634is read (default
635.Pa .ssh/identity
636in the user's home directory).
637Additionally, any identities represented by the authentication agent
638will be used for authentication.
639The file name may use the tilde
640syntax to refer to a user's home directory.
641It is possible to have
642multiple identity files specified in configuration files; all these
643identities will be tried in sequence.
644.It Cm KeepAlive
645Specifies whether the system should send keepalive messages to the
646other side.
647If they are sent, death of the connection or crash of one
648of the machines will be properly noticed.
649However, this means that
650connections will die if the route is down temporarily, and some people
651find it annoying.
652.Pp
653The default is
654.Dq yes
655(to send keepalives), and the client will notice
656if the network goes down or the remote host dies.
657This is important in scripts, and many users want it too.
658.Pp
659To disable keepalives, the value should be set to
660.Dq no
661in both the server and the client configuration files.
662.It Cm KerberosAuthentication
663Specifies whether Kerberos authentication will be used.
664The argument to this keyword must be
665.Dq yes
666or
667.Dq no .
668.It Cm KerberosTgtPassing
669Specifies whether a Kerberos TGT will be forwarded to the server.
670This will only work if the Kerberos server is actually an AFS kaserver.
671The argument to this keyword must be
672.Dq yes
673or
674.Dq no .
675.It Cm LocalForward
676Specifies that a TCP/IP port on the local machine be forwarded over
677the secure channel to given host:port from the remote machine.
678The first argument must be a port number, and the second must be
679host:port.
680Multiple forwardings may be specified, and additional
681forwardings can be given on the command line.
682Only the superuser can forward privileged ports.
683.It Cm LogLevel
684Gives the verbosity level that is used when logging messages from
685.Nm ssh .
686The possible values are:
687QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
688The default is INFO.
689.It Cm NumberOfPasswordPrompts
690Specifies the number of password prompts before giving up.
691The argument to this keyword must be an integer.
692Default is 3.
693.It Cm PasswordAuthentication
694Specifies whether to use password authentication.
695The argument to this keyword must be
696.Dq yes
697or
698.Dq no .
699.It Cm Port
700Specifies the port number to connect on the remote host.
701Default is 22.
702.It Cm ProxyCommand
703Specifies the command to use to connect to the server.
704The command
705string extends to the end of the line, and is executed with
706.Pa /bin/sh .
707In the command string,
708.Ql %h
709will be substituted by the host name to
710connect and
711.Ql %p
712by the port.
713The command can be basically anything,
714and should read from its standard input and write to its standard output.
715It should eventually connect an
716.Xr sshd 8
717server running on some machine, or execute
718.Ic sshd -i
719somewhere.
720Host key management will be done using the
721HostName of the host being connected (defaulting to the name typed by
722the user).
723Note that
724.Cm CheckHostIP
725is not available for connects with a proxy command.
726.Pp
727.It Cm RemoteForward
728Specifies that a TCP/IP port on the remote machine be forwarded over
729the secure channel to given host:port from the local machine.
730The first argument must be a port number, and the second must be
731host:port.
732Multiple forwardings may be specified, and additional
733forwardings can be given on the command line.
734Only the superuser can forward privileged ports.
735.It Cm RhostsAuthentication
736Specifies whether to try rhosts based authentication.
737Note that this
738declaration only affects the client side and has no effect whatsoever
739on security.
740Disabling rhosts authentication may reduce
741authentication time on slow connections when rhosts authentication is
742not used.
743Most servers do not permit RhostsAuthentication because it
744is not secure (see RhostsRSAAuthentication).
745The argument to this keyword must be
746.Dq yes
747or
748.Dq no .
749.It Cm RhostsRSAAuthentication
750Specifies whether to try rhosts based authentication with RSA host
751authentication.
752This is the primary authentication method for most sites.
753The argument must be
754.Dq yes
755or
756.Dq no .
757.It Cm RSAAuthentication
758Specifies whether to try RSA authentication.
759The argument to this keyword must be
760.Dq yes
761or
762.Dq no .
763RSA authentication will only be
764attempted if the identity file exists, or an authentication agent is
765running.
766.It Cm SkeyAuthentication
767Specifies whether to use
768.Xr skey 1
769authentication.
770The argument to this keyword must be
771.Dq yes
772or
773.Dq no .
774The default is
775.Dq no .
776.It Cm StrictHostKeyChecking
777If this flag is set to
778.Dq yes ,
779.Nm
780ssh will never automatically add host keys to the
781.Pa $HOME/.ssh/known_hosts
782file, and refuses to connect hosts whose host key has changed.
783This provides maximum protection against trojan horse attacks.
784However, it can be somewhat annoying if you don't have good
785.Pa /etc/ssh/ssh_known_hosts
786files installed and frequently
787connect new hosts.
788Basically this option forces the user to manually
789add any new hosts.
790Normally this option is disabled, and new hosts
791will automatically be added to the known host files.
792The host keys of
793known hosts will be verified automatically in either case.
794The argument must be
795.Dq yes
796or
797.Dq no .
798.It Cm UsePrivilegedPort
799Specifies whether to use a privileged port for outgoing connections.
800The argument must be
801.Dq yes
802or
803.Dq no .
804The default is
805.Dq yes .
806Note that setting this option to
807.Dq no
808turns off
809.Cm RhostsAuthentication
810and
811.Cm RhostsRSAAuthentication .
812.It Cm User
813Specifies the user to log in as.
814This can be useful if you have a different user name on different machines.
815This saves the trouble of
816having to remember to give the user name on the command line.
817.It Cm UserKnownHostsFile
818Specifies a file to use instead of
819.Pa $HOME/.ssh/known_hosts .
820.It Cm UseRsh
821Specifies that rlogin/rsh should be used for this host.
822It is possible that the host does not at all support the
823.Nm
824protocol.
825This causes
826.Nm
827to immediately execute
828.Xr rsh 1 .
829All other options (except
830.Cm HostName )
831are ignored if this has been specified.
832The argument must be
833.Dq yes
834or
835.Dq no .
836.Sh ENVIRONMENT
837.Nm
838will normally set the following environment variables:
839.Bl -tag -width Ds
840.It Ev DISPLAY
841The
842.Ev DISPLAY
843variable indicates the location of the X11 server.
844It is automatically set by
845.Nm
846to point to a value of the form
847.Dq hostname:n
848where hostname indicates
849the host where the shell runs, and n is an integer \*(>= 1.
850.Nm
851uses this special value to forward X11 connections over the secure
852channel.
853The user should normally not set DISPLAY explicitly, as that
854will render the X11 connection insecure (and will require the user to
855manually copy any required authorization cookies).
856.It Ev HOME
857Set to the path of the user's home directory.
858.It Ev LOGNAME
859Synonym for
860.Ev USER ;
861set for compatibility with systems that use this variable.
862.It Ev MAIL
863Set to point the user's mailbox.
864.It Ev PATH
865Set to the default
866.Ev PATH ,
867as specified when compiling
868.Nm ssh .
869.It Ev SSH_AUTH_SOCK
870indicates the path of a unix-domain socket used to communicate with the
871agent.
872.It Ev SSH_CLIENT
873Identifies the client end of the connection.
874The variable contains
875three space-separated values: client ip-address, client port number,
876and server port number.
877.It Ev SSH_TTY
878This is set to the name of the tty (path to the device) associated
879with the current shell or command.
880If the current session has no tty,
881this variable is not set.
882.It Ev TZ
883The timezone variable is set to indicate the present timezone if it
884was set when the daemon was started (e.i., the daemon passes the value
885on to new connections).
886.It Ev USER
887Set to the name of the user logging in.
888.El
889.Pp
890Additionally,
891.Nm
892reads
893.Pa $HOME/.ssh/environment ,
894and adds lines of the format
895.Dq VARNAME=value
896to the environment.
897.Sh FILES
898.Bl -tag -width Ds
899.It Pa $HOME/.ssh/known_hosts
900Records host keys for all hosts the user has logged into (that are not
901in
902.Pa /etc/ssh/ssh_known_hosts ) .
903See
904.Xr sshd 8 .
905.It Pa $HOME/.ssh/identity
906Contains the RSA authentication identity of the user.
907This file
908contains sensitive data and should be readable by the user but not
909accessible by others (read/write/execute).
910Note that
911.Nm
912ignores this file if it is accessible by others.
913It is possible to specify a passphrase when
914generating the key; the passphrase will be used to encrypt the
915sensitive part of this file using 3DES.
916.It Pa $HOME/.ssh/identity.pub
917Contains the public key for authentication (public part of the
918identity file in human-readable form).
919The contents of this file should be added to
920.Pa $HOME/.ssh/authorized_keys
921on all machines
922where you wish to log in using RSA authentication.
923This file is not
924sensitive and can (but need not) be readable by anyone.
925This file is
926never used automatically and is not necessary; it is only provided for
927the convenience of the user.
928.It Pa $HOME/.ssh/config
929This is the per-user configuration file.
930The format of this file is described above.
931This file is used by the
932.Nm
933client.
934This file does not usually contain any sensitive information,
935but the recommended permissions are read/write for the user, and not
936accessible by others.
937.It Pa $HOME/.ssh/authorized_keys
938Lists the RSA keys that can be used for logging in as this user.
939The format of this file is described in the
940.Xr sshd 8
941manual page.
942In the simplest form the format is the same as the .pub
943identity files (that is, each line contains the number of bits in
944modulus, public exponent, modulus, and comment fields, separated by
945spaces).
946This file is not highly sensitive, but the recommended
947permissions are read/write for the user, and not accessible by others.
948.It Pa /etc/ssh/ssh_known_hosts
949Systemwide list of known host keys.
950This file should be prepared by the
951system administrator to contain the public host keys of all machines in the
952organization.
953This file should be world-readable.
954This file contains
955public keys, one per line, in the following format (fields separated
956by spaces): system name, number of bits in modulus, public exponent,
957modulus, and optional comment field.
958When different names are used
959for the same machine, all such names should be listed, separated by
960commas.
961The format is described on the
962.Xr sshd 8
963manual page.
964.Pp
965The canonical system name (as returned by name servers) is used by
966.Xr sshd 8
967to verify the client host when logging in; other names are needed because
968.Nm
969does not convert the user-supplied name to a canonical name before
970checking the key, because someone with access to the name servers
971would then be able to fool host authentication.
972.It Pa /etc/ssh/ssh_config
973Systemwide configuration file.
974This file provides defaults for those
975values that are not specified in the user's configuration file, and
976for those users who do not have a configuration file.
977This file must be world-readable.
978.It Pa $HOME/.rhosts
979This file is used in
980.Pa \&.rhosts
981authentication to list the
982host/user pairs that are permitted to log in.
983(Note that this file is
984also used by rlogin and rsh, which makes using this file insecure.)
985Each line of the file contains a host name (in the canonical form
986returned by name servers), and then a user name on that host,
987separated by a space.
988One some machines this file may need to be
989world-readable if the user's home directory is on a NFS partition,
990because
991.Xr sshd 8
992reads it as root.
993Additionally, this file must be owned by the user,
994and must not have write permissions for anyone else.
995The recommended
996permission for most machines is read/write for the user, and not
997accessible by others.
998.Pp
999Note that by default
1000.Xr sshd 8
1001will be installed so that it requires successful RSA host
1002authentication before permitting \s+2.\s0rhosts authentication.
1003If your server machine does not have the client's host key in
1004.Pa /etc/ssh/ssh_known_hosts ,
1005you can store it in
1006.Pa $HOME/.ssh/known_hosts .
1007The easiest way to do this is to
1008connect back to the client from the server machine using ssh; this
1009will automatically add the host key inxi
1010.Pa $HOME/.ssh/known_hosts .
1011.It Pa $HOME/.shosts
1012This file is used exactly the same way as
1013.Pa \&.rhosts .
1014The purpose for
1015having this file is to be able to use rhosts authentication with
1016.Nm
1017without permitting login with
1018.Xr rlogin 1
1019or
1020.Xr rsh 1 .
1021.It Pa /etc/hosts.equiv
1022This file is used during
1023.Pa \&.rhosts
1024authentication.
1025It contains
1026canonical hosts names, one per line (the full format is described on
1027the
1028.Xr sshd 8
1029manual page).
1030If the client host is found in this file, login is
1031automatically permitted provided client and server user names are the
1032same.
1033Additionally, successful RSA host authentication is normally
1034required.
1035This file should only be writable by root.
1036.It Pa /etc/ssh/shosts.equiv
1037This file is processed exactly as
1038.Pa /etc/hosts.equiv .
1039This file may be useful to permit logins using
1040.Nm
1041but not using rsh/rlogin.
1042.It Pa /etc/ssh/sshrc
1043Commands in this file are executed by
1044.Nm
1045when the user logs in just before the user's shell (or command) is started.
1046See the
1047.Xr sshd 8
1048manual page for more information.
1049.It Pa $HOME/.ssh/rc
1050Commands in this file are executed by
1051.Nm
1052when the user logs in just before the user's shell (or command) is
1053started.
1054See the
1055.Xr sshd 8
1056manual page for more information.
1057.It Pa $HOME/.ssh/environment
1058Contains additional definitions for environment variables, see section
1059.Sx ENVIRONMENT
1060above.
1061.It Pa libcrypto.so.X.1
1062A version of this library which includes support for the RSA algorithm
1063is required for proper operation.
1064.Sh AUTHOR
1065OpenSSH
1066is a derivative of the original (free) ssh 1.2.12 release by Tatu Ylonen,
1067but with bugs removed and newer features re-added.
1068Rapidly after the
10691.2.12 release, newer versions of the original ssh bore successively
1070more restrictive licenses, and thus demand for a free version was born.
1071This version of OpenSSH
1072.Bl -bullet
1073.It
1074has all components of a restrictive nature (i.e., patents, see
1075.Xr ssl 8 )
1076directly removed from the source code; any licensed or patented components
1077are chosen from
1078external libraries.
1079.It
1080has been updated to support ssh protocol 1.5, making it compatible with
1081all other ssh protocol 1 clients and servers.
1082.It
1083contains added support for
1084.Xr kerberos 8
1085authentication and ticket passing.
1086.It
1087supports one-time password authentication with
1088.Xr skey 1 .
1089.El
1090.Pp
1091The libraries described in
1092.Xr ssl 8
1093are required for proper operation.
1094.Pp
1095OpenSSH has been created by Aaron Campbell, Bob Beck, Markus Friedl,
1096Niels Provos, Theo de Raadt, and Dug Song.
1097.Sh SEE ALSO
1098.Xr rlogin 1 ,
1099.Xr rsh 1 ,
1100.Xr scp 1 ,
1101.Xr ssh-add 1 ,
1102.Xr ssh-agent 1 ,
1103.Xr ssh-keygen 1 ,
1104.Xr telnet 1 ,
1105.Xr sshd 8 ,
1106.Xr ssl 8
1107