xref: /openbsd-src/usr.bin/ssh/sshd_config.5 (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1.\"
2.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
3.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4.\"                    All rights reserved
5.\"
6.\" As far as I am concerned, the code I have written for this software
7.\" can be used freely for any purpose.  Any derived versions of this
8.\" software must be clearly marked as such, and if the derived work is
9.\" incompatible with the protocol description in the RFC file, it must be
10.\" called by a name other than "ssh" or "Secure Shell".
11.\"
12.\" Copyright (c) 1999,2000 Markus Friedl.  All rights reserved.
13.\" Copyright (c) 1999 Aaron Campbell.  All rights reserved.
14.\" Copyright (c) 1999 Theo de Raadt.  All rights reserved.
15.\"
16.\" Redistribution and use in source and binary forms, with or without
17.\" modification, are permitted provided that the following conditions
18.\" are met:
19.\" 1. Redistributions of source code must retain the above copyright
20.\"    notice, this list of conditions and the following disclaimer.
21.\" 2. Redistributions in binary form must reproduce the above copyright
22.\"    notice, this list of conditions and the following disclaimer in the
23.\"    documentation and/or other materials provided with the distribution.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\"
36.\" $OpenBSD: sshd_config.5,v 1.136 2011/09/09 00:43:00 djm Exp $
37.Dd $Mdocdate: September 9 2011 $
38.Dt SSHD_CONFIG 5
39.Os
40.Sh NAME
41.Nm sshd_config
42.Nd OpenSSH SSH daemon configuration file
43.Sh SYNOPSIS
44.Nm /etc/ssh/sshd_config
45.Sh DESCRIPTION
46.Xr sshd 8
47reads configuration data from
48.Pa /etc/ssh/sshd_config
49(or the file specified with
50.Fl f
51on the command line).
52The file contains keyword-argument pairs, one per line.
53Lines starting with
54.Ql #
55and empty lines are interpreted as comments.
56Arguments may optionally be enclosed in double quotes
57.Pq \&"
58in order to represent arguments containing spaces.
59.Pp
60The possible
61keywords and their meanings are as follows (note that
62keywords are case-insensitive and arguments are case-sensitive):
63.Bl -tag -width Ds
64.It Cm AcceptEnv
65Specifies what environment variables sent by the client will be copied into
66the session's
67.Xr environ 7 .
68See
69.Cm SendEnv
70in
71.Xr ssh_config 5
72for how to configure the client.
73Note that environment passing is only supported for protocol 2.
74Variables are specified by name, which may contain the wildcard characters
75.Ql *
76and
77.Ql \&? .
78Multiple environment variables may be separated by whitespace or spread
79across multiple
80.Cm AcceptEnv
81directives.
82Be warned that some environment variables could be used to bypass restricted
83user environments.
84For this reason, care should be taken in the use of this directive.
85The default is not to accept any environment variables.
86.It Cm AddressFamily
87Specifies which address family should be used by
88.Xr sshd 8 .
89Valid arguments are
90.Dq any ,
91.Dq inet
92(use IPv4 only), or
93.Dq inet6
94(use IPv6 only).
95The default is
96.Dq any .
97.It Cm AllowAgentForwarding
98Specifies whether
99.Xr ssh-agent 1
100forwarding is permitted.
101The default is
102.Dq yes .
103Note that disabling agent forwarding does not improve security
104unless users are also denied shell access, as they can always install
105their own forwarders.
106.It Cm AllowGroups
107This keyword can be followed by a list of group name patterns, separated
108by spaces.
109If specified, login is allowed only for users whose primary
110group or supplementary group list matches one of the patterns.
111Only group names are valid; a numerical group ID is not recognized.
112By default, login is allowed for all groups.
113The allow/deny directives are processed in the following order:
114.Cm DenyUsers ,
115.Cm AllowUsers ,
116.Cm DenyGroups ,
117and finally
118.Cm AllowGroups .
119.Pp
120See
121.Sx PATTERNS
122in
123.Xr ssh_config 5
124for more information on patterns.
125.It Cm AllowTcpForwarding
126Specifies whether TCP forwarding is permitted.
127The default is
128.Dq yes .
129Note that disabling TCP forwarding does not improve security unless
130users are also denied shell access, as they can always install their
131own forwarders.
132.It Cm AllowUsers
133This keyword can be followed by a list of user name patterns, separated
134by spaces.
135If specified, login is allowed only for user names that
136match one of the patterns.
137Only user names are valid; a numerical user ID is not recognized.
138By default, login is allowed for all users.
139If the pattern takes the form USER@HOST then USER and HOST
140are separately checked, restricting logins to particular
141users from particular hosts.
142The allow/deny directives are processed in the following order:
143.Cm DenyUsers ,
144.Cm AllowUsers ,
145.Cm DenyGroups ,
146and finally
147.Cm AllowGroups .
148.Pp
149See
150.Sx PATTERNS
151in
152.Xr ssh_config 5
153for more information on patterns.
154.It Cm AuthorizedKeysFile
155Specifies the file that contains the public keys that can be used
156for user authentication.
157The format is described in the
158.Sx AUTHORIZED_KEYS FILE FORMAT
159section of
160.Xr sshd 8 .
161.Cm AuthorizedKeysFile
162may contain tokens of the form %T which are substituted during connection
163setup.
164The following tokens are defined: %% is replaced by a literal '%',
165%h is replaced by the home directory of the user being authenticated, and
166%u is replaced by the username of that user.
167After expansion,
168.Cm AuthorizedKeysFile
169is taken to be an absolute path or one relative to the user's home
170directory.
171Multiple files may be listed, separated by whitespace.
172The default is
173.Dq .ssh/authorized_keys .ssh/authorized_keys2 .
174.It Cm AuthorizedPrincipalsFile
175Specifies a file that lists principal names that are accepted for
176certificate authentication.
177When using certificates signed by a key listed in
178.Cm TrustedUserCAKeys ,
179this file lists names, one of which must appear in the certificate for it
180to be accepted for authentication.
181Names are listed one per line preceded by key options (as described
182in
183.Sx AUTHORIZED_KEYS FILE FORMAT
184in
185.Xr sshd 8 ) .
186Empty lines and comments starting with
187.Ql #
188are ignored.
189.Pp
190.Cm AuthorizedPrincipalsFile
191may contain tokens of the form %T which are substituted during connection
192setup.
193The following tokens are defined: %% is replaced by a literal '%',
194%h is replaced by the home directory of the user being authenticated, and
195%u is replaced by the username of that user.
196After expansion,
197.Cm AuthorizedPrincipalsFile
198is taken to be an absolute path or one relative to the user's home
199directory.
200.Pp
201The default is not to use a principals file \(en in this case, the username
202of the user must appear in a certificate's principals list for it to be
203accepted.
204Note that
205.Cm AuthorizedPrincipalsFile
206is only used when authentication proceeds using a CA listed in
207.Cm TrustedUserCAKeys
208and is not consulted for certification authorities trusted via
209.Pa ~/.ssh/authorized_keys ,
210though the
211.Cm principals=
212key option offers a similar facility (see
213.Xr sshd 8
214for details).
215.It Cm Banner
216The contents of the specified file are sent to the remote user before
217authentication is allowed.
218If the argument is
219.Dq none
220then no banner is displayed.
221This option is only available for protocol version 2.
222By default, no banner is displayed.
223.It Cm ChallengeResponseAuthentication
224Specifies whether challenge-response authentication is allowed.
225All authentication styles from
226.Xr login.conf 5
227are supported.
228The default is
229.Dq yes .
230.It Cm ChrootDirectory
231Specifies the pathname of a directory to
232.Xr chroot 2
233to after authentication.
234All components of the pathname must be root-owned directories that are
235not writable by any other user or group.
236After the chroot,
237.Xr sshd 8
238changes the working directory to the user's home directory.
239.Pp
240The pathname may contain the following tokens that are expanded at runtime once
241the connecting user has been authenticated: %% is replaced by a literal '%',
242%h is replaced by the home directory of the user being authenticated, and
243%u is replaced by the username of that user.
244.Pp
245The
246.Cm ChrootDirectory
247must contain the necessary files and directories to support the
248user's session.
249For an interactive session this requires at least a shell, typically
250.Xr sh 1 ,
251and basic
252.Pa /dev
253nodes such as
254.Xr null 4 ,
255.Xr zero 4 ,
256.Xr stdin 4 ,
257.Xr stdout 4 ,
258.Xr stderr 4 ,
259.Xr arandom 4
260and
261.Xr tty 4
262devices.
263For file transfer sessions using
264.Dq sftp ,
265no additional configuration of the environment is necessary if the
266in-process sftp server is used,
267though sessions which use logging do require
268.Pa /dev/log
269inside the chroot directory (see
270.Xr sftp-server 8
271for details).
272.Pp
273The default is not to
274.Xr chroot 2 .
275.It Cm Ciphers
276Specifies the ciphers allowed for protocol version 2.
277Multiple ciphers must be comma-separated.
278The supported ciphers are
279.Dq 3des-cbc ,
280.Dq aes128-cbc ,
281.Dq aes192-cbc ,
282.Dq aes256-cbc ,
283.Dq aes128-ctr ,
284.Dq aes192-ctr ,
285.Dq aes256-ctr ,
286.Dq arcfour128 ,
287.Dq arcfour256 ,
288.Dq arcfour ,
289.Dq blowfish-cbc ,
290and
291.Dq cast128-cbc .
292The default is:
293.Bd -literal -offset 3n
294aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
295aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
296aes256-cbc,arcfour
297.Ed
298.It Cm ClientAliveCountMax
299Sets the number of client alive messages (see below) which may be
300sent without
301.Xr sshd 8
302receiving any messages back from the client.
303If this threshold is reached while client alive messages are being sent,
304sshd will disconnect the client, terminating the session.
305It is important to note that the use of client alive messages is very
306different from
307.Cm TCPKeepAlive
308(below).
309The client alive messages are sent through the encrypted channel
310and therefore will not be spoofable.
311The TCP keepalive option enabled by
312.Cm TCPKeepAlive
313is spoofable.
314The client alive mechanism is valuable when the client or
315server depend on knowing when a connection has become inactive.
316.Pp
317The default value is 3.
318If
319.Cm ClientAliveInterval
320(see below) is set to 15, and
321.Cm ClientAliveCountMax
322is left at the default, unresponsive SSH clients
323will be disconnected after approximately 45 seconds.
324This option applies to protocol version 2 only.
325.It Cm ClientAliveInterval
326Sets a timeout interval in seconds after which if no data has been received
327from the client,
328.Xr sshd 8
329will send a message through the encrypted
330channel to request a response from the client.
331The default
332is 0, indicating that these messages will not be sent to the client.
333This option applies to protocol version 2 only.
334.It Cm Compression
335Specifies whether compression is allowed, or delayed until
336the user has authenticated successfully.
337The argument must be
338.Dq yes ,
339.Dq delayed ,
340or
341.Dq no .
342The default is
343.Dq delayed .
344.It Cm DenyGroups
345This keyword can be followed by a list of group name patterns, separated
346by spaces.
347Login is disallowed for users whose primary group or supplementary
348group list matches one of the patterns.
349Only group names are valid; a numerical group ID is not recognized.
350By default, login is allowed for all groups.
351The allow/deny directives are processed in the following order:
352.Cm DenyUsers ,
353.Cm AllowUsers ,
354.Cm DenyGroups ,
355and finally
356.Cm AllowGroups .
357.Pp
358See
359.Sx PATTERNS
360in
361.Xr ssh_config 5
362for more information on patterns.
363.It Cm DenyUsers
364This keyword can be followed by a list of user name patterns, separated
365by spaces.
366Login is disallowed for user names that match one of the patterns.
367Only user names are valid; a numerical user ID is not recognized.
368By default, login is allowed for all users.
369If the pattern takes the form USER@HOST then USER and HOST
370are separately checked, restricting logins to particular
371users from particular hosts.
372The allow/deny directives are processed in the following order:
373.Cm DenyUsers ,
374.Cm AllowUsers ,
375.Cm DenyGroups ,
376and finally
377.Cm AllowGroups .
378.Pp
379See
380.Sx PATTERNS
381in
382.Xr ssh_config 5
383for more information on patterns.
384.It Cm ForceCommand
385Forces the execution of the command specified by
386.Cm ForceCommand ,
387ignoring any command supplied by the client and
388.Pa ~/.ssh/rc
389if present.
390The command is invoked by using the user's login shell with the -c option.
391This applies to shell, command, or subsystem execution.
392It is most useful inside a
393.Cm Match
394block.
395The command originally supplied by the client is available in the
396.Ev SSH_ORIGINAL_COMMAND
397environment variable.
398Specifying a command of
399.Dq internal-sftp
400will force the use of an in-process sftp server that requires no support
401files when used with
402.Cm ChrootDirectory .
403.It Cm GatewayPorts
404Specifies whether remote hosts are allowed to connect to ports
405forwarded for the client.
406By default,
407.Xr sshd 8
408binds remote port forwardings to the loopback address.
409This prevents other remote hosts from connecting to forwarded ports.
410.Cm GatewayPorts
411can be used to specify that sshd
412should allow remote port forwardings to bind to non-loopback addresses, thus
413allowing other hosts to connect.
414The argument may be
415.Dq no
416to force remote port forwardings to be available to the local host only,
417.Dq yes
418to force remote port forwardings to bind to the wildcard address, or
419.Dq clientspecified
420to allow the client to select the address to which the forwarding is bound.
421The default is
422.Dq no .
423.It Cm GSSAPIAuthentication
424Specifies whether user authentication based on GSSAPI is allowed.
425The default is
426.Dq no .
427Note that this option applies to protocol version 2 only.
428.It Cm GSSAPICleanupCredentials
429Specifies whether to automatically destroy the user's credentials cache
430on logout.
431The default is
432.Dq yes .
433Note that this option applies to protocol version 2 only.
434.It Cm HostbasedAuthentication
435Specifies whether rhosts or /etc/hosts.equiv authentication together
436with successful public key client host authentication is allowed
437(host-based authentication).
438This option is similar to
439.Cm RhostsRSAAuthentication
440and applies to protocol version 2 only.
441The default is
442.Dq no .
443.It Cm HostbasedUsesNameFromPacketOnly
444Specifies whether or not the server will attempt to perform a reverse
445name lookup when matching the name in the
446.Pa ~/.shosts ,
447.Pa ~/.rhosts ,
448and
449.Pa /etc/hosts.equiv
450files during
451.Cm HostbasedAuthentication .
452A setting of
453.Dq yes
454means that
455.Xr sshd 8
456uses the name supplied by the client rather than
457attempting to resolve the name from the TCP connection itself.
458The default is
459.Dq no .
460.It Cm HostCertificate
461Specifies a file containing a public host certificate.
462The certificate's public key must match a private host key already specified
463by
464.Cm HostKey .
465The default behaviour of
466.Xr sshd 8
467is not to load any certificates.
468.It Cm HostKey
469Specifies a file containing a private host key
470used by SSH.
471The default is
472.Pa /etc/ssh/ssh_host_key
473for protocol version 1, and
474.Pa /etc/ssh/ssh_host_dsa_key ,
475.Pa /etc/ssh/ssh_host_ecdsa_key
476and
477.Pa /etc/ssh/ssh_host_rsa_key
478for protocol version 2.
479Note that
480.Xr sshd 8
481will refuse to use a file if it is group/world-accessible.
482It is possible to have multiple host key files.
483.Dq rsa1
484keys are used for version 1 and
485.Dq dsa ,
486.Dq ecdsa
487or
488.Dq rsa
489are used for version 2 of the SSH protocol.
490.It Cm IgnoreRhosts
491Specifies that
492.Pa .rhosts
493and
494.Pa .shosts
495files will not be used in
496.Cm RhostsRSAAuthentication
497or
498.Cm HostbasedAuthentication .
499.Pp
500.Pa /etc/hosts.equiv
501and
502.Pa /etc/shosts.equiv
503are still used.
504The default is
505.Dq yes .
506.It Cm IgnoreUserKnownHosts
507Specifies whether
508.Xr sshd 8
509should ignore the user's
510.Pa ~/.ssh/known_hosts
511during
512.Cm RhostsRSAAuthentication
513or
514.Cm HostbasedAuthentication .
515The default is
516.Dq no .
517.It Cm IPQoS
518Specifies the IPv4 type-of-service or DSCP class for the connection.
519Accepted values are
520.Dq af11 ,
521.Dq af12 ,
522.Dq af13 ,
523.Dq af21 ,
524.Dq af22 ,
525.Dq af23 ,
526.Dq af31 ,
527.Dq af32 ,
528.Dq af33 ,
529.Dq af41 ,
530.Dq af42 ,
531.Dq af43 ,
532.Dq cs0 ,
533.Dq cs1 ,
534.Dq cs2 ,
535.Dq cs3 ,
536.Dq cs4 ,
537.Dq cs5 ,
538.Dq cs6 ,
539.Dq cs7 ,
540.Dq ef ,
541.Dq lowdelay ,
542.Dq throughput ,
543.Dq reliability ,
544or a numeric value.
545This option may take one or two arguments, separated by whitespace.
546If one argument is specified, it is used as the packet class unconditionally.
547If two values are specified, the first is automatically selected for
548interactive sessions and the second for non-interactive sessions.
549The default is
550.Dq lowdelay
551for interactive sessions and
552.Dq throughput
553for non-interactive sessions.
554.It Cm KerberosAuthentication
555Specifies whether the password provided by the user for
556.Cm PasswordAuthentication
557will be validated through the Kerberos KDC.
558To use this option, the server needs a
559Kerberos servtab which allows the verification of the KDC's identity.
560The default is
561.Dq no .
562.It Cm KerberosGetAFSToken
563If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
564an AFS token before accessing the user's home directory.
565The default is
566.Dq no .
567.It Cm KerberosOrLocalPasswd
568If password authentication through Kerberos fails then
569the password will be validated via any additional local mechanism
570such as
571.Pa /etc/passwd .
572The default is
573.Dq yes .
574.It Cm KerberosTicketCleanup
575Specifies whether to automatically destroy the user's ticket cache
576file on logout.
577The default is
578.Dq yes .
579.It Cm KexAlgorithms
580Specifies the available KEX (Key Exchange) algorithms.
581Multiple algorithms must be comma-separated.
582The default is
583.Dq ecdh-sha2-nistp256 ,
584.Dq ecdh-sha2-nistp384 ,
585.Dq ecdh-sha2-nistp521 ,
586.Dq diffie-hellman-group-exchange-sha256 ,
587.Dq diffie-hellman-group-exchange-sha1 ,
588.Dq diffie-hellman-group14-sha1 ,
589.Dq diffie-hellman-group1-sha1 .
590.It Cm KeyRegenerationInterval
591In protocol version 1, the ephemeral server key is automatically regenerated
592after this many seconds (if it has been used).
593The purpose of regeneration is to prevent
594decrypting captured sessions by later breaking into the machine and
595stealing the keys.
596The key is never stored anywhere.
597If the value is 0, the key is never regenerated.
598The default is 3600 (seconds).
599.It Cm ListenAddress
600Specifies the local addresses
601.Xr sshd 8
602should listen on.
603The following forms may be used:
604.Pp
605.Bl -item -offset indent -compact
606.It
607.Cm ListenAddress
608.Sm off
609.Ar host No | Ar IPv4_addr No | Ar IPv6_addr
610.Sm on
611.It
612.Cm ListenAddress
613.Sm off
614.Ar host No | Ar IPv4_addr No : Ar port
615.Sm on
616.It
617.Cm ListenAddress
618.Sm off
619.Oo
620.Ar host No | Ar IPv6_addr Oc : Ar port
621.Sm on
622.El
623.Pp
624If
625.Ar port
626is not specified,
627sshd will listen on the address and all prior
628.Cm Port
629options specified.
630The default is to listen on all local addresses.
631Multiple
632.Cm ListenAddress
633options are permitted.
634Additionally, any
635.Cm Port
636options must precede this option for non-port qualified addresses.
637.It Cm LoginGraceTime
638The server disconnects after this time if the user has not
639successfully logged in.
640If the value is 0, there is no time limit.
641The default is 120 seconds.
642.It Cm LogLevel
643Gives the verbosity level that is used when logging messages from
644.Xr sshd 8 .
645The possible values are:
646QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
647The default is INFO.
648DEBUG and DEBUG1 are equivalent.
649DEBUG2 and DEBUG3 each specify higher levels of debugging output.
650Logging with a DEBUG level violates the privacy of users and is not recommended.
651.It Cm MACs
652Specifies the available MAC (message authentication code) algorithms.
653The MAC algorithm is used in protocol version 2
654for data integrity protection.
655Multiple algorithms must be comma-separated.
656The default is:
657.Bd -literal -offset indent
658hmac-md5,hmac-sha1,umac-64@openssh.com,
659hmac-ripemd160,hmac-sha1-96,hmac-md5-96,
660hmac-sha2-256,hmac-sha256-96,hmac-sha2-512,
661hmac-sha2-512-96
662.Ed
663.It Cm Match
664Introduces a conditional block.
665If all of the criteria on the
666.Cm Match
667line are satisfied, the keywords on the following lines override those
668set in the global section of the config file, until either another
669.Cm Match
670line or the end of the file.
671.Pp
672The arguments to
673.Cm Match
674are one or more criteria-pattern pairs.
675The available criteria are
676.Cm User ,
677.Cm Group ,
678.Cm Host ,
679and
680.Cm Address .
681The match patterns may consist of single entries or comma-separated
682lists and may use the wildcard and negation operators described in the
683.Sx PATTERNS
684section of
685.Xr ssh_config 5 .
686.Pp
687The patterns in an
688.Cm Address
689criteria may additionally contain addresses to match in CIDR
690address/masklen format, e.g.\&
691.Dq 192.0.2.0/24
692or
693.Dq 3ffe:ffff::/32 .
694Note that the mask length provided must be consistent with the address -
695it is an error to specify a mask length that is too long for the address
696or one with bits set in this host portion of the address.
697For example,
698.Dq 192.0.2.0/33
699and
700.Dq 192.0.2.0/8
701respectively.
702.Pp
703Only a subset of keywords may be used on the lines following a
704.Cm Match
705keyword.
706Available keywords are
707.Cm AllowAgentForwarding ,
708.Cm AllowTcpForwarding ,
709.Cm AuthorizedKeysFile ,
710.Cm AuthorizedPrincipalsFile ,
711.Cm Banner ,
712.Cm ChrootDirectory ,
713.Cm ForceCommand ,
714.Cm GatewayPorts ,
715.Cm GSSAPIAuthentication ,
716.Cm HostbasedAuthentication ,
717.Cm HostbasedUsesNameFromPacketOnly ,
718.Cm KbdInteractiveAuthentication ,
719.Cm KerberosAuthentication ,
720.Cm MaxAuthTries ,
721.Cm MaxSessions ,
722.Cm PasswordAuthentication ,
723.Cm PermitEmptyPasswords ,
724.Cm PermitOpen ,
725.Cm PermitRootLogin ,
726.Cm PermitTunnel ,
727.Cm PubkeyAuthentication ,
728.Cm RhostsRSAAuthentication ,
729.Cm RSAAuthentication ,
730.Cm X11DisplayOffset ,
731.Cm X11Forwarding
732and
733.Cm X11UseLocalHost .
734.It Cm MaxAuthTries
735Specifies the maximum number of authentication attempts permitted per
736connection.
737Once the number of failures reaches half this value,
738additional failures are logged.
739The default is 6.
740.It Cm MaxSessions
741Specifies the maximum number of open sessions permitted per network connection.
742The default is 10.
743.It Cm MaxStartups
744Specifies the maximum number of concurrent unauthenticated connections to the
745SSH daemon.
746Additional connections will be dropped until authentication succeeds or the
747.Cm LoginGraceTime
748expires for a connection.
749The default is 10.
750.Pp
751Alternatively, random early drop can be enabled by specifying
752the three colon separated values
753.Dq start:rate:full
754(e.g. "10:30:60").
755.Xr sshd 8
756will refuse connection attempts with a probability of
757.Dq rate/100
758(30%)
759if there are currently
760.Dq start
761(10)
762unauthenticated connections.
763The probability increases linearly and all connection attempts
764are refused if the number of unauthenticated connections reaches
765.Dq full
766(60).
767.It Cm PasswordAuthentication
768Specifies whether password authentication is allowed.
769The default is
770.Dq yes .
771.It Cm PermitEmptyPasswords
772When password authentication is allowed, it specifies whether the
773server allows login to accounts with empty password strings.
774The default is
775.Dq no .
776.It Cm PermitOpen
777Specifies the destinations to which TCP port forwarding is permitted.
778The forwarding specification must be one of the following forms:
779.Pp
780.Bl -item -offset indent -compact
781.It
782.Cm PermitOpen
783.Sm off
784.Ar host : port
785.Sm on
786.It
787.Cm PermitOpen
788.Sm off
789.Ar IPv4_addr : port
790.Sm on
791.It
792.Cm PermitOpen
793.Sm off
794.Ar \&[ IPv6_addr \&] : port
795.Sm on
796.El
797.Pp
798Multiple forwards may be specified by separating them with whitespace.
799An argument of
800.Dq any
801can be used to remove all restrictions and permit any forwarding requests.
802By default all port forwarding requests are permitted.
803.It Cm PermitRootLogin
804Specifies whether root can log in using
805.Xr ssh 1 .
806The argument must be
807.Dq yes ,
808.Dq without-password ,
809.Dq forced-commands-only ,
810or
811.Dq no .
812The default is
813.Dq yes .
814.Pp
815If this option is set to
816.Dq without-password ,
817password authentication is disabled for root.
818.Pp
819If this option is set to
820.Dq forced-commands-only ,
821root login with public key authentication will be allowed,
822but only if the
823.Ar command
824option has been specified
825(which may be useful for taking remote backups even if root login is
826normally not allowed).
827All other authentication methods are disabled for root.
828.Pp
829If this option is set to
830.Dq no ,
831root is not allowed to log in.
832.It Cm PermitTunnel
833Specifies whether
834.Xr tun 4
835device forwarding is allowed.
836The argument must be
837.Dq yes ,
838.Dq point-to-point
839(layer 3),
840.Dq ethernet
841(layer 2), or
842.Dq no .
843Specifying
844.Dq yes
845permits both
846.Dq point-to-point
847and
848.Dq ethernet .
849The default is
850.Dq no .
851.It Cm PermitUserEnvironment
852Specifies whether
853.Pa ~/.ssh/environment
854and
855.Cm environment=
856options in
857.Pa ~/.ssh/authorized_keys
858are processed by
859.Xr sshd 8 .
860The default is
861.Dq no .
862Enabling environment processing may enable users to bypass access
863restrictions in some configurations using mechanisms such as
864.Ev LD_PRELOAD .
865.It Cm PidFile
866Specifies the file that contains the process ID of the
867SSH daemon.
868The default is
869.Pa /var/run/sshd.pid .
870.It Cm Port
871Specifies the port number that
872.Xr sshd 8
873listens on.
874The default is 22.
875Multiple options of this type are permitted.
876See also
877.Cm ListenAddress .
878.It Cm PrintLastLog
879Specifies whether
880.Xr sshd 8
881should print the date and time of the last user login when a user logs
882in interactively.
883The default is
884.Dq yes .
885.It Cm PrintMotd
886Specifies whether
887.Xr sshd 8
888should print
889.Pa /etc/motd
890when a user logs in interactively.
891(On some systems it is also printed by the shell,
892.Pa /etc/profile ,
893or equivalent.)
894The default is
895.Dq yes .
896.It Cm Protocol
897Specifies the protocol versions
898.Xr sshd 8
899supports.
900The possible values are
901.Sq 1
902and
903.Sq 2 .
904Multiple versions must be comma-separated.
905The default is
906.Sq 2 .
907Note that the order of the protocol list does not indicate preference,
908because the client selects among multiple protocol versions offered
909by the server.
910Specifying
911.Dq 2,1
912is identical to
913.Dq 1,2 .
914.It Cm PubkeyAuthentication
915Specifies whether public key authentication is allowed.
916The default is
917.Dq yes .
918Note that this option applies to protocol version 2 only.
919.It Cm RevokedKeys
920Specifies a list of revoked public keys.
921Keys listed in this file will be refused for public key authentication.
922Note that if this file is not readable, then public key authentication will
923be refused for all users.
924.It Cm RhostsRSAAuthentication
925Specifies whether rhosts or /etc/hosts.equiv authentication together
926with successful RSA host authentication is allowed.
927The default is
928.Dq no .
929This option applies to protocol version 1 only.
930.It Cm RSAAuthentication
931Specifies whether pure RSA authentication is allowed.
932The default is
933.Dq yes .
934This option applies to protocol version 1 only.
935.It Cm ServerKeyBits
936Defines the number of bits in the ephemeral protocol version 1 server key.
937The minimum value is 512, and the default is 1024.
938.It Cm StrictModes
939Specifies whether
940.Xr sshd 8
941should check file modes and ownership of the
942user's files and home directory before accepting login.
943This is normally desirable because novices sometimes accidentally leave their
944directory or files world-writable.
945The default is
946.Dq yes .
947Note that this does not apply to
948.Cm ChrootDirectory ,
949whose permissions and ownership are checked unconditionally.
950.It Cm Subsystem
951Configures an external subsystem (e.g. file transfer daemon).
952Arguments should be a subsystem name and a command (with optional arguments)
953to execute upon subsystem request.
954.Pp
955The command
956.Xr sftp-server 8
957implements the
958.Dq sftp
959file transfer subsystem.
960.Pp
961Alternately the name
962.Dq internal-sftp
963implements an in-process
964.Dq sftp
965server.
966This may simplify configurations using
967.Cm ChrootDirectory
968to force a different filesystem root on clients.
969.Pp
970By default no subsystems are defined.
971Note that this option applies to protocol version 2 only.
972.It Cm SyslogFacility
973Gives the facility code that is used when logging messages from
974.Xr sshd 8 .
975The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
976LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
977The default is AUTH.
978.It Cm TCPKeepAlive
979Specifies whether the system should send TCP keepalive messages to the
980other side.
981If they are sent, death of the connection or crash of one
982of the machines will be properly noticed.
983However, this means that
984connections will die if the route is down temporarily, and some people
985find it annoying.
986On the other hand, if TCP keepalives are not sent,
987sessions may hang indefinitely on the server, leaving
988.Dq ghost
989users and consuming server resources.
990.Pp
991The default is
992.Dq yes
993(to send TCP keepalive messages), and the server will notice
994if the network goes down or the client host crashes.
995This avoids infinitely hanging sessions.
996.Pp
997To disable TCP keepalive messages, the value should be set to
998.Dq no .
999.It Cm TrustedUserCAKeys
1000Specifies a file containing public keys of certificate authorities that are
1001trusted to sign user certificates for authentication.
1002Keys are listed one per line; empty lines and comments starting with
1003.Ql #
1004are allowed.
1005If a certificate is presented for authentication and has its signing CA key
1006listed in this file, then it may be used for authentication for any user
1007listed in the certificate's principals list.
1008Note that certificates that lack a list of principals will not be permitted
1009for authentication using
1010.Cm TrustedUserCAKeys .
1011For more details on certificates, see the
1012.Sx CERTIFICATES
1013section in
1014.Xr ssh-keygen 1 .
1015.It Cm UseDNS
1016Specifies whether
1017.Xr sshd 8
1018should look up the remote host name and check that
1019the resolved host name for the remote IP address maps back to the
1020very same IP address.
1021The default is
1022.Dq yes .
1023.It Cm UseLogin
1024Specifies whether
1025.Xr login 1
1026is used for interactive login sessions.
1027The default is
1028.Dq no .
1029Note that
1030.Xr login 1
1031is never used for remote command execution.
1032Note also, that if this is enabled,
1033.Cm X11Forwarding
1034will be disabled because
1035.Xr login 1
1036does not know how to handle
1037.Xr xauth 1
1038cookies.
1039If
1040.Cm UsePrivilegeSeparation
1041is specified, it will be disabled after authentication.
1042.It Cm UsePrivilegeSeparation
1043Specifies whether
1044.Xr sshd 8
1045separates privileges by creating an unprivileged child process
1046to deal with incoming network traffic.
1047After successful authentication, another process will be created that has
1048the privilege of the authenticated user.
1049The goal of privilege separation is to prevent privilege
1050escalation by containing any corruption within the unprivileged processes.
1051The default is
1052.Dq yes .
1053If
1054.Cm UsePrivilegeSeparation
1055is set to
1056.Dq sandbox
1057then the pre-authentication unprivileged process is subject to additional
1058restrictions.
1059.It Cm X11DisplayOffset
1060Specifies the first display number available for
1061.Xr sshd 8 Ns 's
1062X11 forwarding.
1063This prevents sshd from interfering with real X11 servers.
1064The default is 10.
1065.It Cm X11Forwarding
1066Specifies whether X11 forwarding is permitted.
1067The argument must be
1068.Dq yes
1069or
1070.Dq no .
1071The default is
1072.Dq no .
1073.Pp
1074When X11 forwarding is enabled, there may be additional exposure to
1075the server and to client displays if the
1076.Xr sshd 8
1077proxy display is configured to listen on the wildcard address (see
1078.Cm X11UseLocalhost
1079below), though this is not the default.
1080Additionally, the authentication spoofing and authentication data
1081verification and substitution occur on the client side.
1082The security risk of using X11 forwarding is that the client's X11
1083display server may be exposed to attack when the SSH client requests
1084forwarding (see the warnings for
1085.Cm ForwardX11
1086in
1087.Xr ssh_config 5 ) .
1088A system administrator may have a stance in which they want to
1089protect clients that may expose themselves to attack by unwittingly
1090requesting X11 forwarding, which can warrant a
1091.Dq no
1092setting.
1093.Pp
1094Note that disabling X11 forwarding does not prevent users from
1095forwarding X11 traffic, as users can always install their own forwarders.
1096X11 forwarding is automatically disabled if
1097.Cm UseLogin
1098is enabled.
1099.It Cm X11UseLocalhost
1100Specifies whether
1101.Xr sshd 8
1102should bind the X11 forwarding server to the loopback address or to
1103the wildcard address.
1104By default,
1105sshd binds the forwarding server to the loopback address and sets the
1106hostname part of the
1107.Ev DISPLAY
1108environment variable to
1109.Dq localhost .
1110This prevents remote hosts from connecting to the proxy display.
1111However, some older X11 clients may not function with this
1112configuration.
1113.Cm X11UseLocalhost
1114may be set to
1115.Dq no
1116to specify that the forwarding server should be bound to the wildcard
1117address.
1118The argument must be
1119.Dq yes
1120or
1121.Dq no .
1122The default is
1123.Dq yes .
1124.It Cm XAuthLocation
1125Specifies the full pathname of the
1126.Xr xauth 1
1127program.
1128The default is
1129.Pa /usr/X11R6/bin/xauth .
1130.El
1131.Sh TIME FORMATS
1132.Xr sshd 8
1133command-line arguments and configuration file options that specify time
1134may be expressed using a sequence of the form:
1135.Sm off
1136.Ar time Op Ar qualifier ,
1137.Sm on
1138where
1139.Ar time
1140is a positive integer value and
1141.Ar qualifier
1142is one of the following:
1143.Pp
1144.Bl -tag -width Ds -compact -offset indent
1145.It Aq Cm none
1146seconds
1147.It Cm s | Cm S
1148seconds
1149.It Cm m | Cm M
1150minutes
1151.It Cm h | Cm H
1152hours
1153.It Cm d | Cm D
1154days
1155.It Cm w | Cm W
1156weeks
1157.El
1158.Pp
1159Each member of the sequence is added together to calculate
1160the total time value.
1161.Pp
1162Time format examples:
1163.Pp
1164.Bl -tag -width Ds -compact -offset indent
1165.It 600
1166600 seconds (10 minutes)
1167.It 10m
116810 minutes
1169.It 1h30m
11701 hour 30 minutes (90 minutes)
1171.El
1172.Sh FILES
1173.Bl -tag -width Ds
1174.It Pa /etc/ssh/sshd_config
1175Contains configuration data for
1176.Xr sshd 8 .
1177This file should be writable by root only, but it is recommended
1178(though not necessary) that it be world-readable.
1179.El
1180.Sh SEE ALSO
1181.Xr sshd 8
1182.Sh AUTHORS
1183OpenSSH is a derivative of the original and free
1184ssh 1.2.12 release by Tatu Ylonen.
1185Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1186Theo de Raadt and Dug Song
1187removed many bugs, re-added newer features and
1188created OpenSSH.
1189Markus Friedl contributed the support for SSH
1190protocol versions 1.5 and 2.0.
1191Niels Provos and Markus Friedl contributed support
1192for privilege separation.
1193