xref: /openbsd/usr.bin/ssh/sshd_config.5 (revision 274d7c50)
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.294 2019/11/26 22:42:26 jmc Exp $
37.Dd $Mdocdate: November 26 2019 $
38.Dt SSHD_CONFIG 5
39.Os
40.Sh NAME
41.Nm sshd_config
42.Nd OpenSSH SSH daemon configuration file
43.Sh DESCRIPTION
44.Xr sshd 8
45reads configuration data from
46.Pa /etc/ssh/sshd_config
47(or the file specified with
48.Fl f
49on the command line).
50The file contains keyword-argument pairs, one per line.
51For each keyword, the first obtained value will be used.
52Lines starting with
53.Ql #
54and empty lines are interpreted as comments.
55Arguments may optionally be enclosed in double quotes
56.Pq \&"
57in order to represent arguments containing spaces.
58.Pp
59The possible
60keywords and their meanings are as follows (note that
61keywords are case-insensitive and arguments are case-sensitive):
62.Bl -tag -width Ds
63.It Cm AcceptEnv
64Specifies what environment variables sent by the client will be copied into
65the session's
66.Xr environ 7 .
67See
68.Cm SendEnv
69and
70.Cm SetEnv
71in
72.Xr ssh_config 5
73for how to configure the client.
74The
75.Ev TERM
76environment variable is always accepted whenever the client
77requests a pseudo-terminal as it is required by the protocol.
78Variables are specified by name, which may contain the wildcard characters
79.Ql *
80and
81.Ql \&? .
82Multiple environment variables may be separated by whitespace or spread
83across multiple
84.Cm AcceptEnv
85directives.
86Be warned that some environment variables could be used to bypass restricted
87user environments.
88For this reason, care should be taken in the use of this directive.
89The default is not to accept any environment variables.
90.It Cm AddressFamily
91Specifies which address family should be used by
92.Xr sshd 8 .
93Valid arguments are
94.Cm any
95(the default),
96.Cm inet
97(use IPv4 only), or
98.Cm inet6
99(use IPv6 only).
100.It Cm AllowAgentForwarding
101Specifies whether
102.Xr ssh-agent 1
103forwarding is permitted.
104The default is
105.Cm yes .
106Note that disabling agent forwarding does not improve security
107unless users are also denied shell access, as they can always install
108their own forwarders.
109.It Cm AllowGroups
110This keyword can be followed by a list of group name patterns, separated
111by spaces.
112If specified, login is allowed only for users whose primary
113group or supplementary group list matches one of the patterns.
114Only group names are valid; a numerical group ID is not recognized.
115By default, login is allowed for all groups.
116The allow/deny directives are processed in the following order:
117.Cm DenyUsers ,
118.Cm AllowUsers ,
119.Cm DenyGroups ,
120and finally
121.Cm AllowGroups .
122.Pp
123See PATTERNS in
124.Xr ssh_config 5
125for more information on patterns.
126.It Cm AllowStreamLocalForwarding
127Specifies whether StreamLocal (Unix-domain socket) forwarding is permitted.
128The available options are
129.Cm yes
130(the default)
131or
132.Cm all
133to allow StreamLocal forwarding,
134.Cm no
135to prevent all StreamLocal forwarding,
136.Cm local
137to allow local (from the perspective of
138.Xr ssh 1 )
139forwarding only or
140.Cm remote
141to allow remote forwarding only.
142Note that disabling StreamLocal forwarding does not improve security unless
143users are also denied shell access, as they can always install their
144own forwarders.
145.It Cm AllowTcpForwarding
146Specifies whether TCP forwarding is permitted.
147The available options are
148.Cm yes
149(the default)
150or
151.Cm all
152to allow TCP forwarding,
153.Cm no
154to prevent all TCP forwarding,
155.Cm local
156to allow local (from the perspective of
157.Xr ssh 1 )
158forwarding only or
159.Cm remote
160to allow remote forwarding only.
161Note that disabling TCP forwarding does not improve security unless
162users are also denied shell access, as they can always install their
163own forwarders.
164.It Cm AllowUsers
165This keyword can be followed by a list of user name patterns, separated
166by spaces.
167If specified, login is allowed only for user names that
168match one of the patterns.
169Only user names are valid; a numerical user ID is not recognized.
170By default, login is allowed for all users.
171If the pattern takes the form USER@HOST then USER and HOST
172are separately checked, restricting logins to particular
173users from particular hosts.
174HOST criteria may additionally contain addresses to match in CIDR
175address/masklen format.
176The allow/deny directives are processed in the following order:
177.Cm DenyUsers ,
178.Cm AllowUsers ,
179.Cm DenyGroups ,
180and finally
181.Cm AllowGroups .
182.Pp
183See PATTERNS in
184.Xr ssh_config 5
185for more information on patterns.
186.It Cm AuthenticationMethods
187Specifies the authentication methods that must be successfully completed
188for a user to be granted access.
189This option must be followed by one or more lists of comma-separated
190authentication method names, or by the single string
191.Cm any
192to indicate the default behaviour of accepting any single authentication
193method.
194If the default is overridden, then successful authentication requires
195completion of every method in at least one of these lists.
196.Pp
197For example,
198.Qq publickey,password publickey,keyboard-interactive
199would require the user to complete public key authentication, followed by
200either password or keyboard interactive authentication.
201Only methods that are next in one or more lists are offered at each stage,
202so for this example it would not be possible to attempt password or
203keyboard-interactive authentication before public key.
204.Pp
205For keyboard interactive authentication it is also possible to
206restrict authentication to a specific device by appending a
207colon followed by the device identifier
208.Cm bsdauth ,
209.Cm pam ,
210or
211.Cm skey ,
212depending on the server configuration.
213For example,
214.Qq keyboard-interactive:bsdauth
215would restrict keyboard interactive authentication to the
216.Cm bsdauth
217device.
218.Pp
219If the publickey method is listed more than once,
220.Xr sshd 8
221verifies that keys that have been used successfully are not reused for
222subsequent authentications.
223For example,
224.Qq publickey,publickey
225requires successful authentication using two different public keys.
226.Pp
227Note that each authentication method listed should also be explicitly enabled
228in the configuration.
229.Pp
230The available authentication methods are:
231.Qq gssapi-with-mic ,
232.Qq hostbased ,
233.Qq keyboard-interactive ,
234.Qq none
235(used for access to password-less accounts when
236.Cm PermitEmptyPasswords
237is enabled),
238.Qq password
239and
240.Qq publickey .
241.It Cm AuthorizedKeysCommand
242Specifies a program to be used to look up the user's public keys.
243The program must be owned by root, not writable by group or others and
244specified by an absolute path.
245Arguments to
246.Cm AuthorizedKeysCommand
247accept the tokens described in the
248.Sx TOKENS
249section.
250If no arguments are specified then the username of the target user is used.
251.Pp
252The program should produce on standard output zero or
253more lines of authorized_keys output (see
254.Sx AUTHORIZED_KEYS
255in
256.Xr sshd 8 ) .
257If a key supplied by
258.Cm AuthorizedKeysCommand
259does not successfully authenticate
260and authorize the user then public key authentication continues using the usual
261.Cm AuthorizedKeysFile
262files.
263By default, no
264.Cm AuthorizedKeysCommand
265is run.
266.It Cm AuthorizedKeysCommandUser
267Specifies the user under whose account the
268.Cm AuthorizedKeysCommand
269is run.
270It is recommended to use a dedicated user that has no other role on the host
271than running authorized keys commands.
272If
273.Cm AuthorizedKeysCommand
274is specified but
275.Cm AuthorizedKeysCommandUser
276is not, then
277.Xr sshd 8
278will refuse to start.
279.It Cm AuthorizedKeysFile
280Specifies the file that contains the public keys used for user authentication.
281The format is described in the AUTHORIZED_KEYS FILE FORMAT section of
282.Xr sshd 8 .
283Arguments to
284.Cm AuthorizedKeysFile
285accept the tokens described in the
286.Sx TOKENS
287section.
288After expansion,
289.Cm AuthorizedKeysFile
290is taken to be an absolute path or one relative to the user's home
291directory.
292Multiple files may be listed, separated by whitespace.
293Alternately this option may be set to
294.Cm none
295to skip checking for user keys in files.
296The default is
297.Qq .ssh/authorized_keys .ssh/authorized_keys2 .
298.It Cm AuthorizedPrincipalsCommand
299Specifies a program to be used to generate the list of allowed
300certificate principals as per
301.Cm AuthorizedPrincipalsFile .
302The program must be owned by root, not writable by group or others and
303specified by an absolute path.
304Arguments to
305.Cm AuthorizedPrincipalsCommand
306accept the tokens described in the
307.Sx TOKENS
308section.
309If no arguments are specified then the username of the target user is used.
310.Pp
311The program should produce on standard output zero or
312more lines of
313.Cm AuthorizedPrincipalsFile
314output.
315If either
316.Cm AuthorizedPrincipalsCommand
317or
318.Cm AuthorizedPrincipalsFile
319is specified, then certificates offered by the client for authentication
320must contain a principal that is listed.
321By default, no
322.Cm AuthorizedPrincipalsCommand
323is run.
324.It Cm AuthorizedPrincipalsCommandUser
325Specifies the user under whose account the
326.Cm AuthorizedPrincipalsCommand
327is run.
328It is recommended to use a dedicated user that has no other role on the host
329than running authorized principals commands.
330If
331.Cm AuthorizedPrincipalsCommand
332is specified but
333.Cm AuthorizedPrincipalsCommandUser
334is not, then
335.Xr sshd 8
336will refuse to start.
337.It Cm AuthorizedPrincipalsFile
338Specifies a file that lists principal names that are accepted for
339certificate authentication.
340When using certificates signed by a key listed in
341.Cm TrustedUserCAKeys ,
342this file lists names, one of which must appear in the certificate for it
343to be accepted for authentication.
344Names are listed one per line preceded by key options (as described in
345.Sx AUTHORIZED_KEYS FILE FORMAT
346in
347.Xr sshd 8 ) .
348Empty lines and comments starting with
349.Ql #
350are ignored.
351.Pp
352Arguments to
353.Cm AuthorizedPrincipalsFile
354accept the tokens described in the
355.Sx TOKENS
356section.
357After expansion,
358.Cm AuthorizedPrincipalsFile
359is taken to be an absolute path or one relative to the user's home directory.
360The default is
361.Cm none ,
362i.e. not to use a principals file \(en in this case, the username
363of the user must appear in a certificate's principals list for it to be
364accepted.
365.Pp
366Note that
367.Cm AuthorizedPrincipalsFile
368is only used when authentication proceeds using a CA listed in
369.Cm TrustedUserCAKeys
370and is not consulted for certification authorities trusted via
371.Pa ~/.ssh/authorized_keys ,
372though the
373.Cm principals=
374key option offers a similar facility (see
375.Xr sshd 8
376for details).
377.It Cm Banner
378The contents of the specified file are sent to the remote user before
379authentication is allowed.
380If the argument is
381.Cm none
382then no banner is displayed.
383By default, no banner is displayed.
384.It Cm CASignatureAlgorithms
385Specifies which algorithms are allowed for signing of certificates
386by certificate authorities (CAs).
387The default is:
388.Bd -literal -offset indent
389ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
390ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
391.Ed
392.Pp
393Certificates signed using other algorithms will not be accepted for
394public key or host-based authentication.
395.It Cm ChallengeResponseAuthentication
396Specifies whether challenge-response authentication is allowed.
397All authentication styles from
398.Xr login.conf 5
399are supported.
400The default is
401.Cm yes .
402.It Cm ChrootDirectory
403Specifies the pathname of a directory to
404.Xr chroot 2
405to after authentication.
406At session startup
407.Xr sshd 8
408checks that all components of the pathname are root-owned directories
409which are not writable by any other user or group.
410After the chroot,
411.Xr sshd 8
412changes the working directory to the user's home directory.
413Arguments to
414.Cm ChrootDirectory
415accept the tokens described in the
416.Sx TOKENS
417section.
418.Pp
419The
420.Cm ChrootDirectory
421must contain the necessary files and directories to support the
422user's session.
423For an interactive session this requires at least a shell, typically
424.Xr sh 1 ,
425and basic
426.Pa /dev
427nodes such as
428.Xr null 4 ,
429.Xr zero 4 ,
430.Xr stdin 4 ,
431.Xr stdout 4 ,
432.Xr stderr 4 ,
433and
434.Xr tty 4
435devices.
436For file transfer sessions using SFTP
437no additional configuration of the environment is necessary if the in-process
438sftp-server is used,
439though sessions which use logging may require
440.Pa /dev/log
441inside the chroot directory on some operating systems (see
442.Xr sftp-server 8
443for details).
444.Pp
445For safety, it is very important that the directory hierarchy be
446prevented from modification by other processes on the system (especially
447those outside the jail).
448Misconfiguration can lead to unsafe environments which
449.Xr sshd 8
450cannot detect.
451.Pp
452The default is
453.Cm none ,
454indicating not to
455.Xr chroot 2 .
456.It Cm Ciphers
457Specifies the ciphers allowed.
458Multiple ciphers must be comma-separated.
459If the specified list begins with a
460.Sq +
461character, then the specified ciphers will be appended to the default set
462instead of replacing them.
463If the specified list begins with a
464.Sq -
465character, then the specified ciphers (including wildcards) will be removed
466from the default set instead of replacing them.
467If the specified list begins with a
468.Sq ^
469character, then the specified ciphers will be placed at the head of the
470default set.
471.Pp
472The supported ciphers are:
473.Pp
474.Bl -item -compact -offset indent
475.It
4763des-cbc
477.It
478aes128-cbc
479.It
480aes192-cbc
481.It
482aes256-cbc
483.It
484aes128-ctr
485.It
486aes192-ctr
487.It
488aes256-ctr
489.It
490aes128-gcm@openssh.com
491.It
492aes256-gcm@openssh.com
493.It
494chacha20-poly1305@openssh.com
495.El
496.Pp
497The default is:
498.Bd -literal -offset indent
499chacha20-poly1305@openssh.com,
500aes128-ctr,aes192-ctr,aes256-ctr,
501aes128-gcm@openssh.com,aes256-gcm@openssh.com
502.Ed
503.Pp
504The list of available ciphers may also be obtained using
505.Qq ssh -Q cipher .
506.It Cm ClientAliveCountMax
507Sets the number of client alive messages which may be sent without
508.Xr sshd 8
509receiving any messages back from the client.
510If this threshold is reached while client alive messages are being sent,
511sshd will disconnect the client, terminating the session.
512It is important to note that the use of client alive messages is very
513different from
514.Cm TCPKeepAlive .
515The client alive messages are sent through the encrypted channel
516and therefore will not be spoofable.
517The TCP keepalive option enabled by
518.Cm TCPKeepAlive
519is spoofable.
520The client alive mechanism is valuable when the client or
521server depend on knowing when a connection has become unresponsive.
522.Pp
523The default value is 3.
524If
525.Cm ClientAliveInterval
526is set to 15, and
527.Cm ClientAliveCountMax
528is left at the default, unresponsive SSH clients
529will be disconnected after approximately 45 seconds.
530.It Cm ClientAliveInterval
531Sets a timeout interval in seconds after which if no data has been received
532from the client,
533.Xr sshd 8
534will send a message through the encrypted
535channel to request a response from the client.
536The default
537is 0, indicating that these messages will not be sent to the client.
538.It Cm Compression
539Specifies whether compression is enabled after
540the user has authenticated successfully.
541The argument must be
542.Cm yes ,
543.Cm delayed
544(a legacy synonym for
545.Cm yes )
546or
547.Cm no .
548The default is
549.Cm yes .
550.It Cm DenyGroups
551This keyword can be followed by a list of group name patterns, separated
552by spaces.
553Login is disallowed for users whose primary group or supplementary
554group list matches one of the patterns.
555Only group names are valid; a numerical group ID is not recognized.
556By default, login is allowed for all groups.
557The allow/deny directives are processed in the following order:
558.Cm DenyUsers ,
559.Cm AllowUsers ,
560.Cm DenyGroups ,
561and finally
562.Cm AllowGroups .
563.Pp
564See PATTERNS in
565.Xr ssh_config 5
566for more information on patterns.
567.It Cm DenyUsers
568This keyword can be followed by a list of user name patterns, separated
569by spaces.
570Login is disallowed for user names that match one of the patterns.
571Only user names are valid; a numerical user ID is not recognized.
572By default, login is allowed for all users.
573If the pattern takes the form USER@HOST then USER and HOST
574are separately checked, restricting logins to particular
575users from particular hosts.
576HOST criteria may additionally contain addresses to match in CIDR
577address/masklen format.
578The allow/deny directives are processed in the following order:
579.Cm DenyUsers ,
580.Cm AllowUsers ,
581.Cm DenyGroups ,
582and finally
583.Cm AllowGroups .
584.Pp
585See PATTERNS in
586.Xr ssh_config 5
587for more information on patterns.
588.It Cm DisableForwarding
589Disables all forwarding features, including X11,
590.Xr ssh-agent 1 ,
591TCP and StreamLocal.
592This option overrides all other forwarding-related options and may
593simplify restricted configurations.
594.It Cm ExposeAuthInfo
595Writes a temporary file containing a list of authentication methods and
596public credentials (e.g. keys) used to authenticate the user.
597The location of the file is exposed to the user session through the
598.Ev SSH_USER_AUTH
599environment variable.
600The default is
601.Cm no .
602.It Cm FingerprintHash
603Specifies the hash algorithm used when logging key fingerprints.
604Valid options are:
605.Cm md5
606and
607.Cm sha256 .
608The default is
609.Cm sha256 .
610.It Cm ForceCommand
611Forces the execution of the command specified by
612.Cm ForceCommand ,
613ignoring any command supplied by the client and
614.Pa ~/.ssh/rc
615if present.
616The command is invoked by using the user's login shell with the -c option.
617This applies to shell, command, or subsystem execution.
618It is most useful inside a
619.Cm Match
620block.
621The command originally supplied by the client is available in the
622.Ev SSH_ORIGINAL_COMMAND
623environment variable.
624Specifying a command of
625.Cm internal-sftp
626will force the use of an in-process SFTP server that requires no support
627files when used with
628.Cm ChrootDirectory .
629The default is
630.Cm none .
631.It Cm GatewayPorts
632Specifies whether remote hosts are allowed to connect to ports
633forwarded for the client.
634By default,
635.Xr sshd 8
636binds remote port forwardings to the loopback address.
637This prevents other remote hosts from connecting to forwarded ports.
638.Cm GatewayPorts
639can be used to specify that sshd
640should allow remote port forwardings to bind to non-loopback addresses, thus
641allowing other hosts to connect.
642The argument may be
643.Cm no
644to force remote port forwardings to be available to the local host only,
645.Cm yes
646to force remote port forwardings to bind to the wildcard address, or
647.Cm clientspecified
648to allow the client to select the address to which the forwarding is bound.
649The default is
650.Cm no .
651.It Cm GSSAPIAuthentication
652Specifies whether user authentication based on GSSAPI is allowed.
653The default is
654.Cm no .
655.It Cm GSSAPICleanupCredentials
656Specifies whether to automatically destroy the user's credentials cache
657on logout.
658The default is
659.Cm yes .
660.It Cm GSSAPIStrictAcceptorCheck
661Determines whether to be strict about the identity of the GSSAPI acceptor
662a client authenticates against.
663If set to
664.Cm yes
665then the client must authenticate against the host
666service on the current hostname.
667If set to
668.Cm no
669then the client may authenticate against any service key stored in the
670machine's default store.
671This facility is provided to assist with operation on multi homed machines.
672The default is
673.Cm yes .
674.It Cm HostbasedAcceptedKeyTypes
675Specifies the key types that will be accepted for hostbased authentication
676as a list of comma-separated patterns.
677Alternately if the specified list begins with a
678.Sq +
679character, then the specified key types will be appended to the default set
680instead of replacing them.
681If the specified list begins with a
682.Sq -
683character, then the specified key types (including wildcards) will be removed
684from the default set instead of replacing them.
685If the specified list begins with a
686.Sq ^
687character, then the specified key types will be placed at the head of the
688default set.
689The default for this option is:
690.Bd -literal -offset 3n
691ecdsa-sha2-nistp256-cert-v01@openssh.com,
692ecdsa-sha2-nistp384-cert-v01@openssh.com,
693ecdsa-sha2-nistp521-cert-v01@openssh.com,
694ssh-ed25519-cert-v01@openssh.com,
695rsa-sha2-512-cert-v01@openssh.com,
696rsa-sha2-256-cert-v01@openssh.com,
697ssh-rsa-cert-v01@openssh.com,
698ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
699ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
700.Ed
701.Pp
702The list of available key types may also be obtained using
703.Qq ssh -Q key .
704.It Cm HostbasedAuthentication
705Specifies whether rhosts or /etc/hosts.equiv authentication together
706with successful public key client host authentication is allowed
707(host-based authentication).
708The default is
709.Cm no .
710.It Cm HostbasedUsesNameFromPacketOnly
711Specifies whether or not the server will attempt to perform a reverse
712name lookup when matching the name in the
713.Pa ~/.shosts ,
714.Pa ~/.rhosts ,
715and
716.Pa /etc/hosts.equiv
717files during
718.Cm HostbasedAuthentication .
719A setting of
720.Cm yes
721means that
722.Xr sshd 8
723uses the name supplied by the client rather than
724attempting to resolve the name from the TCP connection itself.
725The default is
726.Cm no .
727.It Cm HostCertificate
728Specifies a file containing a public host certificate.
729The certificate's public key must match a private host key already specified
730by
731.Cm HostKey .
732The default behaviour of
733.Xr sshd 8
734is not to load any certificates.
735.It Cm HostKey
736Specifies a file containing a private host key
737used by SSH.
738The defaults are
739.Pa /etc/ssh/ssh_host_ecdsa_key ,
740.Pa /etc/ssh/ssh_host_ed25519_key
741and
742.Pa /etc/ssh/ssh_host_rsa_key .
743.Pp
744Note that
745.Xr sshd 8
746will refuse to use a file if it is group/world-accessible
747and that the
748.Cm HostKeyAlgorithms
749option restricts which of the keys are actually used by
750.Xr sshd 8 .
751.Pp
752It is possible to have multiple host key files.
753It is also possible to specify public host key files instead.
754In this case operations on the private key will be delegated
755to an
756.Xr ssh-agent 1 .
757.It Cm HostKeyAgent
758Identifies the UNIX-domain socket used to communicate
759with an agent that has access to the private host keys.
760If the string
761.Qq SSH_AUTH_SOCK
762is specified, the location of the socket will be read from the
763.Ev SSH_AUTH_SOCK
764environment variable.
765.It Cm HostKeyAlgorithms
766Specifies the host key algorithms
767that the server offers.
768The default for this option is:
769.Bd -literal -offset 3n
770ecdsa-sha2-nistp256-cert-v01@openssh.com,
771ecdsa-sha2-nistp384-cert-v01@openssh.com,
772ecdsa-sha2-nistp521-cert-v01@openssh.com,
773ssh-ed25519-cert-v01@openssh.com,
774rsa-sha2-512-cert-v01@openssh.com,
775rsa-sha2-256-cert-v01@openssh.com,
776ssh-rsa-cert-v01@openssh.com,
777ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
778ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
779.Ed
780.Pp
781The list of available key types may also be obtained using
782.Qq ssh -Q key .
783.It Cm IgnoreRhosts
784Specifies that
785.Pa .rhosts
786and
787.Pa .shosts
788files will not be used in
789.Cm HostbasedAuthentication .
790.Pp
791.Pa /etc/hosts.equiv
792and
793.Pa /etc/shosts.equiv
794are still used.
795The default is
796.Cm yes .
797.It Cm IgnoreUserKnownHosts
798Specifies whether
799.Xr sshd 8
800should ignore the user's
801.Pa ~/.ssh/known_hosts
802during
803.Cm HostbasedAuthentication
804and use only the system-wide known hosts file
805.Pa /etc/ssh/known_hosts .
806The default is
807.Cm no .
808.It Cm IPQoS
809Specifies the IPv4 type-of-service or DSCP class for the connection.
810Accepted values are
811.Cm af11 ,
812.Cm af12 ,
813.Cm af13 ,
814.Cm af21 ,
815.Cm af22 ,
816.Cm af23 ,
817.Cm af31 ,
818.Cm af32 ,
819.Cm af33 ,
820.Cm af41 ,
821.Cm af42 ,
822.Cm af43 ,
823.Cm cs0 ,
824.Cm cs1 ,
825.Cm cs2 ,
826.Cm cs3 ,
827.Cm cs4 ,
828.Cm cs5 ,
829.Cm cs6 ,
830.Cm cs7 ,
831.Cm ef ,
832.Cm lowdelay ,
833.Cm throughput ,
834.Cm reliability ,
835a numeric value, or
836.Cm none
837to use the operating system default.
838This option may take one or two arguments, separated by whitespace.
839If one argument is specified, it is used as the packet class unconditionally.
840If two values are specified, the first is automatically selected for
841interactive sessions and the second for non-interactive sessions.
842The default is
843.Cm af21
844(Low-Latency Data)
845for interactive sessions and
846.Cm cs1
847(Lower Effort)
848for non-interactive sessions.
849.It Cm KbdInteractiveAuthentication
850Specifies whether to allow keyboard-interactive authentication.
851The argument to this keyword must be
852.Cm yes
853or
854.Cm no .
855The default is to use whatever value
856.Cm ChallengeResponseAuthentication
857is set to
858(by default
859.Cm yes ) .
860.It Cm KerberosAuthentication
861Specifies whether the password provided by the user for
862.Cm PasswordAuthentication
863will be validated through the Kerberos KDC.
864To use this option, the server needs a
865Kerberos servtab which allows the verification of the KDC's identity.
866The default is
867.Cm no .
868.It Cm KerberosGetAFSToken
869If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
870an AFS token before accessing the user's home directory.
871The default is
872.Cm no .
873.It Cm KerberosOrLocalPasswd
874If password authentication through Kerberos fails then
875the password will be validated via any additional local mechanism
876such as
877.Pa /etc/passwd .
878The default is
879.Cm yes .
880.It Cm KerberosTicketCleanup
881Specifies whether to automatically destroy the user's ticket cache
882file on logout.
883The default is
884.Cm yes .
885.It Cm KexAlgorithms
886Specifies the available KEX (Key Exchange) algorithms.
887Multiple algorithms must be comma-separated.
888Alternately if the specified list begins with a
889.Sq +
890character, then the specified methods will be appended to the default set
891instead of replacing them.
892If the specified list begins with a
893.Sq -
894character, then the specified methods (including wildcards) will be removed
895from the default set instead of replacing them.
896If the specified list begins with a
897.Sq ^
898character, then the specified methods will be placed at the head of the
899default set.
900The supported algorithms are:
901.Pp
902.Bl -item -compact -offset indent
903.It
904curve25519-sha256
905.It
906curve25519-sha256@libssh.org
907.It
908diffie-hellman-group1-sha1
909.It
910diffie-hellman-group14-sha1
911.It
912diffie-hellman-group14-sha256
913.It
914diffie-hellman-group16-sha512
915.It
916diffie-hellman-group18-sha512
917.It
918diffie-hellman-group-exchange-sha1
919.It
920diffie-hellman-group-exchange-sha256
921.It
922ecdh-sha2-nistp256
923.It
924ecdh-sha2-nistp384
925.It
926ecdh-sha2-nistp521
927.El
928.Pp
929The default is:
930.Bd -literal -offset indent
931curve25519-sha256,curve25519-sha256@libssh.org,
932ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
933diffie-hellman-group-exchange-sha256,
934diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,
935diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
936.Ed
937.Pp
938The list of available key exchange algorithms may also be obtained using
939.Qq ssh -Q kex .
940.It Cm ListenAddress
941Specifies the local addresses
942.Xr sshd 8
943should listen on.
944The following forms may be used:
945.Pp
946.Bl -item -offset indent -compact
947.It
948.Cm ListenAddress
949.Sm off
950.Ar hostname | address
951.Sm on
952.Op Cm rdomain Ar domain
953.It
954.Cm ListenAddress
955.Sm off
956.Ar hostname : port
957.Sm on
958.Op Cm rdomain Ar domain
959.It
960.Cm ListenAddress
961.Sm off
962.Ar IPv4_address : port
963.Sm on
964.Op Cm rdomain Ar domain
965.It
966.Cm ListenAddress
967.Sm off
968.Oo Ar hostname | address Oc : Ar port
969.Sm on
970.Op Cm rdomain Ar domain
971.El
972.Pp
973The optional
974.Cm rdomain
975qualifier requests
976.Xr sshd 8
977listen in an explicit routing domain.
978If
979.Ar port
980is not specified,
981sshd will listen on the address and all
982.Cm Port
983options specified.
984The default is to listen on all local addresses on the current default
985routing domain.
986Multiple
987.Cm ListenAddress
988options are permitted.
989For more information on routing domains, see
990.Xr rdomain 4 .
991.It Cm LoginGraceTime
992The server disconnects after this time if the user has not
993successfully logged in.
994If the value is 0, there is no time limit.
995The default is 120 seconds.
996.It Cm LogLevel
997Gives the verbosity level that is used when logging messages from
998.Xr sshd 8 .
999The possible values are:
1000QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
1001The default is INFO.
1002DEBUG and DEBUG1 are equivalent.
1003DEBUG2 and DEBUG3 each specify higher levels of debugging output.
1004Logging with a DEBUG level violates the privacy of users and is not recommended.
1005.It Cm MACs
1006Specifies the available MAC (message authentication code) algorithms.
1007The MAC algorithm is used for data integrity protection.
1008Multiple algorithms must be comma-separated.
1009If the specified list begins with a
1010.Sq +
1011character, then the specified algorithms will be appended to the default set
1012instead of replacing them.
1013If the specified list begins with a
1014.Sq -
1015character, then the specified algorithms (including wildcards) will be removed
1016from the default set instead of replacing them.
1017If the specified list begins with a
1018.Sq ^
1019character, then the specified algorithms will be placed at the head of the
1020default set.
1021.Pp
1022The algorithms that contain
1023.Qq -etm
1024calculate the MAC after encryption (encrypt-then-mac).
1025These are considered safer and their use recommended.
1026The supported MACs are:
1027.Pp
1028.Bl -item -compact -offset indent
1029.It
1030hmac-md5
1031.It
1032hmac-md5-96
1033.It
1034hmac-sha1
1035.It
1036hmac-sha1-96
1037.It
1038hmac-sha2-256
1039.It
1040hmac-sha2-512
1041.It
1042umac-64@openssh.com
1043.It
1044umac-128@openssh.com
1045.It
1046hmac-md5-etm@openssh.com
1047.It
1048hmac-md5-96-etm@openssh.com
1049.It
1050hmac-sha1-etm@openssh.com
1051.It
1052hmac-sha1-96-etm@openssh.com
1053.It
1054hmac-sha2-256-etm@openssh.com
1055.It
1056hmac-sha2-512-etm@openssh.com
1057.It
1058umac-64-etm@openssh.com
1059.It
1060umac-128-etm@openssh.com
1061.El
1062.Pp
1063The default is:
1064.Bd -literal -offset indent
1065umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1066hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1067hmac-sha1-etm@openssh.com,
1068umac-64@openssh.com,umac-128@openssh.com,
1069hmac-sha2-256,hmac-sha2-512,hmac-sha1
1070.Ed
1071.Pp
1072The list of available MAC algorithms may also be obtained using
1073.Qq ssh -Q mac .
1074.It Cm Match
1075Introduces a conditional block.
1076If all of the criteria on the
1077.Cm Match
1078line are satisfied, the keywords on the following lines override those
1079set in the global section of the config file, until either another
1080.Cm Match
1081line or the end of the file.
1082If a keyword appears in multiple
1083.Cm Match
1084blocks that are satisfied, only the first instance of the keyword is
1085applied.
1086.Pp
1087The arguments to
1088.Cm Match
1089are one or more criteria-pattern pairs or the single token
1090.Cm All
1091which matches all criteria.
1092The available criteria are
1093.Cm User ,
1094.Cm Group ,
1095.Cm Host ,
1096.Cm LocalAddress ,
1097.Cm LocalPort ,
1098.Cm RDomain ,
1099and
1100.Cm Address
1101(with
1102.Cm RDomain
1103representing the
1104.Xr rdomain 4
1105on which the connection was received).
1106.Pp
1107The match patterns may consist of single entries or comma-separated
1108lists and may use the wildcard and negation operators described in the
1109.Sx PATTERNS
1110section of
1111.Xr ssh_config 5 .
1112.Pp
1113The patterns in an
1114.Cm Address
1115criteria may additionally contain addresses to match in CIDR
1116address/masklen format,
1117such as 192.0.2.0/24 or 2001:db8::/32.
1118Note that the mask length provided must be consistent with the address -
1119it is an error to specify a mask length that is too long for the address
1120or one with bits set in this host portion of the address.
1121For example, 192.0.2.0/33 and 192.0.2.0/8, respectively.
1122.Pp
1123Only a subset of keywords may be used on the lines following a
1124.Cm Match
1125keyword.
1126Available keywords are
1127.Cm AcceptEnv ,
1128.Cm AllowAgentForwarding ,
1129.Cm AllowGroups ,
1130.Cm AllowStreamLocalForwarding ,
1131.Cm AllowTcpForwarding ,
1132.Cm AllowUsers ,
1133.Cm AuthenticationMethods ,
1134.Cm AuthorizedKeysCommand ,
1135.Cm AuthorizedKeysCommandUser ,
1136.Cm AuthorizedKeysFile ,
1137.Cm AuthorizedPrincipalsCommand ,
1138.Cm AuthorizedPrincipalsCommandUser ,
1139.Cm AuthorizedPrincipalsFile ,
1140.Cm Banner ,
1141.Cm ChrootDirectory ,
1142.Cm ClientAliveCountMax ,
1143.Cm ClientAliveInterval ,
1144.Cm DenyGroups ,
1145.Cm DenyUsers ,
1146.Cm ForceCommand ,
1147.Cm GatewayPorts ,
1148.Cm GSSAPIAuthentication ,
1149.Cm HostbasedAcceptedKeyTypes ,
1150.Cm HostbasedAuthentication ,
1151.Cm HostbasedUsesNameFromPacketOnly ,
1152.Cm IPQoS ,
1153.Cm KbdInteractiveAuthentication ,
1154.Cm KerberosAuthentication ,
1155.Cm LogLevel ,
1156.Cm MaxAuthTries ,
1157.Cm MaxSessions ,
1158.Cm PasswordAuthentication ,
1159.Cm PermitEmptyPasswords ,
1160.Cm PermitListen ,
1161.Cm PermitOpen ,
1162.Cm PermitRootLogin ,
1163.Cm PermitTTY ,
1164.Cm PermitTunnel ,
1165.Cm PermitUserRC ,
1166.Cm PubkeyAcceptedKeyTypes ,
1167.Cm PubkeyAuthentication ,
1168.Cm RekeyLimit ,
1169.Cm RevokedKeys ,
1170.Cm RDomain ,
1171.Cm SetEnv ,
1172.Cm StreamLocalBindMask ,
1173.Cm StreamLocalBindUnlink ,
1174.Cm TrustedUserCAKeys ,
1175.Cm X11DisplayOffset ,
1176.Cm X11Forwarding
1177and
1178.Cm X11UseLocalhost .
1179.It Cm MaxAuthTries
1180Specifies the maximum number of authentication attempts permitted per
1181connection.
1182Once the number of failures reaches half this value,
1183additional failures are logged.
1184The default is 6.
1185.It Cm MaxSessions
1186Specifies the maximum number of open shell, login or subsystem (e.g. sftp)
1187sessions permitted per network connection.
1188Multiple sessions may be established by clients that support connection
1189multiplexing.
1190Setting
1191.Cm MaxSessions
1192to 1 will effectively disable session multiplexing, whereas setting it to 0
1193will prevent all shell, login and subsystem sessions while still permitting
1194forwarding.
1195The default is 10.
1196.It Cm MaxStartups
1197Specifies the maximum number of concurrent unauthenticated connections to the
1198SSH daemon.
1199Additional connections will be dropped until authentication succeeds or the
1200.Cm LoginGraceTime
1201expires for a connection.
1202The default is 10:30:100.
1203.Pp
1204Alternatively, random early drop can be enabled by specifying
1205the three colon separated values
1206start:rate:full (e.g. "10:30:60").
1207.Xr sshd 8
1208will refuse connection attempts with a probability of rate/100 (30%)
1209if there are currently start (10) unauthenticated connections.
1210The probability increases linearly and all connection attempts
1211are refused if the number of unauthenticated connections reaches full (60).
1212.It Cm PasswordAuthentication
1213Specifies whether password authentication is allowed.
1214The default is
1215.Cm yes .
1216.It Cm PermitEmptyPasswords
1217When password authentication is allowed, it specifies whether the
1218server allows login to accounts with empty password strings.
1219The default is
1220.Cm no .
1221.It Cm PermitListen
1222Specifies the addresses/ports on which a remote TCP port forwarding may listen.
1223The listen specification must be one of the following forms:
1224.Pp
1225.Bl -item -offset indent -compact
1226.It
1227.Cm PermitListen
1228.Sm off
1229.Ar port
1230.Sm on
1231.It
1232.Cm PermitListen
1233.Sm off
1234.Ar host : port
1235.Sm on
1236.El
1237.Pp
1238Multiple permissions may be specified by separating them with whitespace.
1239An argument of
1240.Cm any
1241can be used to remove all restrictions and permit any listen requests.
1242An argument of
1243.Cm none
1244can be used to prohibit all listen requests.
1245The host name may contain wildcards as described in the PATTERNS section in
1246.Xr ssh_config 5 .
1247The wildcard
1248.Sq *
1249can also be used in place of a port number to allow all ports.
1250By default all port forwarding listen requests are permitted.
1251Note that the
1252.Cm GatewayPorts
1253option may further restrict which addresses may be listened on.
1254Note also that
1255.Xr ssh 1
1256will request a listen host of
1257.Dq localhost
1258if no listen host was specifically requested, and this name is
1259treated differently to explicit localhost addresses of
1260.Dq 127.0.0.1
1261and
1262.Dq ::1 .
1263.It Cm PermitOpen
1264Specifies the destinations to which TCP port forwarding is permitted.
1265The forwarding specification must be one of the following forms:
1266.Pp
1267.Bl -item -offset indent -compact
1268.It
1269.Cm PermitOpen
1270.Sm off
1271.Ar host : port
1272.Sm on
1273.It
1274.Cm PermitOpen
1275.Sm off
1276.Ar IPv4_addr : port
1277.Sm on
1278.It
1279.Cm PermitOpen
1280.Sm off
1281.Ar \&[ IPv6_addr \&] : port
1282.Sm on
1283.El
1284.Pp
1285Multiple forwards may be specified by separating them with whitespace.
1286An argument of
1287.Cm any
1288can be used to remove all restrictions and permit any forwarding requests.
1289An argument of
1290.Cm none
1291can be used to prohibit all forwarding requests.
1292The wildcard
1293.Sq *
1294can be used for host or port to allow all hosts or ports, respectively.
1295By default all port forwarding requests are permitted.
1296.It Cm PermitRootLogin
1297Specifies whether root can log in using
1298.Xr ssh 1 .
1299The argument must be
1300.Cm yes ,
1301.Cm prohibit-password ,
1302.Cm forced-commands-only ,
1303or
1304.Cm no .
1305The default is
1306.Cm prohibit-password .
1307.Pp
1308If this option is set to
1309.Cm prohibit-password
1310(or its deprecated alias,
1311.Cm without-password ) ,
1312password and keyboard-interactive authentication are disabled for root.
1313.Pp
1314If this option is set to
1315.Cm forced-commands-only ,
1316root login with public key authentication will be allowed,
1317but only if the
1318.Ar command
1319option has been specified
1320(which may be useful for taking remote backups even if root login is
1321normally not allowed).
1322All other authentication methods are disabled for root.
1323.Pp
1324If this option is set to
1325.Cm no ,
1326root is not allowed to log in.
1327.It Cm PermitTTY
1328Specifies whether
1329.Xr pty 4
1330allocation is permitted.
1331The default is
1332.Cm yes .
1333.It Cm PermitTunnel
1334Specifies whether
1335.Xr tun 4
1336device forwarding is allowed.
1337The argument must be
1338.Cm yes ,
1339.Cm point-to-point
1340(layer 3),
1341.Cm ethernet
1342(layer 2), or
1343.Cm no .
1344Specifying
1345.Cm yes
1346permits both
1347.Cm point-to-point
1348and
1349.Cm ethernet .
1350The default is
1351.Cm no .
1352.Pp
1353Independent of this setting, the permissions of the selected
1354.Xr tun 4
1355device must allow access to the user.
1356.It Cm PermitUserEnvironment
1357Specifies whether
1358.Pa ~/.ssh/environment
1359and
1360.Cm environment=
1361options in
1362.Pa ~/.ssh/authorized_keys
1363are processed by
1364.Xr sshd 8 .
1365Valid options are
1366.Cm yes ,
1367.Cm no
1368or a pattern-list specifying which environment variable names to accept
1369(for example
1370.Qq LANG,LC_* ) .
1371The default is
1372.Cm no .
1373Enabling environment processing may enable users to bypass access
1374restrictions in some configurations using mechanisms such as
1375.Ev LD_PRELOAD .
1376.It Cm PermitUserRC
1377Specifies whether any
1378.Pa ~/.ssh/rc
1379file is executed.
1380The default is
1381.Cm yes .
1382.It Cm PidFile
1383Specifies the file that contains the process ID of the
1384SSH daemon, or
1385.Cm none
1386to not write one.
1387The default is
1388.Pa /var/run/sshd.pid .
1389.It Cm Port
1390Specifies the port number that
1391.Xr sshd 8
1392listens on.
1393The default is 22.
1394Multiple options of this type are permitted.
1395See also
1396.Cm ListenAddress .
1397.It Cm PrintLastLog
1398Specifies whether
1399.Xr sshd 8
1400should print the date and time of the last user login when a user logs
1401in interactively.
1402The default is
1403.Cm yes .
1404.It Cm PrintMotd
1405Specifies whether
1406.Xr sshd 8
1407should print
1408.Pa /etc/motd
1409when a user logs in interactively.
1410(On some systems it is also printed by the shell,
1411.Pa /etc/profile ,
1412or equivalent.)
1413The default is
1414.Cm yes .
1415.It Cm PubkeyAcceptedKeyTypes
1416Specifies the key types that will be accepted for public key authentication
1417as a list of comma-separated patterns.
1418Alternately if the specified list begins with a
1419.Sq +
1420character, then the specified key types will be appended to the default set
1421instead of replacing them.
1422If the specified list begins with a
1423.Sq -
1424character, then the specified key types (including wildcards) will be removed
1425from the default set instead of replacing them.
1426If the specified list begins with a
1427.Sq ^
1428character, then the specified key types will be placed at the head of the
1429default set.
1430The default for this option is:
1431.Bd -literal -offset 3n
1432sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
1433ecdsa-sha2-nistp256-cert-v01@openssh.com,
1434ecdsa-sha2-nistp384-cert-v01@openssh.com,
1435ecdsa-sha2-nistp521-cert-v01@openssh.com,
1436sk-ssh-ed25519-cert-v01@openssh.com,
1437ssh-ed25519-cert-v01@openssh.com,
1438rsa-sha2-512-cert-v01@openssh.com,
1439rsa-sha2-256-cert-v01@openssh.com,
1440ssh-rsa-cert-v01@openssh.com,
1441sk-ecdsa-sha2-nistp256@openssh.com,
1442ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1443sk-ssh-ed25519@openssh.com,
1444ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
1445.Ed
1446.Pp
1447The list of available key types may also be obtained using
1448.Qq ssh -Q key .
1449.It Cm PubkeyAuthOptions
1450Sets one or more public key authentication options.
1451Two option keywords are currently supported:
1452.Cm none
1453(the default; indicating no additional options are enabled)
1454and
1455.Cm touch-required .
1456.Pp
1457The
1458.Cm touch-required
1459option causes public key authentication using a security key algorithm
1460(i.e.\&
1461.Cm ecdsa-sk
1462or
1463.Cm ed25519-sk )
1464to always require the signature to attest that a physically present user
1465explicitly confirmed the authentication (usually by touching the security key).
1466By default,
1467.Xr sshd 8
1468requires key touch unless overridden with an authorized_keys option.
1469The
1470.Cm touch-required
1471flag disables this override.
1472This option has no effect for other, non-security key, public key types.
1473.It Cm PubkeyAuthentication
1474Specifies whether public key authentication is allowed.
1475The default is
1476.Cm yes .
1477.It Cm RekeyLimit
1478Specifies the maximum amount of data that may be transmitted before the
1479session key is renegotiated, optionally followed a maximum amount of
1480time that may pass before the session key is renegotiated.
1481The first argument is specified in bytes and may have a suffix of
1482.Sq K ,
1483.Sq M ,
1484or
1485.Sq G
1486to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1487The default is between
1488.Sq 1G
1489and
1490.Sq 4G ,
1491depending on the cipher.
1492The optional second value is specified in seconds and may use any of the
1493units documented in the
1494.Sx TIME FORMATS
1495section.
1496The default value for
1497.Cm RekeyLimit
1498is
1499.Cm default none ,
1500which means that rekeying is performed after the cipher's default amount
1501of data has been sent or received and no time based rekeying is done.
1502.It Cm RevokedKeys
1503Specifies revoked public keys file, or
1504.Cm none
1505to not use one.
1506Keys listed in this file will be refused for public key authentication.
1507Note that if this file is not readable, then public key authentication will
1508be refused for all users.
1509Keys may be specified as a text file, listing one public key per line, or as
1510an OpenSSH Key Revocation List (KRL) as generated by
1511.Xr ssh-keygen 1 .
1512For more information on KRLs, see the KEY REVOCATION LISTS section in
1513.Xr ssh-keygen 1 .
1514.It Cm RDomain
1515Specifies an explicit routing domain that is applied after authentication
1516has completed.
1517The user session, as well and any forwarded or listening IP sockets,
1518will be bound to this
1519.Xr rdomain 4 .
1520If the routing domain is set to
1521.Cm \&%D ,
1522then the domain in which the incoming connection was received will be applied.
1523.It Cm SetEnv
1524Specifies one or more environment variables to set in child sessions started
1525by
1526.Xr sshd 8
1527as
1528.Dq NAME=VALUE .
1529The environment value may be quoted (e.g. if it contains whitespace
1530characters).
1531Environment variables set by
1532.Cm SetEnv
1533override the default environment and any variables specified by the user
1534via
1535.Cm AcceptEnv
1536or
1537.Cm PermitUserEnvironment .
1538.It Cm StreamLocalBindMask
1539Sets the octal file creation mode mask
1540.Pq umask
1541used when creating a Unix-domain socket file for local or remote
1542port forwarding.
1543This option is only used for port forwarding to a Unix-domain socket file.
1544.Pp
1545The default value is 0177, which creates a Unix-domain socket file that is
1546readable and writable only by the owner.
1547Note that not all operating systems honor the file mode on Unix-domain
1548socket files.
1549.It Cm StreamLocalBindUnlink
1550Specifies whether to remove an existing Unix-domain socket file for local
1551or remote port forwarding before creating a new one.
1552If the socket file already exists and
1553.Cm StreamLocalBindUnlink
1554is not enabled,
1555.Nm sshd
1556will be unable to forward the port to the Unix-domain socket file.
1557This option is only used for port forwarding to a Unix-domain socket file.
1558.Pp
1559The argument must be
1560.Cm yes
1561or
1562.Cm no .
1563The default is
1564.Cm no .
1565.It Cm StrictModes
1566Specifies whether
1567.Xr sshd 8
1568should check file modes and ownership of the
1569user's files and home directory before accepting login.
1570This is normally desirable because novices sometimes accidentally leave their
1571directory or files world-writable.
1572The default is
1573.Cm yes .
1574Note that this does not apply to
1575.Cm ChrootDirectory ,
1576whose permissions and ownership are checked unconditionally.
1577.It Cm Subsystem
1578Configures an external subsystem (e.g. file transfer daemon).
1579Arguments should be a subsystem name and a command (with optional arguments)
1580to execute upon subsystem request.
1581.Pp
1582The command
1583.Cm sftp-server
1584implements the SFTP file transfer subsystem.
1585.Pp
1586Alternately the name
1587.Cm internal-sftp
1588implements an in-process SFTP server.
1589This may simplify configurations using
1590.Cm ChrootDirectory
1591to force a different filesystem root on clients.
1592.Pp
1593By default no subsystems are defined.
1594.It Cm SyslogFacility
1595Gives the facility code that is used when logging messages from
1596.Xr sshd 8 .
1597The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1598LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1599The default is AUTH.
1600.It Cm TCPKeepAlive
1601Specifies whether the system should send TCP keepalive messages to the
1602other side.
1603If they are sent, death of the connection or crash of one
1604of the machines will be properly noticed.
1605However, this means that
1606connections will die if the route is down temporarily, and some people
1607find it annoying.
1608On the other hand, if TCP keepalives are not sent,
1609sessions may hang indefinitely on the server, leaving
1610.Qq ghost
1611users and consuming server resources.
1612.Pp
1613The default is
1614.Cm yes
1615(to send TCP keepalive messages), and the server will notice
1616if the network goes down or the client host crashes.
1617This avoids infinitely hanging sessions.
1618.Pp
1619To disable TCP keepalive messages, the value should be set to
1620.Cm no .
1621.It Cm TrustedUserCAKeys
1622Specifies a file containing public keys of certificate authorities that are
1623trusted to sign user certificates for authentication, or
1624.Cm none
1625to not use one.
1626Keys are listed one per line; empty lines and comments starting with
1627.Ql #
1628are allowed.
1629If a certificate is presented for authentication and has its signing CA key
1630listed in this file, then it may be used for authentication for any user
1631listed in the certificate's principals list.
1632Note that certificates that lack a list of principals will not be permitted
1633for authentication using
1634.Cm TrustedUserCAKeys .
1635For more details on certificates, see the CERTIFICATES section in
1636.Xr ssh-keygen 1 .
1637.It Cm UseDNS
1638Specifies whether
1639.Xr sshd 8
1640should look up the remote host name, and to check that
1641the resolved host name for the remote IP address maps back to the
1642very same IP address.
1643.Pp
1644If this option is set to
1645.Cm no
1646(the default) then only addresses and not host names may be used in
1647.Pa ~/.ssh/authorized_keys
1648.Cm from
1649and
1650.Nm
1651.Cm Match
1652.Cm Host
1653directives.
1654.It Cm VersionAddendum
1655Optionally specifies additional text to append to the SSH protocol banner
1656sent by the server upon connection.
1657The default is
1658.Cm none .
1659.It Cm X11DisplayOffset
1660Specifies the first display number available for
1661.Xr sshd 8 Ns 's
1662X11 forwarding.
1663This prevents sshd from interfering with real X11 servers.
1664The default is 10.
1665.It Cm X11Forwarding
1666Specifies whether X11 forwarding is permitted.
1667The argument must be
1668.Cm yes
1669or
1670.Cm no .
1671The default is
1672.Cm no .
1673.Pp
1674When X11 forwarding is enabled, there may be additional exposure to
1675the server and to client displays if the
1676.Xr sshd 8
1677proxy display is configured to listen on the wildcard address (see
1678.Cm X11UseLocalhost ) ,
1679though this is not the default.
1680Additionally, the authentication spoofing and authentication data
1681verification and substitution occur on the client side.
1682The security risk of using X11 forwarding is that the client's X11
1683display server may be exposed to attack when the SSH client requests
1684forwarding (see the warnings for
1685.Cm ForwardX11
1686in
1687.Xr ssh_config 5 ) .
1688A system administrator may have a stance in which they want to
1689protect clients that may expose themselves to attack by unwittingly
1690requesting X11 forwarding, which can warrant a
1691.Cm no
1692setting.
1693.Pp
1694Note that disabling X11 forwarding does not prevent users from
1695forwarding X11 traffic, as users can always install their own forwarders.
1696.It Cm X11UseLocalhost
1697Specifies whether
1698.Xr sshd 8
1699should bind the X11 forwarding server to the loopback address or to
1700the wildcard address.
1701By default,
1702sshd binds the forwarding server to the loopback address and sets the
1703hostname part of the
1704.Ev DISPLAY
1705environment variable to
1706.Cm localhost .
1707This prevents remote hosts from connecting to the proxy display.
1708However, some older X11 clients may not function with this
1709configuration.
1710.Cm X11UseLocalhost
1711may be set to
1712.Cm no
1713to specify that the forwarding server should be bound to the wildcard
1714address.
1715The argument must be
1716.Cm yes
1717or
1718.Cm no .
1719The default is
1720.Cm yes .
1721.It Cm XAuthLocation
1722Specifies the full pathname of the
1723.Xr xauth 1
1724program, or
1725.Cm none
1726to not use one.
1727The default is
1728.Pa /usr/X11R6/bin/xauth .
1729.El
1730.Sh TIME FORMATS
1731.Xr sshd 8
1732command-line arguments and configuration file options that specify time
1733may be expressed using a sequence of the form:
1734.Sm off
1735.Ar time Op Ar qualifier ,
1736.Sm on
1737where
1738.Ar time
1739is a positive integer value and
1740.Ar qualifier
1741is one of the following:
1742.Pp
1743.Bl -tag -width Ds -compact -offset indent
1744.It Aq Cm none
1745seconds
1746.It Cm s | Cm S
1747seconds
1748.It Cm m | Cm M
1749minutes
1750.It Cm h | Cm H
1751hours
1752.It Cm d | Cm D
1753days
1754.It Cm w | Cm W
1755weeks
1756.El
1757.Pp
1758Each member of the sequence is added together to calculate
1759the total time value.
1760.Pp
1761Time format examples:
1762.Pp
1763.Bl -tag -width Ds -compact -offset indent
1764.It 600
1765600 seconds (10 minutes)
1766.It 10m
176710 minutes
1768.It 1h30m
17691 hour 30 minutes (90 minutes)
1770.El
1771.Sh TOKENS
1772Arguments to some keywords can make use of tokens,
1773which are expanded at runtime:
1774.Pp
1775.Bl -tag -width XXXX -offset indent -compact
1776.It %%
1777A literal
1778.Sq % .
1779.It \&%D
1780The routing domain in which the incoming connection was received.
1781.It %F
1782The fingerprint of the CA key.
1783.It %f
1784The fingerprint of the key or certificate.
1785.It %h
1786The home directory of the user.
1787.It %i
1788The key ID in the certificate.
1789.It %K
1790The base64-encoded CA key.
1791.It %k
1792The base64-encoded key or certificate for authentication.
1793.It %s
1794The serial number of the certificate.
1795.It \&%T
1796The type of the CA key.
1797.It %t
1798The key or certificate type.
1799.It \&%U
1800The numeric user ID of the target user.
1801.It %u
1802The username.
1803.El
1804.Pp
1805.Cm AuthorizedKeysCommand
1806accepts the tokens %%, %f, %h, %k, %t, %U, and %u.
1807.Pp
1808.Cm AuthorizedKeysFile
1809accepts the tokens %%, %h, %U, and %u.
1810.Pp
1811.Cm AuthorizedPrincipalsCommand
1812accepts the tokens %%, %F, %f, %h, %i, %K, %k, %s, %T, %t, %U, and %u.
1813.Pp
1814.Cm AuthorizedPrincipalsFile
1815accepts the tokens %%, %h, %U, and %u.
1816.Pp
1817.Cm ChrootDirectory
1818accepts the tokens %%, %h, %U, and %u.
1819.Pp
1820.Cm RoutingDomain
1821accepts the token %D.
1822.Sh FILES
1823.Bl -tag -width Ds
1824.It Pa /etc/ssh/sshd_config
1825Contains configuration data for
1826.Xr sshd 8 .
1827This file should be writable by root only, but it is recommended
1828(though not necessary) that it be world-readable.
1829.El
1830.Sh SEE ALSO
1831.Xr sftp-server 8 ,
1832.Xr sshd 8
1833.Sh AUTHORS
1834.An -nosplit
1835OpenSSH is a derivative of the original and free
1836ssh 1.2.12 release by
1837.An Tatu Ylonen .
1838.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos ,
1839.An Theo de Raadt
1840and
1841.An Dug Song
1842removed many bugs, re-added newer features and
1843created OpenSSH.
1844.An Markus Friedl
1845contributed the support for SSH protocol versions 1.5 and 2.0.
1846.An Niels Provos
1847and
1848.An Markus Friedl
1849contributed support for privilege separation.
1850