xref: /freebsd/crypto/openssh/sshd.8 (revision 23f282aa31e9b6fceacd449020e936e98d6f2298)
1.\"  -*- nroff -*-
2.\"
3.\" sshd.8.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: sshd.8,v 1.37 2000/03/24 03:04:46 brad Exp $
13.\" $FreeBSD$
14.\"
15.Dd September 25, 1999
16.Dt SSHD 8
17.Os
18.Sh NAME
19.Nm sshd
20.Nd secure shell daemon
21.Sh SYNOPSIS
22.Nm sshd
23.Op Fl diqQ46
24.Op Fl b Ar bits
25.Op Fl f Ar config_file
26.Op Fl g Ar login_grace_time
27.Op Fl h Ar host_key_file
28.Op Fl k Ar key_gen_time
29.Op Fl p Ar port
30.Op Fl V Ar client_protocol_id
31.Sh DESCRIPTION
32.Nm
33(Secure Shell Daemon) is the daemon program for
34.Xr ssh 1 .
35Together these programs replace rlogin and rsh programs, and
36provide secure encrypted communications between two untrusted hosts
37over an insecure network.
38The programs are intended to be as easy to
39install and use as possible.
40.Pp
41.Nm
42is the daemon that listens for connections from clients.
43It is normally started at boot from
44.Pa /etc/rc.network .
45It forks a new
46daemon for each incoming connection.
47The forked daemons handle
48key exchange, encryption, authentication, command execution,
49and data exchange.
50.Pp
51.Nm
52works as follows.
53Each host has a host-specific RSA key
54(normally 1024 bits) used to identify the host.
55Additionally, when
56the daemon starts, it generates a server RSA key (normally 768 bits).
57This key is normally regenerated every hour if it has been used, and
58is never stored on disk.
59.Pp
60Whenever a client connects the daemon, the daemon sends its host
61and server public keys to the client.
62The client compares the
63host key against its own database to verify that it has not changed.
64The client then generates a 256 bit random number.
65It encrypts this
66random number using both the host key and the server key, and sends
67the encrypted number to the server.
68Both sides then start to use this
69random number as a session key which is used to encrypt all further
70communications in the session.
71The rest of the session is encrypted
72using a conventional cipher, currently Blowfish and 3DES, with 3DES
73being is used by default.
74The client selects the encryption algorithm
75to use from those offered by the server.
76.Pp
77Next, the server and the client enter an authentication dialog.
78The client tries to authenticate itself using
79.Pa .rhosts
80authentication,
81.Pa .rhosts
82authentication combined with RSA host
83authentication, RSA challenge-response authentication, or password
84based authentication.
85.Pp
86Rhosts authentication is normally disabled
87because it is fundamentally insecure, but can be enabled in the server
88configuration file if desired.
89System security is not improved unless
90.Xr rshd 8 ,
91.Xr rlogind 8 ,
92.Xr rexecd 8 ,
93and
94.Xr rexd 8
95are disabled (thus completely disabling
96.Xr rlogin 1
97and
98.Xr rsh 1
99into that machine).
100.Pp
101If the client successfully authenticates itself, a dialog for
102preparing the session is entered.
103At this time the client may request
104things like allocating a pseudo-tty, forwarding X11 connections,
105forwarding TCP/IP connections, or forwarding the authentication agent
106connection over the secure channel.
107.Pp
108Finally, the client either requests a shell or execution of a command.
109The sides then enter session mode.
110In this mode, either side may send
111data at any time, and such data is forwarded to/from the shell or
112command on the server side, and the user terminal in the client side.
113.Pp
114When the user program terminates and all forwarded X11 and other
115connections have been closed, the server sends command exit status to
116the client, and both sides exit.
117.Pp
118.Nm
119can be configured using command-line options or a configuration
120file.
121Command-line options override values specified in the
122configuration file.
123.Pp
124.Nm
125rereads its configuration file when it receives a hangup signal,
126.Dv SIGHUP .
127.Pp
128The options are as follows:
129.Bl -tag -width Ds
130.It Fl b Ar bits
131Specifies the number of bits in the server key (default 768).
132.Pp
133.It Fl d
134Debug mode.
135The server sends verbose debug output to the system
136log, and does not put itself in the background.
137The server also will not fork and will only process one connection.
138This option is only intended for debugging for the server.
139.It Fl f Ar configuration_file
140Specifies the name of the configuration file.
141The default is
142.Pa /etc/ssh/sshd_config .
143.Nm
144refuses to start if there is no configuration file.
145.It Fl g Ar login_grace_time
146Gives the grace time for clients to authenticate themselves (default
147300 seconds).
148If the client fails to authenticate the user within
149this many seconds, the server disconnects and exits.
150A value of zero indicates no limit.
151.It Fl h Ar host_key_file
152Specifies the file from which the host key is read (default
153.Pa /etc/ssh/ssh_host_key ) .
154This option must be given if
155.Nm
156is not run as root (as the normal
157host file is normally not readable by anyone but root).
158.It Fl i
159Specifies that
160.Nm
161is being run from inetd.
162.Nm
163is normally not run
164from inetd because it needs to generate the server key before it can
165respond to the client, and this may take tens of seconds.
166Clients would have to wait too long if the key was regenerated every time.
167However, with small key sizes (e.g., 512) using
168.Nm
169from inetd may
170be feasible.
171.It Fl k Ar key_gen_time
172Specifies how often the server key is regenerated (default 3600
173seconds, or one hour).
174The motivation for regenerating the key fairly
175often is that the key is not stored anywhere, and after about an hour,
176it becomes impossible to recover the key for decrypting intercepted
177communications even if the machine is cracked into or physically
178seized.
179A value of zero indicates that the key will never be regenerated.
180.It Fl p Ar port
181Specifies the port on which the server listens for connections
182(default 22).
183.It Fl q
184Quiet mode.
185Nothing is sent to the system log.
186Normally the beginning,
187authentication, and termination of each connection is logged.
188.It Fl Q
189Do not print an error message if RSA support is missing.
190.It Fl V Ar client_protocol_id
191SSH2 compatibility mode.
192When this options is specified
193.Nm
194assumes the client has sent the given version string
195and skips the
196Protocol Version Identification Exchange.
197.It Fl 4
198Forces
199.Nm
200to use IPv4 addresses only.
201.It Fl 6
202Forces
203.Nm
204to use IPv6 addresses only.
205.El
206.Sh CONFIGURATION FILE
207.Nm
208reads configuration data from
209.Pa /etc/ssh/sshd_config
210(or the file specified with
211.Fl f
212on the command line).
213The file contains keyword-value pairs, one per line.
214Lines starting with
215.Ql #
216and empty lines are interpreted as comments.
217.Pp
218The following keywords are possible.
219.Bl -tag -width Ds
220.It Cm AFSTokenPassing
221Specifies whether an AFS token may be forwarded to the server.
222Default is
223.Dq yes .
224.It Cm AllowGroups
225This keyword can be followed by a number of group names, separated
226by spaces.
227If specified, login is allowed only for users whose primary
228group matches one of the patterns.
229.Ql \&*
230and
231.Ql ?
232can be used as
233wildcards in the patterns.
234Only group names are valid, a numerical group ID isn't recognized.
235By default login is allowed regardless of the primary group.
236.Pp
237.It Cm AllowUsers
238This keyword can be followed by a number of user names, separated
239by spaces.
240If specified, login is allowed only for users names that
241match one of the patterns.
242.Ql \&*
243and
244.Ql ?
245can be used as
246wildcards in the patterns.
247Only user names are valid, a numerical user ID isn't recognized.
248By default login is allowed regardless of the user name.
249.Pp
250.It Cm CheckMail
251Specifies whether
252.Nm
253should check for new mail for interactive logins.
254The default is
255.Dq no .
256.It Cm ConnectionsPerPeriod
257This keyword allows for rate-limiting of connections, and
258is followed by two numbers in the format
259.Dq n/s ,
260where
261.Ar n
262is the number of connections from a certain address group
263accepted per period of
264.Ar s
265seconds.  Any connection after the number
266.Ar n
267connection in the period of
268.Ar s
269seconds will be dropped, and an informational message will be logged.
270A connection will belong to a certain group, of which there are 13
271by default, according to its IP address.
272The default for this keyword is
273.Dq 0/0 ,
274and rate-limiting can be explicitly turned off by using an
275.Ar n
276parameter of
277.Ql 0
278and any
279.Ar s
280parameter.
281.It Cm DenyGroups
282This keyword can be followed by a number of group names, separated
283by spaces.
284Users whose primary group matches one of the patterns
285aren't allowed to log in.
286.Ql \&*
287and
288.Ql ?
289can be used as
290wildcards in the patterns.
291Only group names are valid, a numerical group ID isn't recognized.
292By default login is allowed regardless of the primary group.
293.Pp
294.It Cm DenyUsers
295This keyword can be followed by a number of user names, separated
296by spaces.
297Login is disallowed for user names that match one of the patterns.
298.Ql \&*
299and
300.Ql ?
301can be used as wildcards in the patterns.
302Only user names are valid, a numerical user ID isn't recognized.
303By default login is allowed regardless of the user name.
304.It Cm HostKey
305Specifies the file containing the private host key (default
306.Pa /etc/ssh/ssh_host_key ) .
307Note that
308.Nm
309does not start if this file is group/world-accessible.
310.It Cm IgnoreRhosts
311Specifies that
312.Pa .rhosts
313and
314.Pa .shosts
315files will not be used in authentication.
316.Pa /etc/hosts.equiv
317and
318.Pa /etc/ssh/shosts.equiv
319.Pa /etc/shosts.equiv
320are still used.
321The default is
322.Dq yes .
323.It Cm IgnoreUserKnownHosts
324Specifies whether
325.Nm
326should ignore the user's
327.Pa $HOME/.ssh/known_hosts
328during
329.Cm RhostsRSAAuthentication .
330The default is
331.Dq no .
332.It Cm KeepAlive
333Specifies whether the system should send keepalive messages to the
334other side.
335If they are sent, death of the connection or crash of one
336of the machines will be properly noticed.
337However, this means that
338connections will die if the route is down temporarily, and some people
339find it annoying.
340On the other hand, if keepalives are not send,
341sessions may hang indefinitely on the server, leaving
342.Dq ghost
343users and consuming server resources.
344.Pp
345The default is
346.Dq yes
347(to send keepalives), and the server will notice
348if the network goes down or the client host reboots.
349This avoids infinitely hanging sessions.
350.Pp
351To disable keepalives, the value should be set to
352.Dq no
353in both the server and the client configuration files.
354.It Cm KerberosAuthentication
355Specifies whether Kerberos authentication is allowed.
356This can be in the form of a Kerberos ticket, or if
357.Cm PasswordAuthentication
358is yes, the password provided by the user will be validated through
359the Kerberos KDC.
360Default is
361.Dq yes .
362.It Cm KerberosOrLocalPasswd
363If set then if password authentication through Kerberos fails then
364the password will be validated via any additional local mechanism
365such as
366.Pa /etc/passwd
367or SecurID.
368Default is
369.Dq yes .
370.It Cm KerberosTgtPassing
371Specifies whether a Kerberos TGT may be forwarded to the server.
372Default is
373.Dq no ,
374as this only works when the Kerberos KDC is actually an AFS kaserver.
375.It Cm KerberosTicketCleanup
376Specifies whether to automatically destroy the user's ticket cache
377file on logout.
378Default is
379.Dq yes .
380.It Cm KeyRegenerationInterval
381The server key is automatically regenerated after this many seconds
382(if it has been used).
383The purpose of regeneration is to prevent
384decrypting captured sessions by later breaking into the machine and
385stealing the keys.
386The key is never stored anywhere.
387If the value is 0, the key is never regenerated.
388The default is 3600 (seconds).
389.It Cm ListenAddress
390Specifies what local address
391.Nm
392should listen on.
393The default is to listen to all local addresses.
394Multiple options of this type are permitted.
395Additionally, the
396.Cm Ports
397options must precede this option.
398.It Cm LoginGraceTime
399The server disconnects after this time if the user has not
400successfully logged in.
401If the value is 0, there is no time limit.
402The default is 600 (seconds).
403.It Cm LogLevel
404Gives the verbosity level that is used when logging messages from
405.Nm sshd .
406The possible values are:
407QUIET, FATAL, ERROR, INFO, VERBOSE and DEBUG.
408The default is INFO.
409Logging with level DEBUG violates the privacy of users
410and is not recommended.
411.It Cm PasswordAuthentication
412Specifies whether password authentication is allowed.
413The default is
414.Dq yes .
415.It Cm PermitEmptyPasswords
416When password authentication is allowed, it specifies whether the
417server allows login to accounts with empty password strings.
418The default is
419.Dq no .
420.It Cm PermitRootLogin
421Specifies whether the root can log in using
422.Xr ssh 1 .
423The argument must be
424.Dq yes ,
425.Dq without-password
426or
427.Dq no .
428The default is
429.Dq yes .
430If this options is set to
431.Dq without-password
432only password authentication is disabled for root.
433.Pp
434Root login with RSA authentication when the
435.Ar command
436option has been
437specified will be allowed regardless of the value of this setting
438(which may be useful for taking remote backups even if root login is
439normally not allowed).
440.It Cm Port
441Specifies the port number that
442.Nm
443listens on.
444The default is 22.
445Multiple options of this type are permitted.
446.It Cm PrintMotd
447Specifies whether
448.Nm
449should print
450.Pa /etc/motd
451when a user logs in interactively.
452(On some systems it is also printed by the shell,
453.Pa /etc/profile ,
454or equivalent.)
455The default is
456.Dq yes .
457.It Cm RandomSeed
458Obsolete - accepted and ignored with a warning.
459Random number generation uses other techniques.
460.It Cm RhostsAuthentication
461Specifies whether authentication using rhosts or
462.Pa /etc/hosts.equiv
463files is sufficient.
464Normally, this method should not be permitted because it is insecure.
465.Cm RhostsRSAAuthentication
466should be used
467instead, because it performs RSA-based host authentication in addition
468to normal rhosts or
469.Pa /etc/hosts.equiv
470authentication.
471The default is
472.Dq no .
473.It Cm RhostsRSAAuthentication
474Specifies whether rhosts or
475.Pa /etc/hosts.equiv
476authentication together
477with successful RSA host authentication is allowed.
478The default is
479.Dq no .
480.It Cm RSAAuthentication
481Specifies whether pure RSA authentication is allowed.
482The default is
483.Dq yes .
484.It Cm ServerKeyBits
485Defines the number of bits in the server key.
486The minimum value is 512, and the default is 768.
487.It Cm SkeyAuthentication
488Specifies whether
489.Xr skey 1
490authentication is allowed.
491The default is
492.Dq yes .
493Note that OPIE authentication is enabled only if
494.Cm PasswordAuthentication
495is allowed, too.
496.It Cm StrictModes
497Specifies whether
498.Nm
499should check file modes and ownership of the
500user's files and home directory before accepting login.
501This is normally desirable because novices sometimes accidentally leave their
502directory or files world-writable.
503The default is
504.Dq yes .
505.It Cm SyslogFacility
506Gives the facility code that is used when logging messages from
507.Nm sshd .
508The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
509LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
510The default is AUTH.
511.It Cm UseLogin
512Specifies whether
513.Xr login 1
514is used.
515The default is
516.Dq no .
517.It Cm X11DisplayOffset
518Specifies the first display number available for
519.Nm sshd Ns 's
520X11 forwarding.
521This prevents
522.Nm
523from interfering with real X11 servers.
524The default is 10.
525.It Cm X11Forwarding
526Specifies whether X11 forwarding is permitted.
527The default is
528.Dq no .
529Note that disabling X11 forwarding does not improve security in any
530way, as users can always install their own forwarders.
531.El
532.Sh LOGIN PROCESS
533When a user successfully logs in,
534.Nm
535does the following:
536.Bl -enum -offset indent
537.It
538If the login is on a tty, and no command has been specified,
539prints last login time and
540.Pa /etc/motd
541(unless prevented in the configuration file or by
542.Pa $HOME/.hushlogin ;
543see the
544.Sx FILES
545section).
546.It
547If the login is on a tty, records login time.
548.It
549Checks
550.Pa /etc/nologin and
551.Pa /var/run/nologin ;
552if one exists, it prints the contents and quits
553(unless root).
554.It
555Changes to run with normal user privileges.
556.It
557Sets up basic environment.
558.It
559Reads
560.Pa $HOME/.ssh/environment
561if it exists.
562.It
563Changes to user's home directory.
564.It
565If
566.Pa $HOME/.ssh/rc
567exists, runs it; else if
568.Pa /etc/ssh/sshrc
569exists, runs
570it; otherwise runs
571.Xr xauth 1 .
572The
573.Dq rc
574files are given the X11
575authentication protocol and cookie (if applicable) in standard input.
576.It
577Runs user's shell or command.
578.El
579.Sh AUTHORIZED_KEYS FILE FORMAT
580The
581.Pa $HOME/.ssh/authorized_keys
582file lists the RSA keys that are
583permitted for RSA authentication.
584Each line of the file contains one
585key (empty lines and lines starting with a
586.Ql #
587are ignored as
588comments).
589Each line consists of the following fields, separated by
590spaces: options, bits, exponent, modulus, comment.
591The options field
592is optional; its presence is determined by whether the line starts
593with a number or not (the option field never starts with a number).
594The bits, exponent, modulus and comment fields give the RSA key; the
595comment field is not used for anything (but may be convenient for the
596user to identify the key).
597.Pp
598Note that lines in this file are usually several hundred bytes long
599(because of the size of the RSA key modulus).
600You don't want to type them in; instead, copy the
601.Pa identity.pub
602file and edit it.
603.Pp
604The options (if present) consists of comma-separated option
605specifications.
606No spaces are permitted, except within double quotes.
607The following option specifications are supported:
608.Bl -tag -width Ds
609.It Cm from="pattern-list"
610Specifies that in addition to RSA authentication, the canonical name
611of the remote host must be present in the comma-separated list of
612patterns
613.Pf ( Ql *
614and
615.Ql ?
616serve as wildcards).
617The list may also contain
618patterns negated by prefixing them with
619.Ql ! ;
620if the canonical host name matches a negated pattern, the key is not accepted.
621The purpose
622of this option is to optionally increase security: RSA authentication
623by itself does not trust the network or name servers or anything (but
624the key); however, if somebody somehow steals the key, the key
625permits an intruder to log in from anywhere in the world.
626This additional option makes using a stolen key more difficult (name
627servers and/or routers would have to be compromised in addition to
628just the key).
629.It Cm command="command"
630Specifies that the command is executed whenever this key is used for
631authentication.
632The command supplied by the user (if any) is ignored.
633The command is run on a pty if the connection requests a pty;
634otherwise it is run without a tty.
635A quote may be included in the command by quoting it with a backslash.
636This option might be useful
637to restrict certain RSA keys to perform just a specific operation.
638An example might be a key that permits remote backups but nothing else.
639Notice that the client may specify TCP/IP and/or X11
640forwardings unless they are explicitly prohibited.
641.It Cm environment="NAME=value"
642Specifies that the string is to be added to the environment when
643logging in using this key.
644Environment variables set this way
645override other default environment values.
646Multiple options of this type are permitted.
647.It Cm no-port-forwarding
648Forbids TCP/IP forwarding when this key is used for authentication.
649Any port forward requests by the client will return an error.
650This might be used, e.g., in connection with the
651.Cm command
652option.
653.It Cm no-X11-forwarding
654Forbids X11 forwarding when this key is used for authentication.
655Any X11 forward requests by the client will return an error.
656.It Cm no-agent-forwarding
657Forbids authentication agent forwarding when this key is used for
658authentication.
659.It Cm no-pty
660Prevents tty allocation (a request to allocate a pty will fail).
661.El
662.Ss Examples
663.Bd -literal
6641024 33 12121...312314325 ylo@foo.bar
665from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23...2334 ylo@niksula
666command="dump /home",no-pty,no-port-forwarding 1024 33 23...2323 backup.hut.fi
667.Ed
668.Sh SSH_KNOWN_HOSTS FILE FORMAT
669The
670.Pa /etc/ssh/ssh_known_hosts
671and
672.Pa $HOME/.ssh/known_hosts
673files contain host public keys for all known hosts.
674The global file should
675be prepared by the administrator (optional), and the per-user file is
676maintained automatically: whenever the user connects an unknown host
677its key is added to the per-user file.
678.Pp
679Each line in these files contains the following fields: hostnames,
680bits, exponent, modulus, comment.
681The fields are separated by spaces.
682.Pp
683Hostnames is a comma-separated list of patterns ('*' and '?' act as
684wildcards); each pattern in turn is matched against the canonical host
685name (when authenticating a client) or against the user-supplied
686name (when authenticating a server).
687A pattern may also be preceded by
688.Ql !
689to indicate negation: if the host name matches a negated
690pattern, it is not accepted (by that line) even if it matched another
691pattern on the line.
692.Pp
693Bits, exponent, and modulus are taken directly from the host key; they
694can be obtained, e.g., from
695.Pa /etc/ssh/ssh_host_key.pub .
696The optional comment field continues to the end of the line, and is not used.
697.Pp
698Lines starting with
699.Ql #
700and empty lines are ignored as comments.
701.Pp
702When performing host authentication, authentication is accepted if any
703matching line has the proper key.
704It is thus permissible (but not
705recommended) to have several lines or different host keys for the same
706names.
707This will inevitably happen when short forms of host names
708from different domains are put in the file.
709It is possible
710that the files contain conflicting information; authentication is
711accepted if valid information can be found from either file.
712.Pp
713Note that the lines in these files are typically hundreds of characters
714long, and you definitely don't want to type in the host keys by hand.
715Rather, generate them by a script
716or by taking
717.Pa /etc/ssh/ssh_host_key.pub
718and adding the host names at the front.
719.Ss Examples
720.Bd -literal
721closenet,closenet.hut.fi,...,130.233.208.41 1024 37 159...93 closenet.hut.fi
722.Ed
723.Sh FILES
724.Bl -tag -width Ds
725.It Pa /etc/ssh/sshd_config
726Contains configuration data for
727.Nm sshd .
728This file should be writable by root only, but it is recommended
729(though not necessary) that it be world-readable.
730.It Pa /etc/ssh/ssh_host_key
731Contains the private part of the host key.
732This file should only be owned by root, readable only by root, and not
733accessible to others.
734Note that
735.Nm
736does not start if this file is group/world-accessible.
737.It Pa /etc/ssh/ssh_host_key.pub
738Contains the public part of the host key.
739This file should be world-readable but writable only by
740root.
741Its contents should match the private part.
742This file is not
743really used for anything; it is only provided for the convenience of
744the user so its contents can be copied to known hosts files.
745These two files are created using
746.Xr ssh-keygen 1 .
747.It Pa /var/run/sshd.pid
748Contains the process ID of the
749.Nm
750listening for connections (if there are several daemons running
751concurrently for different ports, this contains the pid of the one
752started last).
753The contents of this file are not sensitive; it can be world-readable.
754.It Pa $HOME/.ssh/authorized_keys
755Lists the RSA keys that can be used to log into the user's account.
756This file must be readable by root (which may on some machines imply
757it being world-readable if the user's home directory resides on an NFS
758volume).
759It is recommended that it not be accessible by others.
760The format of this file is described above.
761.It Pa "/etc/ssh/ssh_known_hosts" and "$HOME/.ssh/known_hosts"
762These files are consulted when using rhosts with RSA host
763authentication to check the public key of the host.
764The key must be listed in one of these files to be accepted.
765The client uses the same files
766to verify that the remote host is the one we intended to connect.
767These files should be writable only by root/the owner.
768.Pa /etc/ssh/ssh_known_hosts
769should be world-readable, and
770.Pa $HOME/.ssh/known_hosts
771can but need not be world-readable.
772.It Pa /etc/nologin
773If this file exists,
774.Nm
775refuses to let anyone except root log in.
776The contents of the file
777are displayed to anyone trying to log in, and non-root connections are
778refused.
779The file should be world-readable.
780.It Pa /etc/hosts.allow
781If compiled with
782.Sy LIBWRAP
783support, tcp-wrappers access controls may be defined here as described in
784.Xr hosts_access 5 .
785.It Pa $HOME/.rhosts
786This file contains host-username pairs, separated by a space, one per
787line.
788The given user on the corresponding host is permitted to log in
789without password.
790The same file is used by rlogind and rshd.
791The file must
792be writable only by the user; it is recommended that it not be
793accessible by others.
794.Pp
795If is also possible to use netgroups in the file.
796Either host or user
797name may be of the form +@groupname to specify all hosts or all users
798in the group.
799.It Pa $HOME/.shosts
800For ssh,
801this file is exactly the same as for
802.Pa .rhosts .
803However, this file is
804not used by rlogin and rshd, so using this permits access using SSH only.
805.It Pa /etc/hosts.equiv
806This file is used during
807.Pa .rhosts
808authentication.
809In the simplest form, this file contains host names, one per line.
810Users on
811those hosts are permitted to log in without a password, provided they
812have the same user name on both machines.
813The host name may also be
814followed by a user name; such users are permitted to log in as
815.Em any
816user on this machine (except root).
817Additionally, the syntax
818.Dq +@group
819can be used to specify netgroups.
820Negated entries start with
821.Ql \&- .
822.Pp
823If the client host/user is successfully matched in this file, login is
824automatically permitted provided the client and server user names are the
825same.
826Additionally, successful RSA host authentication is normally required.
827This file must be writable only by root; it is recommended
828that it be world-readable.
829.Pp
830.Sy "Warning: It is almost never a good idea to use user names in"
831.Pa hosts.equiv .
832Beware that it really means that the named user(s) can log in as
833.Em anybody ,
834which includes bin, daemon, adm, and other accounts that own critical
835binaries and directories.
836Using a user name practically grants the user root access.
837The only valid use for user names that I can think
838of is in negative entries.
839.Pp
840Note that this warning also applies to rsh/rlogin.
841.It Pa /etc/ssh/shosts.equiv
842This is processed exactly as
843.Pa /etc/hosts.equiv .
844However, this file may be useful in environments that want to run both
845rsh/rlogin and ssh.
846.It Pa $HOME/.ssh/environment
847This file is read into the environment at login (if it exists).
848It can only contain empty lines, comment lines (that start with
849.Ql # ) ,
850and assignment lines of the form name=value.
851The file should be writable
852only by the user; it need not be readable by anyone else.
853.It Pa $HOME/.ssh/rc
854If this file exists, it is run with
855.Pa /bin/sh
856after reading the
857environment files but before starting the user's shell or command.
858If X11 spoofing is in use, this will receive the "proto cookie" pair in
859standard input (and
860.Ev DISPLAY
861in environment).
862This must call
863.Xr xauth 1
864in that case.
865.Pp
866The primary purpose of this file is to run any initialization routines
867which may be needed before the user's home directory becomes
868accessible; AFS is a particular example of such an environment.
869.Pp
870This file will probably contain some initialization code followed by
871something similar to:
872.Bd -literal -offset indent
873if [ -n "$DISPLAY" ] && read proto cookie; then
874    echo add $DISPLAY $proto $cookie | xauth -q -
875fi
876.Ed
877.Pp
878If this file does not exist,
879.Pa /etc/ssh/sshrc
880is run, and if that
881does not exist either,
882.Xr xauth 1
883is used to store the cookie.
884.Pp
885This file should be writable only by the user, and need not be
886readable by anyone else.
887.It Pa /etc/ssh/sshrc
888Like
889.Pa $HOME/.ssh/rc .
890This can be used to specify
891machine-specific login-time initializations globally.
892This file should be writable only by root, and should be world-readable.
893.Sh AUTHOR
894OpenSSH
895is a derivative of the original (free) ssh 1.2.12 release by Tatu Ylonen,
896but with bugs removed and newer features re-added.
897Rapidly after the
8981.2.12 release, newer versions of the original ssh bore successively
899more restrictive licenses, and thus demand for a free version was born.
900This version of OpenSSH
901.Bl -bullet
902.It
903has all components of a restrictive nature (i.e., patents, see
904.Xr ssl 8 )
905directly removed from the source code; any licensed or patented components
906are chosen from
907external libraries.
908.It
909has been updated to support ssh protocol 1.5, making it compatible with
910all other ssh protocol 1 clients and servers.
911.It
912contains added support for
913.Xr kerberos 8
914authentication and ticket passing.
915.It
916supports one-time password authentication with
917.Xr skey 1 .
918.El
919.Pp
920The libraries described in
921.Xr ssl 8
922are required for proper operation.
923.Sh SEE ALSO
924.Xr rlogin 1 ,
925.Xr rsh 1 ,
926.Xr scp 1 ,
927.Xr ssh 1 ,
928.Xr ssh-add 1 ,
929.Xr ssh-agent 1 ,
930.Xr ssh-keygen 1 ,
931.Xr ssl 8
932