]> andersk Git - gssapi-openssh.git/blame - openssh/sshd.8
Initial revision
[gssapi-openssh.git] / openssh / sshd.8
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.\"
e9702f7d 37.\" $OpenBSD: sshd.8,v 1.170 2002/02/28 20:46:10 stevesk Exp $
3c0ef626 38.Dd September 25, 1999
39.Dt SSHD 8
40.Os
41.Sh NAME
42.Nm sshd
43.Nd OpenSSH SSH daemon
44.Sh SYNOPSIS
45.Nm sshd
46.Op Fl deiqtD46
47.Op Fl b Ar bits
48.Op Fl f Ar config_file
49.Op Fl g Ar login_grace_time
50.Op Fl h Ar host_key_file
51.Op Fl k Ar key_gen_time
e9702f7d 52.Op Fl o Ar option
3c0ef626 53.Op Fl p Ar port
54.Op Fl u Ar len
55.Sh DESCRIPTION
56.Nm
57(SSH Daemon) is the daemon program for
58.Xr ssh 1 .
59Together these programs replace rlogin and rsh, and
60provide secure encrypted communications between two untrusted hosts
61over an insecure network.
62The programs are intended to be as easy to
63install and use as possible.
64.Pp
65.Nm
66is the daemon that listens for connections from clients.
67It is normally started at boot from
68.Pa /etc/rc .
69It forks a new
70daemon for each incoming connection.
71The forked daemons handle
72key exchange, encryption, authentication, command execution,
73and data exchange.
74This implementation of
75.Nm
76supports both SSH protocol version 1 and 2 simultaneously.
77.Nm
78works as follows.
79.Pp
80.Ss SSH protocol version 1
81.Pp
82Each host has a host-specific RSA key
83(normally 1024 bits) used to identify the host.
84Additionally, when
85the daemon starts, it generates a server RSA key (normally 768 bits).
86This key is normally regenerated every hour if it has been used, and
87is never stored on disk.
88.Pp
89Whenever a client connects the daemon responds with its public
90host and server keys.
91The client compares the
92RSA host key against its own database to verify that it has not changed.
93The client then generates a 256 bit random number.
94It encrypts this
95random number using both the host key and the server key, and sends
96the encrypted number to the server.
97Both sides then use this
98random number as a session key which is used to encrypt all further
99communications in the session.
100The rest of the session is encrypted
101using a conventional cipher, currently Blowfish or 3DES, with 3DES
102being used by default.
103The client selects the encryption algorithm
104to use from those offered by the server.
105.Pp
106Next, the server and the client enter an authentication dialog.
107The client tries to authenticate itself using
108.Pa .rhosts
109authentication,
110.Pa .rhosts
111authentication combined with RSA host
112authentication, RSA challenge-response authentication, or password
113based authentication.
114.Pp
115Rhosts authentication is normally disabled
116because it is fundamentally insecure, but can be enabled in the server
117configuration file if desired.
118System security is not improved unless
119.Xr rshd 8 ,
120.Xr rlogind 8 ,
121and
122.Xr rexecd 8
123are disabled (thus completely disabling
124.Xr rlogin 1
125and
126.Xr rsh 1
127into the machine).
128.Pp
129.Ss SSH protocol version 2
130.Pp
131Version 2 works similarly:
132Each host has a host-specific key (RSA or DSA) used to identify the host.
133However, when the daemon starts, it does not generate a server key.
134Forward security is provided through a Diffie-Hellman key agreement.
135This key agreement results in a shared session key.
136.Pp
137The rest of the session is encrypted using a symmetric cipher, currently
138128 bit AES, Blowfish, 3DES, CAST128, Arcfour, 192 bit AES, or 256 bit AES.
139The client selects the encryption algorithm
140to use from those offered by the server.
141Additionally, session integrity is provided
142through a cryptographic message authentication code
143(hmac-sha1 or hmac-md5).
144.Pp
145Protocol version 2 provides a public key based
146user (PubkeyAuthentication) or
147client host (HostbasedAuthentication) authentication method,
148conventional password authentication and challenge response based methods.
149.Pp
150.Ss Command execution and data forwarding
151.Pp
152If the client successfully authenticates itself, a dialog for
153preparing the session is entered.
154At this time the client may request
155things like allocating a pseudo-tty, forwarding X11 connections,
156forwarding TCP/IP connections, or forwarding the authentication agent
157connection over the secure channel.
158.Pp
159Finally, the client either requests a shell or execution of a command.
160The sides then enter session mode.
161In this mode, either side may send
162data at any time, and such data is forwarded to/from the shell or
163command on the server side, and the user terminal in the client side.
164.Pp
165When the user program terminates and all forwarded X11 and other
166connections have been closed, the server sends command exit status to
167the client, and both sides exit.
168.Pp
169.Nm
170can be configured using command-line options or a configuration
171file.
172Command-line options override values specified in the
173configuration file.
174.Pp
175.Nm
176rereads its configuration file when it receives a hangup signal,
177.Dv SIGHUP ,
178by executing itself with the name it was started as, i.e.,
179.Pa /usr/sbin/sshd .
180.Pp
181The options are as follows:
182.Bl -tag -width Ds
183.It Fl b Ar bits
184Specifies the number of bits in the ephemeral protocol version 1
185server key (default 768).
186.It Fl d
187Debug mode.
188The server sends verbose debug output to the system
189log, and does not put itself in the background.
190The server also will not fork and will only process one connection.
191This option is only intended for debugging for the server.
192Multiple -d options increase the debugging level.
193Maximum is 3.
194.It Fl e
195When this option is specified,
196.Nm
197will send the output to the standard error instead of the system log.
198.It Fl f Ar configuration_file
199Specifies the name of the configuration file.
200The default is
e9702f7d 201.Pa /etc/ssh/sshd_config .
3c0ef626 202.Nm
203refuses to start if there is no configuration file.
204.It Fl g Ar login_grace_time
205Gives the grace time for clients to authenticate themselves (default
206600 seconds).
207If the client fails to authenticate the user within
208this many seconds, the server disconnects and exits.
209A value of zero indicates no limit.
210.It Fl h Ar host_key_file
e9702f7d 211Specifies a file from which a host key is read.
3c0ef626 212This option must be given if
213.Nm
214is not run as root (as the normal
e9702f7d 215host key files are normally not readable by anyone but root).
216The default is
217.Pa /etc/ssh/ssh_host_key
218for protocol version 1, and
219.Pa /etc/ssh/ssh_host_rsa_key
220and
221.Pa /etc/ssh/ssh_host_dsa_key
222for protocol version 2.
3c0ef626 223It is possible to have multiple host key files for
224the different protocol versions and host key algorithms.
225.It Fl i
226Specifies that
227.Nm
228is being run from inetd.
229.Nm
230is normally not run
231from inetd because it needs to generate the server key before it can
232respond to the client, and this may take tens of seconds.
233Clients would have to wait too long if the key was regenerated every time.
234However, with small key sizes (e.g., 512) using
235.Nm
236from inetd may
237be feasible.
238.It Fl k Ar key_gen_time
239Specifies how often the ephemeral protocol version 1 server key is
240regenerated (default 3600 seconds, or one hour).
241The motivation for regenerating the key fairly
242often is that the key is not stored anywhere, and after about an hour,
243it becomes impossible to recover the key for decrypting intercepted
244communications even if the machine is cracked into or physically
245seized.
246A value of zero indicates that the key will never be regenerated.
e9702f7d 247.It Fl o Ar option
248Can be used to give options in the format used in the configuration file.
249This is useful for specifying options for which there is no separate
250command-line flag.
3c0ef626 251.It Fl p Ar port
252Specifies the port on which the server listens for connections
253(default 22).
e9702f7d 254Multiple port options are permitted.
255Ports specified in the configuration file are ignored when a
256command-line port is specified.
3c0ef626 257.It Fl q
258Quiet mode.
259Nothing is sent to the system log.
260Normally the beginning,
261authentication, and termination of each connection is logged.
262.It Fl t
263Test mode.
264Only check the validity of the configuration file and sanity of the keys.
e9702f7d 265This is useful for updating
3c0ef626 266.Nm
267reliably as configuration options may change.
268.It Fl u Ar len
269This option is used to specify the size of the field
270in the
271.Li utmp
272structure that holds the remote host name.
273If the resolved host name is longer than
274.Ar len ,
275the dotted decimal value will be used instead.
276This allows hosts with very long host names that
277overflow this field to still be uniquely identified.
278Specifying
279.Fl u0
280indicates that only dotted decimal addresses
281should be put into the
282.Pa utmp
283file.
284.Fl u0
285is also be used to prevent
286.Nm
287from making DNS requests unless the authentication
288mechanism or configuration requires it.
289Authentication mechanisms that may require DNS include
290.Cm RhostsAuthentication ,
291.Cm RhostsRSAAuthentication ,
292.Cm HostbasedAuthentication
293and using a
294.Cm from="pattern-list"
295option in a key file.
e9702f7d 296Configuration options that require DNS include using a
297USER@HOST pattern in
298.Cm AllowUsers
299or
300.Cm DenyUsers .
3c0ef626 301.It Fl D
302When this option is specified
303.Nm
304will not detach and does not become a daemon.
305This allows easy monitoring of
306.Nm sshd .
307.It Fl 4
308Forces
309.Nm
310to use IPv4 addresses only.
311.It Fl 6
312Forces
313.Nm
314to use IPv6 addresses only.
315.El
316.Sh CONFIGURATION FILE
317.Nm
318reads configuration data from
e9702f7d 319.Pa /etc/ssh/sshd_config
3c0ef626 320(or the file specified with
321.Fl f
322on the command line).
323The file contains keyword-argument pairs, one per line.
324Lines starting with
325.Ql #
326and empty lines are interpreted as comments.
327.Pp
328The possible
329keywords and their meanings are as follows (note that
330keywords are case-insensitive and arguments are case-sensitive):
331.Bl -tag -width Ds
332.It Cm AFSTokenPassing
333Specifies whether an AFS token may be forwarded to the server.
334Default is
335.Dq yes .
336.It Cm AllowGroups
e9702f7d 337This keyword can be followed by a list of group name patterns, separated
3c0ef626 338by spaces.
339If specified, login is allowed only for users whose primary
340group or supplementary group list matches one of the patterns.
341.Ql \&*
342and
343.Ql ?
344can be used as
345wildcards in the patterns.
346Only group names are valid; a numerical group ID is not recognized.
e9702f7d 347By default, login is allowed for all groups.
3c0ef626 348.Pp
349.It Cm AllowTcpForwarding
350Specifies whether TCP forwarding is permitted.
351The default is
352.Dq yes .
353Note that disabling TCP forwarding does not improve security unless
354users are also denied shell access, as they can always install their
355own forwarders.
356.Pp
357.It Cm AllowUsers
e9702f7d 358This keyword can be followed by a list of user name patterns, separated
3c0ef626 359by spaces.
360If specified, login is allowed only for users names that
361match one of the patterns.
362.Ql \&*
363and
364.Ql ?
365can be used as
366wildcards in the patterns.
367Only user names are valid; a numerical user ID is not recognized.
e9702f7d 368By default, login is allowed for all users.
3c0ef626 369If the pattern takes the form USER@HOST then USER and HOST
370are separately checked, restricting logins to particular
371users from particular hosts.
372.Pp
373.It Cm AuthorizedKeysFile
374Specifies the file that contains the public keys that can be used
375for user authentication.
376.Cm AuthorizedKeysFile
377may contain tokens of the form %T which are substituted during connection
378set-up. The following tokens are defined: %% is replaced by a literal '%',
379%h is replaced by the home directory of the user being authenticated and
380%u is replaced by the username of that user.
381After expansion,
382.Cm AuthorizedKeysFile
383is taken to be an absolute path or one relative to the user's home
384directory.
385The default is
e9702f7d 386.Dq .ssh/authorized_keys .
3c0ef626 387.It Cm Banner
388In some jurisdictions, sending a warning message before authentication
389may be relevant for getting legal protection.
390The contents of the specified file are sent to the remote user before
391authentication is allowed.
392This option is only available for protocol version 2.
393.Pp
394.It Cm ChallengeResponseAuthentication
395Specifies whether challenge response authentication is allowed.
396All authentication styles from
397.Xr login.conf 5
398are supported.
399The default is
400.Dq yes .
401.It Cm Ciphers
402Specifies the ciphers allowed for protocol version 2.
403Multiple ciphers must be comma-separated.
404The default is
e9702f7d 405.Pp
406.Bd -literal
407 ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
408 aes192-cbc,aes256-cbc''
409.Ed
3c0ef626 410.It Cm ClientAliveInterval
411Sets a timeout interval in seconds after which if no data has been received
412from the client,
413.Nm
414will send a message through the encrypted
415channel to request a response from the client.
416The default
417is 0, indicating that these messages will not be sent to the client.
418This option applies to protocol version 2 only.
419.It Cm ClientAliveCountMax
420Sets the number of client alive messages (see above) which may be
421sent without
422.Nm
423receiving any messages back from the client. If this threshold is
424reached while client alive messages are being sent,
425.Nm
426will disconnect the client, terminating the session. It is important
427to note that the use of client alive messages is very different from
428.Cm KeepAlive
429(below). The client alive messages are sent through the
430encrypted channel and therefore will not be spoofable. The TCP keepalive
431option enabled by
432.Cm KeepAlive
433is spoofable. The client alive mechanism is valuable when the client or
434server depend on knowing when a connection has become inactive.
435.Pp
436The default value is 3. If
437.Cm ClientAliveInterval
438(above) is set to 15, and
439.Cm ClientAliveCountMax
440is left at the default, unresponsive ssh clients
441will be disconnected after approximately 45 seconds.
442.It Cm DenyGroups
e9702f7d 443This keyword can be followed by a list of group name patterns, separated
3c0ef626 444by spaces.
e9702f7d 445Login is disallowed for users whose primary group or supplementary
446group list matches one of the patterns.
3c0ef626 447.Ql \&*
448and
449.Ql ?
450can be used as
451wildcards in the patterns.
452Only group names are valid; a numerical group ID is not recognized.
e9702f7d 453By default, login is allowed for all groups.
3c0ef626 454.Pp
455.It Cm DenyUsers
e9702f7d 456This keyword can be followed by a list of user name patterns, separated
3c0ef626 457by spaces.
458Login is disallowed for user names that match one of the patterns.
459.Ql \&*
460and
461.Ql ?
462can be used as wildcards in the patterns.
463Only user names are valid; a numerical user ID is not recognized.
e9702f7d 464By default, login is allowed for all users.
465If the pattern takes the form USER@HOST then USER and HOST
466are separately checked, restricting logins to particular
467users from particular hosts.
3c0ef626 468.It Cm GatewayPorts
469Specifies whether remote hosts are allowed to connect to ports
470forwarded for the client.
471By default,
472.Nm
473binds remote port forwardings to the loopback addresss. This
474prevents other remote hosts from connecting to forwarded ports.
475.Cm GatewayPorts
476can be used to specify that
477.Nm
478should bind remote port forwardings to the wildcard address,
479thus allowing remote hosts to connect to forwarded ports.
480The argument must be
481.Dq yes
482or
483.Dq no .
484The default is
485.Dq no .
486.It Cm HostbasedAuthentication
487Specifies whether rhosts or /etc/hosts.equiv authentication together
488with successful public key client host authentication is allowed
489(hostbased authentication).
490This option is similar to
491.Cm RhostsRSAAuthentication
492and applies to protocol version 2 only.
493The default is
494.Dq no .
5598e598 495.It Cm GssapiAuthentication
496Specifies whether authentication based on GSSAPI may be used, either using
497the result of a successful key exchange, or using GSSAPI user
498authentication.
499The default is
500.Dq yes .
501Note that this option applies to protocol version 2 only.
502.It Cm GssapiKeyExchange
503Specifies whether key exchange based on GSSAPI may be used. When using
504GSSAPI key exchange the server need not have a host key.
505The default is
506.Dq yes .
507Note that this option applies to protocol version 2 only.
508.It Cm GssapiUseSessionCredCache
509Specifies whether a unique credentials cache name should be generated per
510session for storing delegated credentials.
511The default is
512.Dq yes .
513Note that this option applies to protocol version 2 only.
3c0ef626 514.It Cm HostKey
e9702f7d 515Specifies a file containing a private host key
516used by SSH.
517The default is
518.Pa /etc/ssh/ssh_host_key
519for protocol version 1, and
520.Pa /etc/ssh/ssh_host_rsa_key
521and
522.Pa /etc/ssh/ssh_host_dsa_key
523for protocol version 2.
3c0ef626 524Note that
525.Nm
526will refuse to use a file if it is group/world-accessible.
527It is possible to have multiple host key files.
528.Dq rsa1
529keys are used for version 1 and
530.Dq dsa
531or
532.Dq rsa
533are used for version 2 of the SSH protocol.
534.It Cm IgnoreRhosts
535Specifies that
536.Pa .rhosts
537and
538.Pa .shosts
539files will not be used in
540.Cm RhostsAuthentication ,
541.Cm RhostsRSAAuthentication
542or
543.Cm HostbasedAuthentication .
544.Pp
545.Pa /etc/hosts.equiv
546and
547.Pa /etc/shosts.equiv
548are still used.
549The default is
550.Dq yes .
551.It Cm IgnoreUserKnownHosts
552Specifies whether
553.Nm
554should ignore the user's
555.Pa $HOME/.ssh/known_hosts
556during
557.Cm RhostsRSAAuthentication
558or
559.Cm HostbasedAuthentication .
560The default is
561.Dq no .
562.It Cm KeepAlive
e9702f7d 563Specifies whether the system should send TCP keepalive messages to the
3c0ef626 564other side.
565If they are sent, death of the connection or crash of one
566of the machines will be properly noticed.
567However, this means that
568connections will die if the route is down temporarily, and some people
569find it annoying.
570On the other hand, if keepalives are not sent,
571sessions may hang indefinitely on the server, leaving
572.Dq ghost
573users and consuming server resources.
574.Pp
575The default is
576.Dq yes
577(to send keepalives), and the server will notice
e9702f7d 578if the network goes down or the client host crashes.
3c0ef626 579This avoids infinitely hanging sessions.
580.Pp
581To disable keepalives, the value should be set to
e9702f7d 582.Dq no .
3c0ef626 583.It Cm KerberosAuthentication
584Specifies whether Kerberos authentication is allowed.
585This can be in the form of a Kerberos ticket, or if
586.Cm PasswordAuthentication
587is yes, the password provided by the user will be validated through
588the Kerberos KDC.
589To use this option, the server needs a
590Kerberos servtab which allows the verification of the KDC's identity.
591Default is
592.Dq yes .
593.It Cm KerberosOrLocalPasswd
594If set then if password authentication through Kerberos fails then
595the password will be validated via any additional local mechanism
596such as
597.Pa /etc/passwd .
598Default is
599.Dq yes .
600.It Cm KerberosTgtPassing
601Specifies whether a Kerberos TGT may be forwarded to the server.
602Default is
603.Dq no ,
604as this only works when the Kerberos KDC is actually an AFS kaserver.
605.It Cm KerberosTicketCleanup
606Specifies whether to automatically destroy the user's ticket cache
607file on logout.
608Default is
609.Dq yes .
610.It Cm KeyRegenerationInterval
611In protocol version 1, the ephemeral server key is automatically regenerated
612after this many seconds (if it has been used).
613The purpose of regeneration is to prevent
614decrypting captured sessions by later breaking into the machine and
615stealing the keys.
616The key is never stored anywhere.
617If the value is 0, the key is never regenerated.
618The default is 3600 (seconds).
619.It Cm ListenAddress
620Specifies the local addresses
621.Nm
622should listen on.
623The following forms may be used:
624.Pp
625.Bl -item -offset indent -compact
626.It
627.Cm ListenAddress
628.Sm off
629.Ar host No | Ar IPv4_addr No | Ar IPv6_addr
630.Sm on
631.It
632.Cm ListenAddress
633.Sm off
634.Ar host No | Ar IPv4_addr No : Ar port
635.Sm on
636.It
637.Cm ListenAddress
638.Sm off
639.Oo
640.Ar host No | Ar IPv6_addr Oc : Ar port
641.Sm on
642.El
643.Pp
644If
645.Ar port
646is not specified,
647.Nm
648will listen on the address and all prior
649.Cm Port
650options specified. The default is to listen on all local
651addresses. Multiple
652.Cm ListenAddress
653options are permitted. Additionally, any
654.Cm Port
655options must precede this option for non port qualified addresses.
656.It Cm LoginGraceTime
657The server disconnects after this time if the user has not
658successfully logged in.
659If the value is 0, there is no time limit.
660The default is 600 (seconds).
661.It Cm LogLevel
662Gives the verbosity level that is used when logging messages from
663.Nm sshd .
664The possible values are:
e9702f7d 665QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3.
666The default is INFO. DEBUG and DEBUG1 are equivalent. DEBUG2
667and DEBUG3 each specify higher levels of debugging output.
668Logging with a DEBUG level violates the privacy of users
3c0ef626 669and is not recommended.
670.It Cm MACs
671Specifies the available MAC (message authentication code) algorithms.
672The MAC algorithm is used in protocol version 2
673for data integrity protection.
674Multiple algorithms must be comma-separated.
675The default is
676.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
677.It Cm MaxStartups
678Specifies the maximum number of concurrent unauthenticated connections to the
679.Nm
680daemon.
681Additional connections will be dropped until authentication succeeds or the
682.Cm LoginGraceTime
683expires for a connection.
684The default is 10.
685.Pp
686Alternatively, random early drop can be enabled by specifying
687the three colon separated values
688.Dq start:rate:full
689(e.g., "10:30:60").
690.Nm
691will refuse connection attempts with a probability of
692.Dq rate/100
693(30%)
694if there are currently
695.Dq start
696(10)
697unauthenticated connections.
698The probability increases linearly and all connection attempts
699are refused if the number of unauthenticated connections reaches
700.Dq full
701(60).
702.It Cm PAMAuthenticationViaKbdInt
703Specifies whether PAM challenge response authentication is allowed. This
704allows the use of most PAM challenge response authentication modules, but
705it will allow password authentication regardless of whether
706.Cm PasswordAuthentication
707is disabled.
708The default is
709.Dq no .
710.It Cm PasswordAuthentication
711Specifies whether password authentication is allowed.
712The default is
713.Dq yes .
714.It Cm PermitEmptyPasswords
715When password authentication is allowed, it specifies whether the
716server allows login to accounts with empty password strings.
717The default is
718.Dq no .
719.It Cm PermitRootLogin
720Specifies whether root can login using
721.Xr ssh 1 .
722The argument must be
723.Dq yes ,
724.Dq without-password ,
725.Dq forced-commands-only
726or
727.Dq no .
728The default is
729.Dq yes .
730.Pp
731If this option is set to
732.Dq without-password
733password authentication is disabled for root.
734.Pp
735If this option is set to
736.Dq forced-commands-only
737root login with public key authentication will be allowed,
738but only if the
739.Ar command
740option has been specified
741(which may be useful for taking remote backups even if root login is
742normally not allowed). All other authentication methods are disabled
743for root.
744.Pp
745If this option is set to
746.Dq no
747root is not allowed to login.
748.It Cm PidFile
749Specifies the file that contains the process identifier of the
750.Nm
751daemon.
752The default is
753.Pa /var/run/sshd.pid .
754.It Cm Port
755Specifies the port number that
756.Nm
757listens on.
758The default is 22.
759Multiple options of this type are permitted.
760See also
761.Cm ListenAddress .
762.It Cm PrintLastLog
763Specifies whether
764.Nm
765should print the date and time when the user last logged in.
766The default is
767.Dq yes .
768.It Cm PrintMotd
769Specifies whether
770.Nm
771should print
772.Pa /etc/motd
773when a user logs in interactively.
774(On some systems it is also printed by the shell,
775.Pa /etc/profile ,
776or equivalent.)
777The default is
778.Dq yes .
779.It Cm Protocol
780Specifies the protocol versions
781.Nm
782should support.
783The possible values are
784.Dq 1
785and
786.Dq 2 .
787Multiple versions must be comma-separated.
788The default is
789.Dq 2,1 .
790.It Cm PubkeyAuthentication
791Specifies whether public key authentication is allowed.
792The default is
793.Dq yes .
794Note that this option applies to protocol version 2 only.
3c0ef626 795.It Cm RhostsAuthentication
796Specifies whether authentication using rhosts or /etc/hosts.equiv
797files is sufficient.
798Normally, this method should not be permitted because it is insecure.
799.Cm RhostsRSAAuthentication
800should be used
801instead, because it performs RSA-based host authentication in addition
802to normal rhosts or /etc/hosts.equiv authentication.
803The default is
804.Dq no .
805This option applies to protocol version 1 only.
806.It Cm RhostsRSAAuthentication
807Specifies whether rhosts or /etc/hosts.equiv authentication together
808with successful RSA host authentication is allowed.
809The default is
810.Dq no .
811This option applies to protocol version 1 only.
812.It Cm RSAAuthentication
813Specifies whether pure RSA authentication is allowed.
814The default is
815.Dq yes .
816This option applies to protocol version 1 only.
817.It Cm ServerKeyBits
818Defines the number of bits in the ephemeral protocol version 1 server key.
819The minimum value is 512, and the default is 768.
820.It Cm StrictModes
821Specifies whether
822.Nm
823should check file modes and ownership of the
824user's files and home directory before accepting login.
825This is normally desirable because novices sometimes accidentally leave their
826directory or files world-writable.
827The default is
828.Dq yes .
829.It Cm Subsystem
830Configures an external subsystem (e.g., file transfer daemon).
831Arguments should be a subsystem name and a command to execute upon subsystem
832request.
833The command
834.Xr sftp-server 8
835implements the
836.Dq sftp
837file transfer subsystem.
838By default no subsystems are defined.
839Note that this option applies to protocol version 2 only.
840.It Cm SyslogFacility
841Gives the facility code that is used when logging messages from
842.Nm sshd .
843The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
844LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
845The default is AUTH.
846.It Cm UseLogin
847Specifies whether
848.Xr login 1
849is used for interactive login sessions.
850The default is
851.Dq no .
852Note that
853.Xr login 1
854is never used for remote command execution.
855Note also, that if this is enabled,
856.Cm X11Forwarding
857will be disabled because
858.Xr login 1
859does not know how to handle
860.Xr xauth 1
861cookies.
e9702f7d 862.It Cm VerifyReverseMapping
863Specifies whether
864.Nm
865should try to verify the remote host name and check that
866the resolved host name for the remote IP address maps back to the
867very same IP address.
868The default is
869.Dq no .
3c0ef626 870.It Cm X11DisplayOffset
871Specifies the first display number available for
872.Nm sshd Ns 's
873X11 forwarding.
874This prevents
875.Nm
876from interfering with real X11 servers.
877The default is 10.
878.It Cm X11Forwarding
879Specifies whether X11 forwarding is permitted.
880The default is
881.Dq no .
882Note that disabling X11 forwarding does not improve security in any
883way, as users can always install their own forwarders.
884X11 forwarding is automatically disabled if
885.Cm UseLogin
886is enabled.
e9702f7d 887.It Cm X11UseLocalhost
888Specifies whether
889.Nm
890should bind the X11 forwarding server to the loopback address or to
891the wildcard address. By default,
892.Nm
893binds the forwarding server to the loopback address and sets the
894hostname part of the
895.Ev DISPLAY
896environment variable to
897.Dq localhost .
898This prevents remote hosts from connecting to the fake display.
899However, some older X11 clients may not function with this
900configuration.
901.Cm X11UseLocalhost
902may be set to
903.Dq no
904to specify that the forwarding server should be bound to the wildcard
905address.
906The argument must be
907.Dq yes
908or
909.Dq no .
910The default is
911.Dq yes .
3c0ef626 912.It Cm XAuthLocation
913Specifies the location of the
914.Xr xauth 1
915program.
916The default is
917.Pa /usr/X11R6/bin/xauth .
918.El
919.Ss Time Formats
920.Pp
921.Nm
922command-line arguments and configuration file options that specify time
923may be expressed using a sequence of the form:
924.Sm off
925.Ar time Oo Ar qualifier Oc ,
926.Sm on
927where
928.Ar time
929is a positive integer value and
930.Ar qualifier
931is one of the following:
932.Pp
933.Bl -tag -width Ds -compact -offset indent
934.It Cm <none>
935seconds
936.It Cm s | Cm S
937seconds
938.It Cm m | Cm M
939minutes
940.It Cm h | Cm H
941hours
942.It Cm d | Cm D
943days
944.It Cm w | Cm W
945weeks
946.El
947.Pp
948Each member of the sequence is added together to calculate
949the total time value.
950.Pp
951Time format examples:
952.Pp
953.Bl -tag -width Ds -compact -offset indent
954.It 600
955600 seconds (10 minutes)
956.It 10m
95710 minutes
958.It 1h30m
9591 hour 30 minutes (90 minutes)
960.El
961.Sh LOGIN PROCESS
962When a user successfully logs in,
963.Nm
964does the following:
965.Bl -enum -offset indent
966.It
967If the login is on a tty, and no command has been specified,
968prints last login time and
969.Pa /etc/motd
970(unless prevented in the configuration file or by
971.Pa $HOME/.hushlogin ;
972see the
973.Sx FILES
974section).
975.It
976If the login is on a tty, records login time.
977.It
978Checks
979.Pa /etc/nologin ;
980if it exists, prints contents and quits
981(unless root).
982.It
983Changes to run with normal user privileges.
984.It
985Sets up basic environment.
986.It
987Reads
988.Pa $HOME/.ssh/environment
989if it exists.
990.It
991Changes to user's home directory.
992.It
993If
994.Pa $HOME/.ssh/rc
995exists, runs it; else if
e9702f7d 996.Pa /etc/ssh/sshrc
3c0ef626 997exists, runs
998it; otherwise runs xauth.
999The
1000.Dq rc
1001files are given the X11
1002authentication protocol and cookie in standard input.
1003.It
1004Runs user's shell or command.
1005.El
1006.Sh AUTHORIZED_KEYS FILE FORMAT
1007.Pa $HOME/.ssh/authorized_keys
1008is the default file that lists the public keys that are
1009permitted for RSA authentication in protocol version 1
1010and for public key authentication (PubkeyAuthentication)
1011in protocol version 2.
1012.Cm AuthorizedKeysFile
1013may be used to specify an alternative file.
1014.Pp
1015Each line of the file contains one
1016key (empty lines and lines starting with a
1017.Ql #
1018are ignored as
1019comments).
1020Each RSA public key consists of the following fields, separated by
1021spaces: options, bits, exponent, modulus, comment.
1022Each protocol version 2 public key consists of:
1023options, keytype, base64 encoded key, comment.
1024The options fields
1025are optional; its presence is determined by whether the line starts
1026with a number or not (the option field never starts with a number).
1027The bits, exponent, modulus and comment fields give the RSA key for
1028protocol version 1; the
1029comment field is not used for anything (but may be convenient for the
1030user to identify the key).
1031For protocol version 2 the keytype is
1032.Dq ssh-dss
1033or
1034.Dq ssh-rsa .
1035.Pp
1036Note that lines in this file are usually several hundred bytes long
1037(because of the size of the RSA key modulus).
1038You don't want to type them in; instead, copy the
1039.Pa identity.pub ,
1040.Pa id_dsa.pub
1041or the
1042.Pa id_rsa.pub
1043file and edit it.
1044.Pp
1045The options (if present) consist of comma-separated option
1046specifications.
1047No spaces are permitted, except within double quotes.
1048The following option specifications are supported (note
1049that option keywords are case-insensitive):
1050.Bl -tag -width Ds
1051.It Cm from="pattern-list"
1052Specifies that in addition to RSA authentication, the canonical name
1053of the remote host must be present in the comma-separated list of
1054patterns
1055.Pf ( Ql *
1056and
1057.Ql ?
1058serve as wildcards).
1059The list may also contain
1060patterns negated by prefixing them with
1061.Ql ! ;
1062if the canonical host name matches a negated pattern, the key is not accepted.
1063The purpose
1064of this option is to optionally increase security: RSA authentication
1065by itself does not trust the network or name servers or anything (but
1066the key); however, if somebody somehow steals the key, the key
1067permits an intruder to log in from anywhere in the world.
1068This additional option makes using a stolen key more difficult (name
1069servers and/or routers would have to be compromised in addition to
1070just the key).
1071.It Cm command="command"
1072Specifies that the command is executed whenever this key is used for
1073authentication.
1074The command supplied by the user (if any) is ignored.
1075The command is run on a pty if the client requests a pty;
1076otherwise it is run without a tty.
1077If a 8-bit clean channel is required,
1078one must not request a pty or should specify
1079.Cm no-pty .
1080A quote may be included in the command by quoting it with a backslash.
1081This option might be useful
1082to restrict certain RSA keys to perform just a specific operation.
1083An example might be a key that permits remote backups but nothing else.
1084Note that the client may specify TCP/IP and/or X11
1085forwarding unless they are explicitly prohibited.
1086Note that this option applies to shell, command or subsystem execution.
1087.It Cm environment="NAME=value"
1088Specifies that the string is to be added to the environment when
1089logging in using this key.
1090Environment variables set this way
1091override other default environment values.
1092Multiple options of this type are permitted.
1093This option is automatically disabled if
1094.Cm UseLogin
1095is enabled.
1096.It Cm no-port-forwarding
1097Forbids TCP/IP forwarding when this key is used for authentication.
1098Any port forward requests by the client will return an error.
1099This might be used, e.g., in connection with the
1100.Cm command
1101option.
1102.It Cm no-X11-forwarding
1103Forbids X11 forwarding when this key is used for authentication.
1104Any X11 forward requests by the client will return an error.
1105.It Cm no-agent-forwarding
1106Forbids authentication agent forwarding when this key is used for
1107authentication.
1108.It Cm no-pty
1109Prevents tty allocation (a request to allocate a pty will fail).
1110.It Cm permitopen="host:port"
1111Limit local
1112.Li ``ssh -L''
1113port forwarding such that it may only connect to the specified host and
1114port.
1115IPv6 addresses can be specified with an alternative syntax:
1116.Ar host/port .
1117Multiple
1118.Cm permitopen
1119options may be applied separated by commas. No pattern matching is
1120performed on the specified hostnames, they must be literal domains or
1121addresses.
1122.El
1123.Ss Examples
11241024 33 12121.\|.\|.\|312314325 ylo@foo.bar
1125.Pp
1126from="*.niksula.hut.fi,!pc.niksula.hut.fi" 1024 35 23.\|.\|.\|2334 ylo@niksula
1127.Pp
1128command="dump /home",no-pty,no-port-forwarding 1024 33 23.\|.\|.\|2323 backup.hut.fi
1129.Pp
1130permitopen="10.2.1.55:80",permitopen="10.2.1.56:25" 1024 33 23.\|.\|.\|2323
1131.Sh SSH_KNOWN_HOSTS FILE FORMAT
1132The
e9702f7d 1133.Pa /etc/ssh/ssh_known_hosts ,
3c0ef626 1134and
1135.Pa $HOME/.ssh/known_hosts
1136files contain host public keys for all known hosts.
1137The global file should
1138be prepared by the administrator (optional), and the per-user file is
1139maintained automatically: whenever the user connects from an unknown host
1140its key is added to the per-user file.
1141.Pp
1142Each line in these files contains the following fields: hostnames,
1143bits, exponent, modulus, comment.
1144The fields are separated by spaces.
1145.Pp
1146Hostnames is a comma-separated list of patterns ('*' and '?' act as
1147wildcards); each pattern in turn is matched against the canonical host
1148name (when authenticating a client) or against the user-supplied
1149name (when authenticating a server).
1150A pattern may also be preceded by
1151.Ql !
1152to indicate negation: if the host name matches a negated
1153pattern, it is not accepted (by that line) even if it matched another
1154pattern on the line.
1155.Pp
1156Bits, exponent, and modulus are taken directly from the RSA host key; they
1157can be obtained, e.g., from
e9702f7d 1158.Pa /etc/ssh/ssh_host_key.pub .
3c0ef626 1159The optional comment field continues to the end of the line, and is not used.
1160.Pp
1161Lines starting with
1162.Ql #
1163and empty lines are ignored as comments.
1164.Pp
1165When performing host authentication, authentication is accepted if any
1166matching line has the proper key.
1167It is thus permissible (but not
1168recommended) to have several lines or different host keys for the same
1169names.
1170This will inevitably happen when short forms of host names
1171from different domains are put in the file.
1172It is possible
1173that the files contain conflicting information; authentication is
1174accepted if valid information can be found from either file.
1175.Pp
1176Note that the lines in these files are typically hundreds of characters
1177long, and you definitely don't want to type in the host keys by hand.
1178Rather, generate them by a script
1179or by taking
e9702f7d 1180.Pa /etc/ssh/ssh_host_key.pub
3c0ef626 1181and adding the host names at the front.
1182.Ss Examples
1183.Bd -literal
1184closenet,.\|.\|.\|,130.233.208.41 1024 37 159.\|.\|.93 closenet.hut.fi
1185cvs.openbsd.org,199.185.137.3 ssh-rsa AAAA1234.....=
1186.Ed
1187.Sh FILES
1188.Bl -tag -width Ds
e9702f7d 1189.It Pa /etc/ssh/sshd_config
3c0ef626 1190Contains configuration data for
1191.Nm sshd .
1192This file should be writable by root only, but it is recommended
1193(though not necessary) that it be world-readable.
e9702f7d 1194.It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
3c0ef626 1195These three files contain the private parts of the host keys.
1196These files should only be owned by root, readable only by root, and not
1197accessible to others.
1198Note that
1199.Nm
1200does not start if this file is group/world-accessible.
e9702f7d 1201.It Pa /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_rsa_key.pub
3c0ef626 1202These three files contain the public parts of the host keys.
1203These files should be world-readable but writable only by
1204root.
1205Their contents should match the respective private parts.
1206These files are not
1207really used for anything; they are provided for the convenience of
1208the user so their contents can be copied to known hosts files.
1209These files are created using
1210.Xr ssh-keygen 1 .
1211.It Pa /etc/moduli
1212Contains Diffie-Hellman groups used for the "Diffie-Hellman Group Exchange".
1213.It Pa /var/run/sshd.pid
1214Contains the process ID of the
1215.Nm
1216listening for connections (if there are several daemons running
1217concurrently for different ports, this contains the pid of the one
1218started last).
1219The content of this file is not sensitive; it can be world-readable.
1220.It Pa $HOME/.ssh/authorized_keys
1221Lists the public keys (RSA or DSA) that can be used to log into the user's account.
1222This file must be readable by root (which may on some machines imply
1223it being world-readable if the user's home directory resides on an NFS
1224volume).
1225It is recommended that it not be accessible by others.
1226The format of this file is described above.
1227Users will place the contents of their
1228.Pa identity.pub ,
1229.Pa id_dsa.pub
1230and/or
1231.Pa id_rsa.pub
1232files into this file, as described in
1233.Xr ssh-keygen 1 .
e9702f7d 1234.It Pa "/etc/ssh/ssh_known_hosts" and "$HOME/.ssh/known_hosts"
3c0ef626 1235These files are consulted when using rhosts with RSA host
1236authentication or protocol version 2 hostbased authentication
1237to check the public key of the host.
1238The key must be listed in one of these files to be accepted.
1239The client uses the same files
1240to verify that it is connecting to the correct remote host.
1241These files should be writable only by root/the owner.
e9702f7d 1242.Pa /etc/ssh/ssh_known_hosts
3c0ef626 1243should be world-readable, and
1244.Pa $HOME/.ssh/known_hosts
1245can but need not be world-readable.
1246.It Pa /etc/nologin
1247If this file exists,
1248.Nm
1249refuses to let anyone except root log in.
1250The contents of the file
1251are displayed to anyone trying to log in, and non-root connections are
1252refused.
1253The file should be world-readable.
1254.It Pa /etc/hosts.allow, /etc/hosts.deny
1255Access controls that should be enforced by tcp-wrappers are defined here.
1256Further details are described in
1257.Xr hosts_access 5 .
1258.It Pa $HOME/.rhosts
1259This file contains host-username pairs, separated by a space, one per
1260line.
1261The given user on the corresponding host is permitted to log in
1262without password.
1263The same file is used by rlogind and rshd.
1264The file must
1265be writable only by the user; it is recommended that it not be
1266accessible by others.
1267.Pp
1268If is also possible to use netgroups in the file.
1269Either host or user
1270name may be of the form +@groupname to specify all hosts or all users
1271in the group.
1272.It Pa $HOME/.shosts
1273For ssh,
1274this file is exactly the same as for
1275.Pa .rhosts .
1276However, this file is
1277not used by rlogin and rshd, so using this permits access using SSH only.
1278.It Pa /etc/hosts.equiv
1279This file is used during
1280.Pa .rhosts
1281authentication.
1282In the simplest form, this file contains host names, one per line.
1283Users on
1284those hosts are permitted to log in without a password, provided they
1285have the same user name on both machines.
1286The host name may also be
1287followed by a user name; such users are permitted to log in as
1288.Em any
1289user on this machine (except root).
1290Additionally, the syntax
1291.Dq +@group
1292can be used to specify netgroups.
1293Negated entries start with
1294.Ql \&- .
1295.Pp
1296If the client host/user is successfully matched in this file, login is
1297automatically permitted provided the client and server user names are the
1298same.
1299Additionally, successful RSA host authentication is normally required.
1300This file must be writable only by root; it is recommended
1301that it be world-readable.
1302.Pp
1303.Sy "Warning: It is almost never a good idea to use user names in"
1304.Pa hosts.equiv .
1305Beware that it really means that the named user(s) can log in as
1306.Em anybody ,
1307which includes bin, daemon, adm, and other accounts that own critical
1308binaries and directories.
1309Using a user name practically grants the user root access.
1310The only valid use for user names that I can think
1311of is in negative entries.
1312.Pp
1313Note that this warning also applies to rsh/rlogin.
1314.It Pa /etc/shosts.equiv
1315This is processed exactly as
1316.Pa /etc/hosts.equiv .
1317However, this file may be useful in environments that want to run both
1318rsh/rlogin and ssh.
1319.It Pa $HOME/.ssh/environment
1320This file is read into the environment at login (if it exists).
1321It can only contain empty lines, comment lines (that start with
1322.Ql # ) ,
1323and assignment lines of the form name=value.
1324The file should be writable
1325only by the user; it need not be readable by anyone else.
1326.It Pa $HOME/.ssh/rc
1327If this file exists, it is run with /bin/sh after reading the
1328environment files but before starting the user's shell or command.
1329If X11 spoofing is in use, this will receive the "proto cookie" pair in
1330standard input (and
1331.Ev DISPLAY
1332in environment).
1333This must call
1334.Xr xauth 1
1335in that case.
1336.Pp
1337The primary purpose of this file is to run any initialization routines
1338which may be needed before the user's home directory becomes
1339accessible; AFS is a particular example of such an environment.
1340.Pp
1341This file will probably contain some initialization code followed by
1342something similar to:
1343.Bd -literal
1344 if read proto cookie; then
1345 echo add $DISPLAY $proto $cookie | xauth -q -
1346 fi
1347.Ed
1348.Pp
1349If this file does not exist,
e9702f7d 1350.Pa /etc/ssh/sshrc
3c0ef626 1351is run, and if that
1352does not exist either, xauth is used to store the cookie.
1353.Pp
1354This file should be writable only by the user, and need not be
1355readable by anyone else.
e9702f7d 1356.It Pa /etc/ssh/sshrc
3c0ef626 1357Like
1358.Pa $HOME/.ssh/rc .
1359This can be used to specify
1360machine-specific login-time initializations globally.
1361This file should be writable only by root, and should be world-readable.
1362.El
1363.Sh AUTHORS
1364OpenSSH is a derivative of the original and free
1365ssh 1.2.12 release by Tatu Ylonen.
1366Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1367Theo de Raadt and Dug Song
1368removed many bugs, re-added newer features and
1369created OpenSSH.
1370Markus Friedl contributed the support for SSH
1371protocol versions 1.5 and 2.0.
1372.Sh SEE ALSO
1373.Xr scp 1 ,
1374.Xr sftp 1 ,
1375.Xr ssh 1 ,
1376.Xr ssh-add 1 ,
1377.Xr ssh-agent 1 ,
1378.Xr ssh-keygen 1 ,
1379.Xr login.conf 5 ,
1380.Xr moduli 5 ,
1381.Xr sftp-server 8
1382.Rs
1383.%A T. Ylonen
1384.%A T. Kivinen
1385.%A M. Saarinen
1386.%A T. Rinne
1387.%A S. Lehtinen
1388.%T "SSH Protocol Architecture"
1389.%N draft-ietf-secsh-architecture-09.txt
1390.%D July 2001
1391.%O work in progress material
1392.Re
1393.Rs
1394.%A M. Friedl
1395.%A N. Provos
1396.%A W. A. Simpson
1397.%T "Diffie-Hellman Group Exchange for the SSH Transport Layer Protocol"
1398.%N draft-ietf-secsh-dh-group-exchange-01.txt
1399.%D April 2001
1400.%O work in progress material
1401.Re
This page took 1.504741 seconds and 5 git commands to generate.