xref: /freebsd/crypto/openssh/sshd_config.5 (revision 09e8dea79366f1e5b3a73e8a271b26e4b6bf2e6a)
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.\"
37.\" $OpenBSD: sshd_config.5,v 1.3 2002/06/20 23:37:12 markus Exp $
38.\" $FreeBSD$
39.Dd September 25, 1999
40.Dt SSHD_CONFIG 5
41.Os
42.Sh NAME
43.Nm sshd_config
44.Nd OpenSSH SSH daemon configuration file
45.Sh SYNOPSIS
46.Bl -tag -width Ds -compact
47.It Pa /etc/ssh/sshd_config
48.El
49.Sh DESCRIPTION
50.Nm sshd
51reads configuration data from
52.Pa /etc/ssh/sshd_config
53(or the file specified with
54.Fl f
55on the command line).
56The file contains keyword-argument pairs, one per line.
57Lines starting with
58.Ql #
59and empty lines are interpreted as comments.
60.Pp
61The possible
62keywords and their meanings are as follows (note that
63keywords are case-insensitive and arguments are case-sensitive):
64.Bl -tag -width Ds
65.It Cm AFSTokenPassing
66Specifies whether an AFS token may be forwarded to the server.
67Default is
68.Dq no .
69.It Cm AllowGroups
70This keyword can be followed by a list of group name patterns, separated
71by spaces.
72If specified, login is allowed only for users whose primary
73group or supplementary group list matches one of the patterns.
74.Ql \&*
75and
76.Ql ?
77can be used as
78wildcards in the patterns.
79Only group names are valid; a numerical group ID is not recognized.
80By default, login is allowed for all groups.
81.Pp
82.It Cm AllowTcpForwarding
83Specifies whether TCP forwarding is permitted.
84The default is
85.Dq yes .
86Note that disabling TCP forwarding does not improve security unless
87users are also denied shell access, as they can always install their
88own forwarders.
89.Pp
90.It Cm AllowUsers
91This keyword can be followed by a list of user name patterns, separated
92by spaces.
93If specified, login is allowed only for users names that
94match one of the patterns.
95.Ql \&*
96and
97.Ql ?
98can be used as
99wildcards in the patterns.
100Only user names are valid; a numerical user ID is not recognized.
101By default, login is allowed for all users.
102If the pattern takes the form USER@HOST then USER and HOST
103are separately checked, restricting logins to particular
104users from particular hosts.
105.Pp
106.It Cm AuthorizedKeysFile
107Specifies the file that contains the public keys that can be used
108for user authentication.
109.Cm AuthorizedKeysFile
110may contain tokens of the form %T which are substituted during connection
111set-up. The following tokens are defined: %% is replaced by a literal '%',
112%h is replaced by the home directory of the user being authenticated and
113%u is replaced by the username of that user.
114After expansion,
115.Cm AuthorizedKeysFile
116is taken to be an absolute path or one relative to the user's home
117directory.
118The default is
119.Dq .ssh/authorized_keys .
120.It Cm Banner
121In some jurisdictions, sending a warning message before authentication
122may be relevant for getting legal protection.
123The contents of the specified file are sent to the remote user before
124authentication is allowed.
125This option is only available for protocol version 2.
126By default, no banner is displayed.
127.Pp
128.It Cm ChallengeResponseAuthentication
129Specifies whether challenge response authentication is allowed.
130All authentication styles from
131.Xr login.conf 5
132are supported.
133The default is
134.Dq yes .
135Note that OPIE authentication is enabled only if
136.Cm PasswordAuthentication
137is allowed, too.
138.It Cm Ciphers
139Specifies the ciphers allowed for protocol version 2.
140Multiple ciphers must be comma-separated.
141The default is
142.Pp
143.Bd -literal
144  ``aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,
145    aes192-cbc,aes256-cbc''
146.Ed
147.It Cm CheckMail
148Specifies whether
149.Nm
150should notify the user of new mail for interactive logins.
151The default is
152.Dq yes .
153.It Cm ClientAliveInterval
154Sets a timeout interval in seconds after which if no data has been received
155from the client,
156.Nm sshd
157will send a message through the encrypted
158channel to request a response from the client.
159The default
160is 0, indicating that these messages will not be sent to the client.
161This option applies to protocol version 2 only.
162.It Cm ClientAliveCountMax
163Sets the number of client alive messages (see above) which may be
164sent without
165.Nm sshd
166receiving any messages back from the client. If this threshold is
167reached while client alive messages are being sent,
168.Nm sshd
169will disconnect the client, terminating the session. It is important
170to note that the use of client alive messages is very different from
171.Cm KeepAlive
172(below). The client alive messages are sent through the
173encrypted channel and therefore will not be spoofable. The TCP keepalive
174option enabled by
175.Cm KeepAlive
176is spoofable. The client alive mechanism is valuable when the client or
177server depend on knowing when a connection has become inactive.
178.Pp
179The default value is 3. If
180.Cm ClientAliveInterval
181(above) is set to 15, and
182.Cm ClientAliveCountMax
183is left at the default, unresponsive ssh clients
184will be disconnected after approximately 45 seconds.
185.It Cm Compression
186Specifies whether compression is allowed.
187The argument must be
188.Dq yes
189or
190.Dq no .
191The default is
192.Dq yes .
193.It Cm DenyGroups
194This keyword can be followed by a list of group name patterns, separated
195by spaces.
196Login is disallowed for users whose primary group or supplementary
197group list matches one of the patterns.
198.Ql \&*
199and
200.Ql ?
201can be used as
202wildcards in the patterns.
203Only group names are valid; a numerical group ID is not recognized.
204By default, login is allowed for all groups.
205.Pp
206.It Cm DenyUsers
207This keyword can be followed by a list of user name patterns, separated
208by spaces.
209Login is disallowed for user names that match one of the patterns.
210.Ql \&*
211and
212.Ql ?
213can be used as wildcards in the patterns.
214Only user names are valid; a numerical user ID is not recognized.
215By default, login is allowed for all users.
216If the pattern takes the form USER@HOST then USER and HOST
217are separately checked, restricting logins to particular
218users from particular hosts.
219.It Cm GatewayPorts
220Specifies whether remote hosts are allowed to connect to ports
221forwarded for the client.
222By default,
223.Nm sshd
224binds remote port forwardings to the loopback address.  This
225prevents other remote hosts from connecting to forwarded ports.
226.Cm GatewayPorts
227can be used to specify that
228.Nm sshd
229should bind remote port forwardings to the wildcard address,
230thus allowing remote hosts to connect to forwarded ports.
231The argument must be
232.Dq yes
233or
234.Dq no .
235The default is
236.Dq no .
237.It Cm HostbasedAuthentication
238Specifies whether rhosts or /etc/hosts.equiv authentication together
239with successful public key client host authentication is allowed
240(hostbased authentication).
241This option is similar to
242.Cm RhostsRSAAuthentication
243and applies to protocol version 2 only.
244The default is
245.Dq no .
246.It Cm HostKey
247Specifies a file containing a private host key
248used by SSH.
249The default is
250.Pa /etc/ssh/ssh_host_key
251for protocol version 1, and
252.Pa /etc/ssh/ssh_host_rsa_key
253and
254.Pa /etc/ssh/ssh_host_dsa_key
255for protocol version 2.
256Note that
257.Nm sshd
258will refuse to use a file if it is group/world-accessible.
259It is possible to have multiple host key files.
260.Dq rsa1
261keys are used for version 1 and
262.Dq dsa
263or
264.Dq rsa
265are used for version 2 of the SSH protocol.
266.It Cm IgnoreRhosts
267Specifies that
268.Pa .rhosts
269and
270.Pa .shosts
271files will not be used in
272.Cm RhostsAuthentication ,
273.Cm RhostsRSAAuthentication
274or
275.Cm HostbasedAuthentication .
276.Pp
277.Pa /etc/hosts.equiv
278and
279.Pa /etc/ssh/shosts.equiv
280are still used.
281The default is
282.Dq yes .
283.It Cm IgnoreUserKnownHosts
284Specifies whether
285.Nm sshd
286should ignore the user's
287.Pa $HOME/.ssh/known_hosts
288during
289.Cm RhostsRSAAuthentication
290or
291.Cm HostbasedAuthentication .
292The default is
293.Dq no .
294.It Cm KeepAlive
295Specifies whether the system should send TCP keepalive messages to the
296other side.
297If they are sent, death of the connection or crash of one
298of the machines will be properly noticed.
299However, this means that
300connections will die if the route is down temporarily, and some people
301find it annoying.
302On the other hand, if keepalives are not sent,
303sessions may hang indefinitely on the server, leaving
304.Dq ghost
305users and consuming server resources.
306.Pp
307The default is
308.Dq yes
309(to send keepalives), and the server will notice
310if the network goes down or the client host crashes.
311This avoids infinitely hanging sessions.
312.Pp
313To disable keepalives, the value should be set to
314.Dq no .
315.It Cm KerberosAuthentication
316Specifies whether Kerberos authentication is allowed.
317This can be in the form of a Kerberos ticket, or if
318.Cm PasswordAuthentication
319is yes, the password provided by the user will be validated through
320the Kerberos KDC.
321To use this option, the server needs a
322Kerberos servtab which allows the verification of the KDC's identity.
323Default is
324.Dq no .
325.It Cm KerberosOrLocalPasswd
326If set then if password authentication through Kerberos fails then
327the password will be validated via any additional local mechanism
328such as
329.Pa /etc/passwd .
330Default is
331.Dq yes .
332.It Cm KerberosTgtPassing
333Specifies whether a Kerberos TGT may be forwarded to the server.
334Default is
335.Dq no ,
336as this only works when the Kerberos KDC is actually an AFS kaserver.
337.It Cm KerberosTicketCleanup
338Specifies whether to automatically destroy the user's ticket cache
339file on logout.
340Default is
341.Dq yes .
342.It Cm KeyRegenerationInterval
343In protocol version 1, the ephemeral server key is automatically regenerated
344after this many seconds (if it has been used).
345The purpose of regeneration is to prevent
346decrypting captured sessions by later breaking into the machine and
347stealing the keys.
348The key is never stored anywhere.
349If the value is 0, the key is never regenerated.
350The default is 3600 (seconds).
351.It Cm ListenAddress
352Specifies the local addresses
353.Nm sshd
354should listen on.
355The following forms may be used:
356.Pp
357.Bl -item -offset indent -compact
358.It
359.Cm ListenAddress
360.Sm off
361.Ar host No | Ar IPv4_addr No | Ar IPv6_addr
362.Sm on
363.It
364.Cm ListenAddress
365.Sm off
366.Ar host No | Ar IPv4_addr No : Ar port
367.Sm on
368.It
369.Cm ListenAddress
370.Sm off
371.Oo
372.Ar host No | Ar IPv6_addr Oc : Ar port
373.Sm on
374.El
375.Pp
376If
377.Ar port
378is not specified,
379.Nm sshd
380will listen on the address and all prior
381.Cm Port
382options specified. The default is to listen on all local
383addresses.  Multiple
384.Cm ListenAddress
385options are permitted. Additionally, any
386.Cm Port
387options must precede this option for non port qualified addresses.
388.It Cm LoginGraceTime
389The server disconnects after this time if the user has not
390successfully logged in.
391If the value is 0, there is no time limit.
392The default is 120 (seconds).
393.It Cm LogLevel
394Gives the verbosity level that is used when logging messages from
395.Nm sshd .
396The possible values are:
397QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2 and DEBUG3.
398The default is INFO.  DEBUG and DEBUG1 are equivalent.  DEBUG2
399and DEBUG3 each specify higher levels of debugging output.
400Logging with a DEBUG level violates the privacy of users
401and is not recommended.
402.It Cm MACs
403Specifies the available MAC (message authentication code) algorithms.
404The MAC algorithm is used in protocol version 2
405for data integrity protection.
406Multiple algorithms must be comma-separated.
407The default is
408.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
409.It Cm MaxStartups
410Specifies the maximum number of concurrent unauthenticated connections to the
411.Nm sshd
412daemon.
413Additional connections will be dropped until authentication succeeds or the
414.Cm LoginGraceTime
415expires for a connection.
416The default is 10.
417.Pp
418Alternatively, random early drop can be enabled by specifying
419the three colon separated values
420.Dq start:rate:full
421(e.g., "10:30:60").
422.Nm sshd
423will refuse connection attempts with a probability of
424.Dq rate/100
425(30%)
426if there are currently
427.Dq start
428(10)
429unauthenticated connections.
430The probability increases linearly and all connection attempts
431are refused if the number of unauthenticated connections reaches
432.Dq full
433(60).
434.It Cm PasswordAuthentication
435Specifies whether password authentication is allowed.
436The default is
437.Dq yes .
438.It Cm PermitEmptyPasswords
439When password authentication is allowed, it specifies whether the
440server allows login to accounts with empty password strings.
441The default is
442.Dq no .
443.It Cm PermitRootLogin
444Specifies whether root can login using
445.Xr ssh 1 .
446The argument must be
447.Dq yes ,
448.Dq without-password ,
449.Dq forced-commands-only
450or
451.Dq no .
452The default is
453.Dq no .
454.Pp
455If this option is set to
456.Dq without-password
457password authentication is disabled for root.
458.Pp
459If this option is set to
460.Dq forced-commands-only
461root login with public key authentication will be allowed,
462but only if the
463.Ar command
464option has been specified
465(which may be useful for taking remote backups even if root login is
466normally not allowed). All other authentication methods are disabled
467for root.
468.Pp
469If this option is set to
470.Dq no
471root is not allowed to login.
472.It Cm PidFile
473Specifies the file that contains the process identifier of the
474.Nm sshd
475daemon.
476The default is
477.Pa /var/run/sshd.pid .
478.It Cm Port
479Specifies the port number that
480.Nm sshd
481listens on.
482The default is 22.
483Multiple options of this type are permitted.
484See also
485.Cm ListenAddress .
486.It Cm PrintLastLog
487Specifies whether
488.Nm sshd
489should print the date and time when the user last logged in.
490The default is
491.Dq yes .
492.It Cm PrintMotd
493Specifies whether
494.Nm sshd
495should print
496.Pa /etc/motd
497when a user logs in interactively.
498(On some systems it is also printed by the shell,
499.Pa /etc/profile ,
500or equivalent.)
501The default is
502.Dq yes .
503.It Cm Protocol
504Specifies the protocol versions
505.Nm sshd
506should support.
507The possible values are
508.Dq 1
509and
510.Dq 2 .
511Multiple versions must be comma-separated.
512The default is
513.Dq 2,1 .
514.It Cm PubkeyAuthentication
515Specifies whether public key authentication is allowed.
516The default is
517.Dq yes .
518Note that this option applies to protocol version 2 only.
519.It Cm RhostsAuthentication
520Specifies whether authentication using rhosts or
521.Pa /etc/hosts.equiv
522files is sufficient.
523Normally, this method should not be permitted because it is insecure.
524.Cm RhostsRSAAuthentication
525should be used
526instead, because it performs RSA-based host authentication in addition
527to normal rhosts or
528.Pa /etc/hosts.equiv
529authentication.
530The default is
531.Dq no .
532This option applies to protocol version 1 only.
533.It Cm RhostsRSAAuthentication
534Specifies whether rhosts or
535.Pa /etc/hosts.equiv
536authentication together
537with successful RSA host authentication is allowed.
538The default is
539.Dq no .
540This option applies to protocol version 1 only.
541.It Cm RSAAuthentication
542Specifies whether pure RSA authentication is allowed.
543The default is
544.Dq yes .
545This option applies to protocol version 1 only.
546.It Cm ServerKeyBits
547Defines the number of bits in the ephemeral protocol version 1 server key.
548The minimum value is 512, and the default is 768.
549.It Cm SkeyAuthentication
550Backward-compatibility alias for
551.Cm ChallengeResponseAuthentication .
552.It Cm StrictModes
553Specifies whether
554.Nm sshd
555should check file modes and ownership of the
556user's files and home directory before accepting login.
557This is normally desirable because novices sometimes accidentally leave their
558directory or files world-writable.
559The default is
560.Dq yes .
561.It Cm Subsystem
562Configures an external subsystem (e.g., file transfer daemon).
563Arguments should be a subsystem name and a command to execute upon subsystem
564request.
565The command
566.Xr sftp-server 8
567implements the
568.Dq sftp
569file transfer subsystem.
570By default no subsystems are defined.
571Note that this option applies to protocol version 2 only.
572.It Cm SyslogFacility
573Gives the facility code that is used when logging messages from
574.Nm sshd .
575The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
576LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
577The default is AUTH.
578.It Cm UseLogin
579Specifies whether
580.Xr login 1
581is used for interactive login sessions.
582The default is
583.Dq no .
584Note that
585.Xr login 1
586is never used for remote command execution.
587Note also, that if this is enabled,
588.Cm X11Forwarding
589will be disabled because
590.Xr login 1
591does not know how to handle
592.Xr xauth 1
593cookies.  If
594.Cm UsePrivilegeSeparation
595is specified, it will be disabled after authentication.
596.It Cm UsePrivilegeSeparation
597Specifies whether
598.Nm sshd
599separates privileges by creating an unprivileged child process
600to deal with incoming network traffic.  After successful authentication,
601another process will be created that has the privilege of the authenticated
602user.  The goal of privilege separation is to prevent privilege
603escalation by containing any corruption within the unprivileged processes.
604The default is
605.Dq yes .
606.It Cm VerifyReverseMapping
607Specifies whether
608.Nm sshd
609should try to verify the remote host name and check that
610the resolved host name for the remote IP address maps back to the
611very same IP address.
612The default is
613.Dq no .
614.It Cm VersionAddendum
615Specifies a string to append to the regular version string to identify
616OS- or site-specific modifications.
617.It Cm X11DisplayOffset
618Specifies the first display number available for
619.Nm sshd Ns 's
620X11 forwarding.
621This prevents
622.Nm sshd
623from interfering with real X11 servers.
624The default is 10.
625.It Cm X11Forwarding
626Specifies whether X11 forwarding is permitted.
627The default is
628.Dq no .
629Note that disabling X11 forwarding does not improve security in any
630way, as users can always install their own forwarders.
631X11 forwarding is automatically disabled if
632.Cm UseLogin
633is enabled.
634.It Cm X11UseLocalhost
635Specifies whether
636.Nm sshd
637should bind the X11 forwarding server to the loopback address or to
638the wildcard address.  By default,
639.Nm sshd
640binds the forwarding server to the loopback address and sets the
641hostname part of the
642.Ev DISPLAY
643environment variable to
644.Dq localhost .
645This prevents remote hosts from connecting to the fake display.
646However, some older X11 clients may not function with this
647configuration.
648.Cm X11UseLocalhost
649may be set to
650.Dq no
651to specify that the forwarding server should be bound to the wildcard
652address.
653The argument must be
654.Dq yes
655or
656.Dq no .
657The default is
658.Dq yes .
659.It Cm XAuthLocation
660Specifies the location of the
661.Xr xauth 1
662program.
663The default is
664.Pa /usr/X11R6/bin/xauth .
665.El
666.Ss Time Formats
667.Pp
668.Nm sshd
669command-line arguments and configuration file options that specify time
670may be expressed using a sequence of the form:
671.Sm off
672.Ar time Oo Ar qualifier Oc ,
673.Sm on
674where
675.Ar time
676is a positive integer value and
677.Ar qualifier
678is one of the following:
679.Pp
680.Bl -tag -width Ds -compact -offset indent
681.It Cm <none>
682seconds
683.It Cm s | Cm S
684seconds
685.It Cm m | Cm M
686minutes
687.It Cm h | Cm H
688hours
689.It Cm d | Cm D
690days
691.It Cm w | Cm W
692weeks
693.El
694.Pp
695Each member of the sequence is added together to calculate
696the total time value.
697.Pp
698Time format examples:
699.Pp
700.Bl -tag -width Ds -compact -offset indent
701.It 600
702600 seconds (10 minutes)
703.It 10m
70410 minutes
705.It 1h30m
7061 hour 30 minutes (90 minutes)
707.El
708.Sh FILES
709.Bl -tag -width Ds
710.It Pa /etc/ssh/sshd_config
711Contains configuration data for
712.Nm sshd .
713This file should be writable by root only, but it is recommended
714(though not necessary) that it be world-readable.
715.El
716.Sh AUTHORS
717OpenSSH is a derivative of the original and free
718ssh 1.2.12 release by Tatu Ylonen.
719Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
720Theo de Raadt and Dug Song
721removed many bugs, re-added newer features and
722created OpenSSH.
723Markus Friedl contributed the support for SSH
724protocol versions 1.5 and 2.0.
725Niels Provos and Markus Friedl contributed support
726for privilege separation.
727.Sh SEE ALSO
728.Xr sshd 8
729