xref: /openbsd-src/usr.bin/ssh/sshd_config.5 (revision 747ebedabbda8aea3fcb912ea5084a036968efc5)
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.380 2024/12/06 16:24:27 djm Exp $
37.Dd $Mdocdate: December 6 2024 $
38.Dt SSHD_CONFIG 5
39.Os
40.Sh NAME
41.Nm sshd_config
42.Nd OpenSSH 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.
51Unless noted otherwise, for 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 groups directives are processed in the following order:
117.Cm DenyGroups ,
118.Cm AllowGroups .
119.Pp
120See PATTERNS in
121.Xr ssh_config 5
122for more information on patterns.
123This keyword may appear multiple times in
124.Nm
125with each instance appending to the list.
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 users directives are processed in the following order:
177.Cm DenyUsers ,
178.Cm AllowUsers .
179.Pp
180See PATTERNS in
181.Xr ssh_config 5
182for more information on patterns.
183This keyword may appear multiple times in
184.Nm
185with each instance appending to the list.
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.Cm AUTHORIZED_KEYS
255in
256.Xr sshd 8 ) .
257.Cm AuthorizedKeysCommand
258is tried after the usual
259.Cm AuthorizedKeysFile
260files and will not be executed if a matching key is found there.
261By default, no
262.Cm AuthorizedKeysCommand
263is run.
264.It Cm AuthorizedKeysCommandUser
265Specifies the user under whose account the
266.Cm AuthorizedKeysCommand
267is run.
268It is recommended to use a dedicated user that has no other role on the host
269than running authorized keys commands.
270If
271.Cm AuthorizedKeysCommand
272is specified but
273.Cm AuthorizedKeysCommandUser
274is not, then
275.Xr sshd 8
276will refuse to start.
277.It Cm AuthorizedKeysFile
278Specifies the file that contains the public keys used for user authentication.
279The format is described in the AUTHORIZED_KEYS FILE FORMAT section of
280.Xr sshd 8 .
281Arguments to
282.Cm AuthorizedKeysFile
283may include wildcards and accept the tokens described in the
284.Sx TOKENS
285section.
286After expansion,
287.Cm AuthorizedKeysFile
288is taken to be an absolute path or one relative to the user's home
289directory.
290Multiple files may be listed, separated by whitespace.
291Alternately this option may be set to
292.Cm none
293to skip checking for user keys in files.
294The default is
295.Qq .ssh/authorized_keys .ssh/authorized_keys2 .
296.It Cm AuthorizedPrincipalsCommand
297Specifies a program to be used to generate the list of allowed
298certificate principals as per
299.Cm AuthorizedPrincipalsFile .
300The program must be owned by root, not writable by group or others and
301specified by an absolute path.
302Arguments to
303.Cm AuthorizedPrincipalsCommand
304accept the tokens described in the
305.Sx TOKENS
306section.
307If no arguments are specified then the username of the target user is used.
308.Pp
309The program should produce on standard output zero or
310more lines of
311.Cm AuthorizedPrincipalsFile
312output.
313If either
314.Cm AuthorizedPrincipalsCommand
315or
316.Cm AuthorizedPrincipalsFile
317is specified, then certificates offered by the client for authentication
318must contain a principal that is listed.
319By default, no
320.Cm AuthorizedPrincipalsCommand
321is run.
322.It Cm AuthorizedPrincipalsCommandUser
323Specifies the user under whose account the
324.Cm AuthorizedPrincipalsCommand
325is run.
326It is recommended to use a dedicated user that has no other role on the host
327than running authorized principals commands.
328If
329.Cm AuthorizedPrincipalsCommand
330is specified but
331.Cm AuthorizedPrincipalsCommandUser
332is not, then
333.Xr sshd 8
334will refuse to start.
335.It Cm AuthorizedPrincipalsFile
336Specifies a file that lists principal names that are accepted for
337certificate authentication.
338When using certificates signed by a key listed in
339.Cm TrustedUserCAKeys ,
340this file lists names, one of which must appear in the certificate for it
341to be accepted for authentication.
342Names are listed one per line preceded by key options (as described in
343.Cm AUTHORIZED_KEYS FILE FORMAT
344in
345.Xr sshd 8 ) .
346Empty lines and comments starting with
347.Ql #
348are ignored.
349.Pp
350Arguments to
351.Cm AuthorizedPrincipalsFile
352may include wildcards and accept the tokens described in the
353.Sx TOKENS
354section.
355After expansion,
356.Cm AuthorizedPrincipalsFile
357is taken to be an absolute path or one relative to the user's home directory.
358The default is
359.Cm none ,
360i.e. not to use a principals file \(en in this case, the username
361of the user must appear in a certificate's principals list for it to be
362accepted.
363.Pp
364Note that
365.Cm AuthorizedPrincipalsFile
366is only used when authentication proceeds using a CA listed in
367.Cm TrustedUserCAKeys
368and is not consulted for certification authorities trusted via
369.Pa ~/.ssh/authorized_keys ,
370though the
371.Cm principals=
372key option offers a similar facility (see
373.Xr sshd 8
374for details).
375.It Cm Banner
376The contents of the specified file are sent to the remote user before
377authentication is allowed.
378If the argument is
379.Cm none
380then no banner is displayed.
381By default, no banner is displayed.
382.It Cm CASignatureAlgorithms
383Specifies which algorithms are allowed for signing of certificates
384by certificate authorities (CAs).
385The default is:
386.Bd -literal -offset indent
387ssh-ed25519,ecdsa-sha2-nistp256,
388ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
389sk-ssh-ed25519@openssh.com,
390sk-ecdsa-sha2-nistp256@openssh.com,
391rsa-sha2-512,rsa-sha2-256
392.Ed
393.Pp
394If the specified list begins with a
395.Sq +
396character, then the specified algorithms will be appended to the default set
397instead of replacing them.
398If the specified list begins with a
399.Sq -
400character, then the specified algorithms (including wildcards) will be removed
401from the default set instead of replacing them.
402.Pp
403Certificates signed using other algorithms will not be accepted for
404public key or host-based authentication.
405.It Cm ChannelTimeout
406Specifies whether and how quickly
407.Xr sshd 8
408should close inactive channels.
409Timeouts are specified as one or more
410.Dq type=interval
411pairs separated by whitespace, where the
412.Dq type
413must be the special keyword
414.Dq global
415or a channel type name from the list below, optionally containing
416wildcard characters.
417.Pp
418The timeout value
419.Dq interval
420is specified in seconds or may use any of the units documented in the
421.Sx TIME FORMATS
422section.
423For example,
424.Dq session=5m
425would cause interactive sessions to terminate after five minutes of
426inactivity.
427Specifying a zero value disables the inactivity timeout.
428.Pp
429The special timeout
430.Dq global
431applies to all active channels, taken together.
432Traffic on any active channel will reset the timeout, but when the timeout
433expires then all open channels will be closed.
434Note that this global timeout is not matched by wildcards and must be
435specified explicitly.
436.Pp
437The available channel type names include:
438.Bl -tag -width Ds
439.It Cm agent-connection
440Open connections to
441.Xr ssh-agent 1 .
442.It Cm direct-tcpip , Cm direct-streamlocal@openssh.com
443Open TCP or Unix socket (respectively) connections that have
444been established from a
445.Xr ssh 1
446local forwarding, i.e.\&
447.Cm LocalForward
448or
449.Cm DynamicForward .
450.It Cm forwarded-tcpip , Cm forwarded-streamlocal@openssh.com
451Open TCP or Unix socket (respectively) connections that have been
452established to a
453.Xr sshd 8
454listening on behalf of a
455.Xr ssh 1
456remote forwarding, i.e.\&
457.Cm RemoteForward .
458.It Cm session
459The interactive main session, including shell session, command execution,
460.Xr scp 1 ,
461.Xr sftp 1 ,
462etc.
463.It Cm tun-connection
464Open
465.Cm TunnelForward
466connections.
467.It Cm x11-connection
468Open X11 forwarding sessions.
469.El
470.Pp
471Note that in all the above cases, terminating an inactive session does not
472guarantee to remove all resources associated with the session, e.g. shell
473processes or X11 clients relating to the session may continue to execute.
474.Pp
475Moreover, terminating an inactive channel or session does not necessarily
476close the SSH connection, nor does it prevent a client from
477requesting another channel of the same type.
478In particular, expiring an inactive forwarding session does not prevent
479another identical forwarding from being subsequently created.
480.Pp
481The default is not to expire channels of any type for inactivity.
482.It Cm ChrootDirectory
483Specifies the pathname of a directory to
484.Xr chroot 2
485to after authentication.
486At session startup
487.Xr sshd 8
488checks that all components of the pathname are root-owned directories
489which are not writable by group or others.
490After the chroot,
491.Xr sshd 8
492changes the working directory to the user's home directory.
493Arguments to
494.Cm ChrootDirectory
495accept the tokens described in the
496.Sx TOKENS
497section.
498.Pp
499The
500.Cm ChrootDirectory
501must contain the necessary files and directories to support the
502user's session.
503For an interactive session this requires at least a shell, typically
504.Xr sh 1 ,
505and basic
506.Pa /dev
507nodes such as
508.Xr null 4 ,
509.Xr zero 4 ,
510.Xr stdin 4 ,
511.Xr stdout 4 ,
512.Xr stderr 4 ,
513and
514.Xr tty 4
515devices.
516For file transfer sessions using SFTP
517no additional configuration of the environment is necessary if the in-process
518sftp-server is used,
519though sessions which use logging may require
520.Pa /dev/log
521inside the chroot directory on some operating systems (see
522.Xr sftp-server 8
523for details).
524.Pp
525For safety, it is very important that the directory hierarchy be
526prevented from modification by other processes on the system (especially
527those outside the jail).
528Misconfiguration can lead to unsafe environments which
529.Xr sshd 8
530cannot detect.
531.Pp
532The default is
533.Cm none ,
534indicating not to
535.Xr chroot 2 .
536.It Cm Ciphers
537Specifies the ciphers allowed.
538Multiple ciphers must be comma-separated.
539If the specified list begins with a
540.Sq +
541character, then the specified ciphers will be appended to the default set
542instead of replacing them.
543If the specified list begins with a
544.Sq -
545character, then the specified ciphers (including wildcards) will be removed
546from the default set instead of replacing them.
547If the specified list begins with a
548.Sq ^
549character, then the specified ciphers will be placed at the head of the
550default set.
551.Pp
552The supported ciphers are:
553.Pp
554.Bl -item -compact -offset indent
555.It
5563des-cbc
557.It
558aes128-cbc
559.It
560aes192-cbc
561.It
562aes256-cbc
563.It
564aes128-ctr
565.It
566aes192-ctr
567.It
568aes256-ctr
569.It
570aes128-gcm@openssh.com
571.It
572aes256-gcm@openssh.com
573.It
574chacha20-poly1305@openssh.com
575.El
576.Pp
577The default is:
578.Bd -literal -offset indent
579chacha20-poly1305@openssh.com,
580aes128-gcm@openssh.com,aes256-gcm@openssh.com,
581aes128-ctr,aes192-ctr,aes256-ctr
582.Ed
583.Pp
584The list of available ciphers may also be obtained using
585.Qq ssh -Q cipher .
586.It Cm ClientAliveCountMax
587Sets the number of client alive messages which may be sent without
588.Xr sshd 8
589receiving any messages back from the client.
590If this threshold is reached while client alive messages are being sent,
591sshd will disconnect the client, terminating the session.
592It is important to note that the use of client alive messages is very
593different from
594.Cm TCPKeepAlive .
595The client alive messages are sent through the encrypted channel
596and therefore will not be spoofable.
597The TCP keepalive option enabled by
598.Cm TCPKeepAlive
599is spoofable.
600The client alive mechanism is valuable when the client or
601server depend on knowing when a connection has become unresponsive.
602.Pp
603The default value is 3.
604If
605.Cm ClientAliveInterval
606is set to 15, and
607.Cm ClientAliveCountMax
608is left at the default, unresponsive SSH clients
609will be disconnected after approximately 45 seconds.
610Setting a zero
611.Cm ClientAliveCountMax
612disables connection termination.
613.It Cm ClientAliveInterval
614Sets a timeout interval in seconds after which if no data has been received
615from the client,
616.Xr sshd 8
617will send a message through the encrypted
618channel to request a response from the client.
619The default
620is 0, indicating that these messages will not be sent to the client.
621.It Cm Compression
622Specifies whether compression is enabled after
623the user has authenticated successfully.
624The argument must be
625.Cm yes ,
626.Cm delayed
627(a legacy synonym for
628.Cm yes )
629or
630.Cm no .
631The default is
632.Cm yes .
633.It Cm DenyGroups
634This keyword can be followed by a list of group name patterns, separated
635by spaces.
636Login is disallowed for users whose primary group or supplementary
637group list matches one of the patterns.
638Only group names are valid; a numerical group ID is not recognized.
639By default, login is allowed for all groups.
640The allow/deny groups directives are processed in the following order:
641.Cm DenyGroups ,
642.Cm AllowGroups .
643.Pp
644See PATTERNS in
645.Xr ssh_config 5
646for more information on patterns.
647This keyword may appear multiple times in
648.Nm
649with each instance appending to the list.
650.It Cm DenyUsers
651This keyword can be followed by a list of user name patterns, separated
652by spaces.
653Login is disallowed for user names that match one of the patterns.
654Only user names are valid; a numerical user ID is not recognized.
655By default, login is allowed for all users.
656If the pattern takes the form USER@HOST then USER and HOST
657are separately checked, restricting logins to particular
658users from particular hosts.
659HOST criteria may additionally contain addresses to match in CIDR
660address/masklen format.
661The allow/deny users directives are processed in the following order:
662.Cm DenyUsers ,
663.Cm AllowUsers .
664.Pp
665See PATTERNS in
666.Xr ssh_config 5
667for more information on patterns.
668This keyword may appear multiple times in
669.Nm
670with each instance appending to the list.
671.It Cm DisableForwarding
672Disables all forwarding features, including X11,
673.Xr ssh-agent 1 ,
674TCP and StreamLocal.
675This option overrides all other forwarding-related options and may
676simplify restricted configurations.
677.It Cm ExposeAuthInfo
678Writes a temporary file containing a list of authentication methods and
679public credentials (e.g. keys) used to authenticate the user.
680The location of the file is exposed to the user session through the
681.Ev SSH_USER_AUTH
682environment variable.
683The default is
684.Cm no .
685.It Cm FingerprintHash
686Specifies the hash algorithm used when logging key fingerprints.
687Valid options are:
688.Cm md5
689and
690.Cm sha256 .
691The default is
692.Cm sha256 .
693.It Cm ForceCommand
694Forces the execution of the command specified by
695.Cm ForceCommand ,
696ignoring any command supplied by the client and
697.Pa ~/.ssh/rc
698if present.
699The command is invoked by using the user's login shell with the -c option.
700This applies to shell, command, or subsystem execution.
701It is most useful inside a
702.Cm Match
703block.
704The command originally supplied by the client is available in the
705.Ev SSH_ORIGINAL_COMMAND
706environment variable.
707Specifying a command of
708.Cm internal-sftp
709will force the use of an in-process SFTP server that requires no support
710files when used with
711.Cm ChrootDirectory .
712The default is
713.Cm none .
714.It Cm GatewayPorts
715Specifies whether remote hosts are allowed to connect to ports
716forwarded for the client.
717By default,
718.Xr sshd 8
719binds remote port forwardings to the loopback address.
720This prevents other remote hosts from connecting to forwarded ports.
721.Cm GatewayPorts
722can be used to specify that sshd
723should allow remote port forwardings to bind to non-loopback addresses, thus
724allowing other hosts to connect.
725The argument may be
726.Cm no
727to force remote port forwardings to be available to the local host only,
728.Cm yes
729to force remote port forwardings to bind to the wildcard address, or
730.Cm clientspecified
731to allow the client to select the address to which the forwarding is bound.
732The default is
733.Cm no .
734.It Cm GSSAPIAuthentication
735Specifies whether user authentication based on GSSAPI is allowed.
736The default is
737.Cm no .
738.It Cm GSSAPICleanupCredentials
739Specifies whether to automatically destroy the user's credentials cache
740on logout.
741The default is
742.Cm yes .
743.It Cm GSSAPIStrictAcceptorCheck
744Determines whether to be strict about the identity of the GSSAPI acceptor
745a client authenticates against.
746If set to
747.Cm yes
748then the client must authenticate against the host
749service on the current hostname.
750If set to
751.Cm no
752then the client may authenticate against any service key stored in the
753machine's default store.
754This facility is provided to assist with operation on multi homed machines.
755The default is
756.Cm yes .
757.It Cm HostbasedAcceptedAlgorithms
758Specifies the signature algorithms that will be accepted for hostbased
759authentication as a list of comma-separated patterns.
760Alternately if the specified list begins with a
761.Sq +
762character, then the specified signature algorithms will be appended to
763the default set instead of replacing them.
764If the specified list begins with a
765.Sq -
766character, then the specified signature algorithms (including wildcards)
767will be removed from the default set instead of replacing them.
768If the specified list begins with a
769.Sq ^
770character, then the specified signature algorithms will be placed at
771the head of the default set.
772The default for this option is:
773.Bd -literal -offset 3n
774ssh-ed25519-cert-v01@openssh.com,
775ecdsa-sha2-nistp256-cert-v01@openssh.com,
776ecdsa-sha2-nistp384-cert-v01@openssh.com,
777ecdsa-sha2-nistp521-cert-v01@openssh.com,
778sk-ssh-ed25519-cert-v01@openssh.com,
779sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
780rsa-sha2-512-cert-v01@openssh.com,
781rsa-sha2-256-cert-v01@openssh.com,
782ssh-ed25519,
783ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
784sk-ssh-ed25519@openssh.com,
785sk-ecdsa-sha2-nistp256@openssh.com,
786rsa-sha2-512,rsa-sha2-256
787.Ed
788.Pp
789The list of available signature algorithms may also be obtained using
790.Qq ssh -Q HostbasedAcceptedAlgorithms .
791This was formerly named HostbasedAcceptedKeyTypes.
792.It Cm HostbasedAuthentication
793Specifies whether rhosts or /etc/hosts.equiv authentication together
794with successful public key client host authentication is allowed
795(host-based authentication).
796The default is
797.Cm no .
798.It Cm HostbasedUsesNameFromPacketOnly
799Specifies whether or not the server will attempt to perform a reverse
800name lookup when matching the name in the
801.Pa ~/.shosts ,
802.Pa ~/.rhosts ,
803and
804.Pa /etc/hosts.equiv
805files during
806.Cm HostbasedAuthentication .
807A setting of
808.Cm yes
809means that
810.Xr sshd 8
811uses the name supplied by the client rather than
812attempting to resolve the name from the TCP connection itself.
813The default is
814.Cm no .
815.It Cm HostCertificate
816Specifies a file containing a public host certificate.
817The certificate's public key must match a private host key already specified
818by
819.Cm HostKey .
820The default behaviour of
821.Xr sshd 8
822is not to load any certificates.
823.It Cm HostKey
824Specifies a file containing a private host key
825used by SSH.
826The defaults are
827.Pa /etc/ssh/ssh_host_ecdsa_key ,
828.Pa /etc/ssh/ssh_host_ed25519_key
829and
830.Pa /etc/ssh/ssh_host_rsa_key .
831.Pp
832Note that
833.Xr sshd 8
834will refuse to use a file if it is group/world-accessible
835and that the
836.Cm HostKeyAlgorithms
837option restricts which of the keys are actually used by
838.Xr sshd 8 .
839.Pp
840It is possible to have multiple host key files.
841It is also possible to specify public host key files instead.
842In this case operations on the private key will be delegated
843to an
844.Xr ssh-agent 1 .
845.It Cm HostKeyAgent
846Identifies the UNIX-domain socket used to communicate
847with an agent that has access to the private host keys.
848If the string
849.Qq SSH_AUTH_SOCK
850is specified, the location of the socket will be read from the
851.Ev SSH_AUTH_SOCK
852environment variable.
853.It Cm HostKeyAlgorithms
854Specifies the host key signature algorithms
855that the server offers.
856The default for this option is:
857.Bd -literal -offset 3n
858ssh-ed25519-cert-v01@openssh.com,
859ecdsa-sha2-nistp256-cert-v01@openssh.com,
860ecdsa-sha2-nistp384-cert-v01@openssh.com,
861ecdsa-sha2-nistp521-cert-v01@openssh.com,
862sk-ssh-ed25519-cert-v01@openssh.com,
863sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
864rsa-sha2-512-cert-v01@openssh.com,
865rsa-sha2-256-cert-v01@openssh.com,
866ssh-ed25519,
867ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
868sk-ssh-ed25519@openssh.com,
869sk-ecdsa-sha2-nistp256@openssh.com,
870rsa-sha2-512,rsa-sha2-256
871.Ed
872.Pp
873The list of available signature algorithms may also be obtained using
874.Qq ssh -Q HostKeyAlgorithms .
875.It Cm IgnoreRhosts
876Specifies whether to ignore per-user
877.Pa .rhosts
878and
879.Pa .shosts
880files during
881.Cm HostbasedAuthentication .
882The system-wide
883.Pa /etc/hosts.equiv
884and
885.Pa /etc/shosts.equiv
886are still used regardless of this setting.
887.Pp
888Accepted values are
889.Cm yes
890(the default) to ignore all per-user files,
891.Cm shosts-only
892to allow the use of
893.Pa .shosts
894but to ignore
895.Pa .rhosts
896or
897.Cm no
898to allow both
899.Pa .shosts
900and
901.Pa rhosts .
902.It Cm IgnoreUserKnownHosts
903Specifies whether
904.Xr sshd 8
905should ignore the user's
906.Pa ~/.ssh/known_hosts
907during
908.Cm HostbasedAuthentication
909and use only the system-wide known hosts file
910.Pa /etc/ssh/ssh_known_hosts .
911The default is
912.Dq no .
913.It Cm Include
914Include the specified configuration file(s).
915Multiple pathnames may be specified and each pathname may contain
916.Xr glob 7
917wildcards that will be expanded and processed in lexical order.
918Files without absolute paths are assumed to be in
919.Pa /etc/ssh .
920An
921.Cm Include
922directive may appear inside a
923.Cm Match
924block
925to perform conditional inclusion.
926.It Cm IPQoS
927Specifies the IPv4 type-of-service or DSCP class for the connection.
928Accepted values are
929.Cm af11 ,
930.Cm af12 ,
931.Cm af13 ,
932.Cm af21 ,
933.Cm af22 ,
934.Cm af23 ,
935.Cm af31 ,
936.Cm af32 ,
937.Cm af33 ,
938.Cm af41 ,
939.Cm af42 ,
940.Cm af43 ,
941.Cm cs0 ,
942.Cm cs1 ,
943.Cm cs2 ,
944.Cm cs3 ,
945.Cm cs4 ,
946.Cm cs5 ,
947.Cm cs6 ,
948.Cm cs7 ,
949.Cm ef ,
950.Cm le ,
951.Cm lowdelay ,
952.Cm throughput ,
953.Cm reliability ,
954a numeric value, or
955.Cm none
956to use the operating system default.
957This option may take one or two arguments, separated by whitespace.
958If one argument is specified, it is used as the packet class unconditionally.
959If two values are specified, the first is automatically selected for
960interactive sessions and the second for non-interactive sessions.
961The default is
962.Cm af21
963(Low-Latency Data)
964for interactive sessions and
965.Cm cs1
966(Lower Effort)
967for non-interactive sessions.
968.It Cm KbdInteractiveAuthentication
969Specifies whether to allow keyboard-interactive authentication.
970All authentication styles from
971.Xr login.conf 5
972are supported.
973The default is
974.Cm yes .
975The argument to this keyword must be
976.Cm yes
977or
978.Cm no .
979.Cm ChallengeResponseAuthentication
980is a deprecated alias for this.
981.It Cm KerberosAuthentication
982Specifies whether the password provided by the user for
983.Cm PasswordAuthentication
984will be validated through the Kerberos KDC.
985To use this option, the server needs a
986Kerberos servtab which allows the verification of the KDC's identity.
987The default is
988.Cm no .
989.It Cm KerberosGetAFSToken
990If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
991an AFS token before accessing the user's home directory.
992The default is
993.Cm no .
994.It Cm KerberosOrLocalPasswd
995If password authentication through Kerberos fails then
996the password will be validated via any additional local mechanism
997such as
998.Pa /etc/passwd .
999The default is
1000.Cm yes .
1001.It Cm KerberosTicketCleanup
1002Specifies whether to automatically destroy the user's ticket cache
1003file on logout.
1004The default is
1005.Cm yes .
1006.It Cm KexAlgorithms
1007Specifies the permitted KEX (Key Exchange) algorithms that the server will
1008offer to clients.
1009The ordering of this list is not important, as the client specifies the
1010preference order.
1011Multiple algorithms must be comma-separated.
1012.Pp
1013If the specified list begins with a
1014.Sq +
1015character, then the specified algorithms will be appended to the default set
1016instead of replacing them.
1017If the specified list begins with a
1018.Sq -
1019character, then the specified algorithms (including wildcards) will be removed
1020from the default set instead of replacing them.
1021If the specified list begins with a
1022.Sq ^
1023character, then the specified algorithms will be placed at the head of the
1024default set.
1025.Pp
1026The supported algorithms are:
1027.Pp
1028.Bl -item -compact -offset indent
1029.It
1030curve25519-sha256
1031.It
1032curve25519-sha256@libssh.org
1033.It
1034diffie-hellman-group1-sha1
1035.It
1036diffie-hellman-group14-sha1
1037.It
1038diffie-hellman-group14-sha256
1039.It
1040diffie-hellman-group16-sha512
1041.It
1042diffie-hellman-group18-sha512
1043.It
1044diffie-hellman-group-exchange-sha1
1045.It
1046diffie-hellman-group-exchange-sha256
1047.It
1048ecdh-sha2-nistp256
1049.It
1050ecdh-sha2-nistp384
1051.It
1052ecdh-sha2-nistp521
1053.It
1054mlkem768x25519-sha256
1055.It
1056sntrup761x25519-sha512
1057.It
1058sntrup761x25519-sha512@openssh.com
1059.El
1060.Pp
1061The default is:
1062.Bd -literal -offset indent
1063mlkem768x25519-sha256,
1064sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,
1065curve25519-sha256,curve25519-sha256@libssh.org,
1066ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
1067.Ed
1068.Pp
1069The list of supported key exchange algorithms may also be obtained using
1070.Qq ssh -Q KexAlgorithms .
1071.It Cm ListenAddress
1072Specifies the local addresses
1073.Xr sshd 8
1074should listen on.
1075The following forms may be used:
1076.Pp
1077.Bl -item -offset indent -compact
1078.It
1079.Cm ListenAddress
1080.Sm off
1081.Ar hostname | address
1082.Sm on
1083.Op Cm rdomain Ar domain
1084.It
1085.Cm ListenAddress
1086.Sm off
1087.Ar hostname : port
1088.Sm on
1089.Op Cm rdomain Ar domain
1090.It
1091.Cm ListenAddress
1092.Sm off
1093.Ar IPv4_address : port
1094.Sm on
1095.Op Cm rdomain Ar domain
1096.It
1097.Cm ListenAddress
1098.Sm off
1099.Oo Ar hostname | address Oc : Ar port
1100.Sm on
1101.Op Cm rdomain Ar domain
1102.El
1103.Pp
1104The optional
1105.Cm rdomain
1106qualifier requests
1107.Xr sshd 8
1108listen in an explicit routing domain.
1109If
1110.Ar port
1111is not specified,
1112sshd will listen on the address and all
1113.Cm Port
1114options specified.
1115The default is to listen on all local addresses on the current default
1116routing domain.
1117Multiple
1118.Cm ListenAddress
1119options are permitted.
1120For more information on routing domains, see
1121.Xr rdomain 4 .
1122.It Cm LoginGraceTime
1123The server disconnects after this time if the user has not
1124successfully logged in.
1125If the value is 0, there is no time limit.
1126The default is 120 seconds.
1127.It Cm LogLevel
1128Gives the verbosity level that is used when logging messages from
1129.Xr sshd 8 .
1130The possible values are:
1131QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
1132The default is INFO.
1133DEBUG and DEBUG1 are equivalent.
1134DEBUG2 and DEBUG3 each specify higher levels of debugging output.
1135Logging with a DEBUG level violates the privacy of users and is not recommended.
1136.It Cm LogVerbose
1137Specify one or more overrides to
1138.Cm LogLevel .
1139An override consists of one or more pattern lists that matches the
1140source file, function and line number to force detailed logging for.
1141For example, an override pattern of:
1142.Bd -literal -offset indent
1143kex.c:*:1000,*:kex_exchange_identification():*,packet.c:*
1144.Ed
1145.Pp
1146would enable detailed logging for line 1000 of
1147.Pa kex.c ,
1148everything in the
1149.Fn kex_exchange_identification
1150function, and all code in the
1151.Pa packet.c
1152file.
1153This option is intended for debugging and no overrides are enabled by default.
1154.It Cm MACs
1155Specifies the available MAC (message authentication code) algorithms.
1156The MAC algorithm is used for data integrity protection.
1157Multiple algorithms must be comma-separated.
1158If the specified list begins with a
1159.Sq +
1160character, then the specified algorithms will be appended to the default set
1161instead of replacing them.
1162If the specified list begins with a
1163.Sq -
1164character, then the specified algorithms (including wildcards) will be removed
1165from the default set instead of replacing them.
1166If the specified list begins with a
1167.Sq ^
1168character, then the specified algorithms will be placed at the head of the
1169default set.
1170.Pp
1171The algorithms that contain
1172.Qq -etm
1173calculate the MAC after encryption (encrypt-then-mac).
1174These are considered safer and their use recommended.
1175The supported MACs are:
1176.Pp
1177.Bl -item -compact -offset indent
1178.It
1179hmac-md5
1180.It
1181hmac-md5-96
1182.It
1183hmac-sha1
1184.It
1185hmac-sha1-96
1186.It
1187hmac-sha2-256
1188.It
1189hmac-sha2-512
1190.It
1191umac-64@openssh.com
1192.It
1193umac-128@openssh.com
1194.It
1195hmac-md5-etm@openssh.com
1196.It
1197hmac-md5-96-etm@openssh.com
1198.It
1199hmac-sha1-etm@openssh.com
1200.It
1201hmac-sha1-96-etm@openssh.com
1202.It
1203hmac-sha2-256-etm@openssh.com
1204.It
1205hmac-sha2-512-etm@openssh.com
1206.It
1207umac-64-etm@openssh.com
1208.It
1209umac-128-etm@openssh.com
1210.El
1211.Pp
1212The default is:
1213.Bd -literal -offset indent
1214umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1215hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1216hmac-sha1-etm@openssh.com,
1217umac-64@openssh.com,umac-128@openssh.com,
1218hmac-sha2-256,hmac-sha2-512,hmac-sha1
1219.Ed
1220.Pp
1221The list of available MAC algorithms may also be obtained using
1222.Qq ssh -Q mac .
1223.It Cm Match
1224Introduces a conditional block.
1225If all of the criteria on the
1226.Cm Match
1227line are satisfied, the keywords on the following lines override those
1228set in the global section of the config file, until either another
1229.Cm Match
1230line or the end of the file.
1231If a keyword appears in multiple
1232.Cm Match
1233blocks that are satisfied, only the first instance of the keyword is
1234applied.
1235.Pp
1236The arguments to
1237.Cm Match
1238are one or more criteria-pattern pairs or one of the single token criteria:
1239.Cm All ,
1240which matches all criteria, or
1241.Cm Invalid-User ,
1242which matches when the requested user-name does not match any known account.
1243The available criteria are
1244.Cm User ,
1245.Cm Group ,
1246.Cm Host ,
1247.Cm LocalAddress ,
1248.Cm LocalPort ,
1249.Cm RDomain ,
1250and
1251.Cm Address
1252(with
1253.Cm RDomain
1254representing the
1255.Xr rdomain 4
1256on which the connection was received).
1257.Pp
1258The match patterns may consist of single entries or comma-separated
1259lists and may use the wildcard and negation operators described in the
1260.Sx PATTERNS
1261section of
1262.Xr ssh_config 5 .
1263.Pp
1264The patterns in an
1265.Cm Address
1266criteria may additionally contain addresses to match in CIDR
1267address/masklen format,
1268such as 192.0.2.0/24 or 2001:db8::/32.
1269Note that the mask length provided must be consistent with the address -
1270it is an error to specify a mask length that is too long for the address
1271or one with bits set in this host portion of the address.
1272For example, 192.0.2.0/33 and 192.0.2.0/8, respectively.
1273.Pp
1274Only a subset of keywords may be used on the lines following a
1275.Cm Match
1276keyword.
1277Available keywords are
1278.Cm AcceptEnv ,
1279.Cm AllowAgentForwarding ,
1280.Cm AllowGroups ,
1281.Cm AllowStreamLocalForwarding ,
1282.Cm AllowTcpForwarding ,
1283.Cm AllowUsers ,
1284.Cm AuthenticationMethods ,
1285.Cm AuthorizedKeysCommand ,
1286.Cm AuthorizedKeysCommandUser ,
1287.Cm AuthorizedKeysFile ,
1288.Cm AuthorizedPrincipalsCommand ,
1289.Cm AuthorizedPrincipalsCommandUser ,
1290.Cm AuthorizedPrincipalsFile ,
1291.Cm Banner ,
1292.Cm CASignatureAlgorithms ,
1293.Cm ChannelTimeout ,
1294.Cm ChrootDirectory ,
1295.Cm ClientAliveCountMax ,
1296.Cm ClientAliveInterval ,
1297.Cm DenyGroups ,
1298.Cm DenyUsers ,
1299.Cm DisableForwarding ,
1300.Cm ExposeAuthInfo ,
1301.Cm ForceCommand ,
1302.Cm GatewayPorts ,
1303.Cm GSSAPIAuthentication ,
1304.Cm HostbasedAcceptedAlgorithms ,
1305.Cm HostbasedAuthentication ,
1306.Cm HostbasedUsesNameFromPacketOnly ,
1307.Cm IgnoreRhosts ,
1308.Cm Include ,
1309.Cm IPQoS ,
1310.Cm KbdInteractiveAuthentication ,
1311.Cm KerberosAuthentication ,
1312.Cm LogLevel ,
1313.Cm MaxAuthTries ,
1314.Cm MaxSessions ,
1315.Cm PasswordAuthentication ,
1316.Cm PermitEmptyPasswords ,
1317.Cm PermitListen ,
1318.Cm PermitOpen ,
1319.Cm PermitRootLogin ,
1320.Cm PermitTTY ,
1321.Cm PermitTunnel ,
1322.Cm PermitUserRC ,
1323.Cm PubkeyAcceptedAlgorithms ,
1324.Cm PubkeyAuthentication ,
1325.Cm PubkeyAuthOptions ,
1326.Cm RefuseConnection ,
1327.Cm RekeyLimit ,
1328.Cm RevokedKeys ,
1329.Cm RDomain ,
1330.Cm SetEnv ,
1331.Cm StreamLocalBindMask ,
1332.Cm StreamLocalBindUnlink ,
1333.Cm TrustedUserCAKeys ,
1334.Cm UnusedConnectionTimeout ,
1335.Cm X11DisplayOffset ,
1336.Cm X11Forwarding
1337and
1338.Cm X11UseLocalhost .
1339.It Cm MaxAuthTries
1340Specifies the maximum number of authentication attempts permitted per
1341connection.
1342Once the number of failures reaches half this value,
1343additional failures are logged.
1344The default is 6.
1345.It Cm MaxSessions
1346Specifies the maximum number of open shell, login or subsystem (e.g. sftp)
1347sessions permitted per network connection.
1348Multiple sessions may be established by clients that support connection
1349multiplexing.
1350Setting
1351.Cm MaxSessions
1352to 1 will effectively disable session multiplexing, whereas setting it to 0
1353will prevent all shell, login and subsystem sessions while still permitting
1354forwarding.
1355The default is 10.
1356.It Cm MaxStartups
1357Specifies the maximum number of concurrent unauthenticated connections to the
1358SSH daemon.
1359Additional connections will be dropped until authentication succeeds or the
1360.Cm LoginGraceTime
1361expires for a connection.
1362The default is 10:30:100.
1363.Pp
1364Alternatively, random early drop can be enabled by specifying
1365the three colon separated values
1366start:rate:full (e.g. "10:30:60").
1367.Xr sshd 8
1368will refuse connection attempts with a probability of rate/100 (30%)
1369if there are currently start (10) unauthenticated connections.
1370The probability increases linearly and all connection attempts
1371are refused if the number of unauthenticated connections reaches full (60).
1372.It Cm ModuliFile
1373Specifies the
1374.Xr moduli 5
1375file that contains the Diffie-Hellman groups used for the
1376.Dq diffie-hellman-group-exchange-sha1
1377and
1378.Dq diffie-hellman-group-exchange-sha256
1379key exchange methods.
1380The default is
1381.Pa /etc/moduli .
1382.It Cm PasswordAuthentication
1383Specifies whether password authentication is allowed.
1384The default is
1385.Cm yes .
1386.It Cm PermitEmptyPasswords
1387When password authentication is allowed, it specifies whether the
1388server allows login to accounts with empty password strings.
1389The default is
1390.Cm no .
1391.It Cm PermitListen
1392Specifies the addresses/ports on which a remote TCP port forwarding may listen.
1393The listen specification must be one of the following forms:
1394.Pp
1395.Bl -item -offset indent -compact
1396.It
1397.Cm PermitListen
1398.Sm off
1399.Ar port
1400.Sm on
1401.It
1402.Cm PermitListen
1403.Sm off
1404.Ar host : port
1405.Sm on
1406.El
1407.Pp
1408Multiple permissions may be specified by separating them with whitespace.
1409An argument of
1410.Cm any
1411can be used to remove all restrictions and permit any listen requests.
1412An argument of
1413.Cm none
1414can be used to prohibit all listen requests.
1415The host name may contain wildcards as described in the PATTERNS section in
1416.Xr ssh_config 5 .
1417The wildcard
1418.Sq *
1419can also be used in place of a port number to allow all ports.
1420By default all port forwarding listen requests are permitted.
1421Note that the
1422.Cm GatewayPorts
1423option may further restrict which addresses may be listened on.
1424Note also that
1425.Xr ssh 1
1426will request a listen host of
1427.Dq localhost
1428if no listen host was specifically requested, and this name is
1429treated differently to explicit localhost addresses of
1430.Dq 127.0.0.1
1431and
1432.Dq ::1 .
1433.It Cm PermitOpen
1434Specifies the destinations to which TCP port forwarding is permitted.
1435The forwarding specification must be one of the following forms:
1436.Pp
1437.Bl -item -offset indent -compact
1438.It
1439.Cm PermitOpen
1440.Sm off
1441.Ar host : port
1442.Sm on
1443.It
1444.Cm PermitOpen
1445.Sm off
1446.Ar IPv4_addr : port
1447.Sm on
1448.It
1449.Cm PermitOpen
1450.Sm off
1451.Ar \&[ IPv6_addr \&] : port
1452.Sm on
1453.El
1454.Pp
1455Multiple forwards may be specified by separating them with whitespace.
1456An argument of
1457.Cm any
1458can be used to remove all restrictions and permit any forwarding requests.
1459An argument of
1460.Cm none
1461can be used to prohibit all forwarding requests.
1462The wildcard
1463.Sq *
1464can be used for host or port to allow all hosts or ports respectively.
1465Otherwise, no pattern matching or address lookups are performed on supplied
1466names.
1467By default all port forwarding requests are permitted.
1468.It Cm PermitRootLogin
1469Specifies whether root can log in using
1470.Xr ssh 1 .
1471The argument must be
1472.Cm yes ,
1473.Cm prohibit-password ,
1474.Cm forced-commands-only ,
1475or
1476.Cm no .
1477The default is
1478.Cm prohibit-password .
1479.Pp
1480If this option is set to
1481.Cm prohibit-password
1482(or its deprecated alias,
1483.Cm without-password ) ,
1484password and keyboard-interactive authentication are disabled for root.
1485.Pp
1486If this option is set to
1487.Cm forced-commands-only ,
1488root login with public key authentication will be allowed,
1489but only if the
1490.Ar command
1491option has been specified
1492(which may be useful for taking remote backups even if root login is
1493normally not allowed).
1494All other authentication methods are disabled for root.
1495.Pp
1496If this option is set to
1497.Cm no ,
1498root is not allowed to log in.
1499.It Cm PermitTTY
1500Specifies whether
1501.Xr pty 4
1502allocation is permitted.
1503The default is
1504.Cm yes .
1505.It Cm PermitTunnel
1506Specifies whether
1507.Xr tun 4
1508device forwarding is allowed.
1509The argument must be
1510.Cm yes ,
1511.Cm point-to-point
1512(layer 3),
1513.Cm ethernet
1514(layer 2), or
1515.Cm no .
1516Specifying
1517.Cm yes
1518permits both
1519.Cm point-to-point
1520and
1521.Cm ethernet .
1522The default is
1523.Cm no .
1524.Pp
1525Independent of this setting, the permissions of the selected
1526.Xr tun 4
1527device must allow access to the user.
1528.It Cm PermitUserEnvironment
1529Specifies whether
1530.Pa ~/.ssh/environment
1531and
1532.Cm environment=
1533options in
1534.Pa ~/.ssh/authorized_keys
1535are processed by
1536.Xr sshd 8 .
1537Valid options are
1538.Cm yes ,
1539.Cm no
1540or a pattern-list specifying which environment variable names to accept
1541(for example
1542.Qq LANG,LC_* ) .
1543The default is
1544.Cm no .
1545Enabling environment processing may enable users to bypass access
1546restrictions in some configurations using mechanisms such as
1547.Ev LD_PRELOAD .
1548.It Cm PermitUserRC
1549Specifies whether any
1550.Pa ~/.ssh/rc
1551file is executed.
1552The default is
1553.Cm yes .
1554.It Cm PerSourceMaxStartups
1555Specifies the number of unauthenticated connections allowed from a
1556given source address, or
1557.Dq none
1558if there is no limit.
1559This limit is applied in addition to
1560.Cm MaxStartups ,
1561whichever is lower.
1562The default is
1563.Cm none .
1564.It Cm PerSourceNetBlockSize
1565Specifies the number of bits of source address that are grouped together
1566for the purposes of applying PerSourceMaxStartups limits.
1567Values for IPv4 and optionally IPv6 may be specified, separated by a colon.
1568The default is
1569.Cm 32:128 ,
1570which means each address is considered individually.
1571.It Cm PerSourcePenalties
1572Controls penalties for various conditions that may represent attacks on
1573.Xr sshd 8 .
1574If a penalty is enforced against a client then its source address and any
1575others in the same network, as defined by
1576.Cm PerSourceNetBlockSize ,
1577will be refused connection for a period.
1578.Pp
1579A penalty doesn't affect concurrent connections in progress, but multiple
1580penalties from the same source from concurrent connections will accumulate
1581up to a maximum.
1582Conversely, penalties are not applied until a minimum threshold time has been
1583accumulated.
1584.Pp
1585Penalties are enabled by default with the default settings listed below
1586but may disabled using the
1587.Cm no
1588keyword.
1589The defaults may be overridden by specifying one or more of the keywords below,
1590separated by whitespace.
1591All keywords accept arguments, e.g.\&
1592.Qq crash:2m .
1593.Bl -tag -width Ds
1594.It Cm crash:duration
1595Specifies how long to refuse clients that cause a crash of
1596.Xr sshd 8 (default: 90s).
1597.It Cm authfail:duration
1598Specifies how long to refuse clients that disconnect after making one or more
1599unsuccessful authentication attempts (default: 5s).
1600.It Cm refuseconnection:duration
1601Specifies how long to refuse clients that were administratively prohibited
1602connection via the
1603.Cm RefuseConnection
1604option (default: 10s).
1605.It Cm noauth:duration
1606Specifies how long to refuse clients that disconnect without attempting
1607authentication (default: 1s).
1608This timeout should be used cautiously otherwise it may penalise legitimate
1609scanning tools such as
1610.Xr ssh-keyscan 1 .
1611.It Cm grace-exceeded:duration
1612Specifies how long to refuse clients that fail to authenticate after
1613.Cm LoginGraceTime
1614(default: 10s).
1615.It Cm max:duration
1616Specifies the maximum time a particular source address range will be refused
1617access for (default: 10m).
1618Repeated penalties will accumulate up to this maximum.
1619.It Cm min:duration
1620Specifies the minimum penalty that must accrue before enforcement begins
1621(default: 15s).
1622.It Cm max-sources4:number , max-sources6:number
1623Specifies the maximum number of client IPv4 and IPv6 address ranges to
1624track for penalties (default: 65536 for both).
1625.It Cm overflow:mode
1626Controls how the server behaves when
1627.Cm max-sources4
1628or
1629.Cm max-sources6
1630is exceeded.
1631There are two operating modes:
1632.Cm deny-all ,
1633which denies all incoming connections other than those exempted via
1634.Cm PerSourcePenaltyExemptList
1635until a penalty expires, and
1636.Cm permissive ,
1637which allows new connections by removing existing penalties early
1638(default: permissive).
1639Note that client penalties below the
1640.Cm min
1641threshold count against the total number of tracked penalties.
1642IPv4 and IPv6 addresses are tracked separately, so an overflow in one will
1643not affect the other.
1644.It Cm overflow6:mode
1645Allows specifying a different overflow mode for IPv6 addresses.
1646The default it to use the same overflow mode as was specified for IPv4.
1647.El
1648.It Cm PerSourcePenaltyExemptList
1649Specifies a comma-separated list of addresses to exempt from penalties.
1650This list may contain wildcards and CIDR address/masklen ranges.
1651Note that the mask length provided must be consistent with the address -
1652it is an error to specify a mask length that is too long for the address
1653or one with bits set in this host portion of the address.
1654For example, 192.0.2.0/33 and 192.0.2.0/8, respectively.
1655The default is not to exempt any addresses.
1656.It Cm PidFile
1657Specifies the file that contains the process ID of the
1658SSH daemon, or
1659.Cm none
1660to not write one.
1661The default is
1662.Pa /var/run/sshd.pid .
1663.It Cm Port
1664Specifies the port number that
1665.Xr sshd 8
1666listens on.
1667The default is 22.
1668Multiple options of this type are permitted.
1669See also
1670.Cm ListenAddress .
1671.It Cm PrintLastLog
1672Specifies whether
1673.Xr sshd 8
1674should print the date and time of the last user login when a user logs
1675in interactively.
1676The default is
1677.Cm yes .
1678.It Cm PrintMotd
1679Specifies whether
1680.Xr sshd 8
1681should print
1682.Pa /etc/motd
1683when a user logs in interactively.
1684(On some systems it is also printed by the shell,
1685.Pa /etc/profile ,
1686or equivalent.)
1687The default is
1688.Cm yes .
1689.It Cm PubkeyAcceptedAlgorithms
1690Specifies the signature algorithms that will be accepted for public key
1691authentication as a list of comma-separated patterns.
1692Alternately if the specified list begins with a
1693.Sq +
1694character, then the specified algorithms will be appended to the default set
1695instead of replacing them.
1696If the specified list begins with a
1697.Sq -
1698character, then the specified algorithms (including wildcards) will be removed
1699from the default set instead of replacing them.
1700If the specified list begins with a
1701.Sq ^
1702character, then the specified algorithms will be placed at the head of the
1703default set.
1704The default for this option is:
1705.Bd -literal -offset 3n
1706ssh-ed25519-cert-v01@openssh.com,
1707ecdsa-sha2-nistp256-cert-v01@openssh.com,
1708ecdsa-sha2-nistp384-cert-v01@openssh.com,
1709ecdsa-sha2-nistp521-cert-v01@openssh.com,
1710sk-ssh-ed25519-cert-v01@openssh.com,
1711sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
1712rsa-sha2-512-cert-v01@openssh.com,
1713rsa-sha2-256-cert-v01@openssh.com,
1714ssh-ed25519,
1715ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1716sk-ssh-ed25519@openssh.com,
1717sk-ecdsa-sha2-nistp256@openssh.com,
1718rsa-sha2-512,rsa-sha2-256
1719.Ed
1720.Pp
1721The list of available signature algorithms may also be obtained using
1722.Qq ssh -Q PubkeyAcceptedAlgorithms .
1723.It Cm PubkeyAuthOptions
1724Sets one or more public key authentication options.
1725The supported keywords are:
1726.Cm none
1727(the default; indicating no additional options are enabled),
1728.Cm touch-required
1729and
1730.Cm verify-required .
1731.Pp
1732The
1733.Cm touch-required
1734option causes public key authentication using a FIDO authenticator algorithm
1735(i.e.\&
1736.Cm ecdsa-sk
1737or
1738.Cm ed25519-sk )
1739to always require the signature to attest that a physically present user
1740explicitly confirmed the authentication (usually by touching the authenticator).
1741By default,
1742.Xr sshd 8
1743requires user presence unless overridden with an authorized_keys option.
1744The
1745.Cm touch-required
1746flag disables this override.
1747.Pp
1748The
1749.Cm verify-required
1750option requires a FIDO key signature attest that the user was verified,
1751e.g. via a PIN.
1752.Pp
1753Neither the
1754.Cm touch-required
1755or
1756.Cm verify-required
1757options have any effect for other, non-FIDO, public key types.
1758.It Cm PubkeyAuthentication
1759Specifies whether public key authentication is allowed.
1760The default is
1761.Cm yes .
1762.It Cm RefuseConnection
1763Indicates that
1764.Xr sshd 8
1765should unconditionally terminate the connection.
1766Additionally, a
1767.Cm refuseconnection
1768penalty may be recorded against the source of the connection if
1769.Cm PerSourcePenalties
1770are enabled.
1771This option is only really useful in a
1772.Cm Match
1773block.
1774.It Cm RekeyLimit
1775Specifies the maximum amount of data that may be transmitted or received
1776before the session key is renegotiated, optionally followed by a maximum
1777amount of time that may pass before the session key is renegotiated.
1778The first argument is specified in bytes and may have a suffix of
1779.Sq K ,
1780.Sq M ,
1781or
1782.Sq G
1783to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1784The default is between
1785.Sq 1G
1786and
1787.Sq 4G ,
1788depending on the cipher.
1789The optional second value is specified in seconds and may use any of the
1790units documented in the
1791.Sx TIME FORMATS
1792section.
1793The default value for
1794.Cm RekeyLimit
1795is
1796.Cm default none ,
1797which means that rekeying is performed after the cipher's default amount
1798of data has been sent or received and no time based rekeying is done.
1799.It Cm RequiredRSASize
1800Specifies the minimum RSA key size (in bits) that
1801.Xr sshd 8
1802will accept.
1803User and host-based authentication keys smaller than this limit will be
1804refused.
1805The default is
1806.Cm 1024
1807bits.
1808Note that this limit may only be raised from the default.
1809.It Cm RevokedKeys
1810Specifies revoked public keys file, or
1811.Cm none
1812to not use one.
1813Keys listed in this file will be refused for public key authentication.
1814Note that if this file is not readable, then public key authentication will
1815be refused for all users.
1816Keys may be specified as a text file, listing one public key per line, or as
1817an OpenSSH Key Revocation List (KRL) as generated by
1818.Xr ssh-keygen 1 .
1819For more information on KRLs, see the KEY REVOCATION LISTS section in
1820.Xr ssh-keygen 1 .
1821.It Cm RDomain
1822Specifies an explicit routing domain that is applied after authentication
1823has completed.
1824The user session, as well as any forwarded or listening IP sockets,
1825will be bound to this
1826.Xr rdomain 4 .
1827If the routing domain is set to
1828.Cm \&%D ,
1829then the domain in which the incoming connection was received will be applied.
1830.It Cm SecurityKeyProvider
1831Specifies a path to a library that will be used when loading
1832FIDO authenticator-hosted keys, overriding the default of using
1833the built-in USB HID support.
1834.It Cm SetEnv
1835Specifies one or more environment variables to set in child sessions started
1836by
1837.Xr sshd 8
1838as
1839.Dq NAME=VALUE .
1840The environment value may be quoted (e.g. if it contains whitespace
1841characters).
1842Environment variables set by
1843.Cm SetEnv
1844override the default environment and any variables specified by the user
1845via
1846.Cm AcceptEnv
1847or
1848.Cm PermitUserEnvironment .
1849.It Cm SshdAuthPath
1850Overrides the default path to the
1851.Cm sshd-auth
1852binary that is invoked to complete user authentication.
1853The default is
1854.Pa /usr/libexec/sshd-auth .
1855This option is intended for use by tests.
1856.It Cm SshdSessionPath
1857Overrides the default path to the
1858.Cm sshd-session
1859binary that is invoked to handle each connection.
1860The default is
1861.Pa /usr/libexec/sshd-session .
1862This option is intended for use by tests.
1863.It Cm StreamLocalBindMask
1864Sets the octal file creation mode mask
1865.Pq umask
1866used when creating a Unix-domain socket file for local or remote
1867port forwarding.
1868This option is only used for port forwarding to a Unix-domain socket file.
1869.Pp
1870The default value is 0177, which creates a Unix-domain socket file that is
1871readable and writable only by the owner.
1872Note that not all operating systems honor the file mode on Unix-domain
1873socket files.
1874.It Cm StreamLocalBindUnlink
1875Specifies whether to remove an existing Unix-domain socket file for local
1876or remote port forwarding before creating a new one.
1877If the socket file already exists and
1878.Cm StreamLocalBindUnlink
1879is not enabled,
1880.Nm sshd
1881will be unable to forward the port to the Unix-domain socket file.
1882This option is only used for port forwarding to a Unix-domain socket file.
1883.Pp
1884The argument must be
1885.Cm yes
1886or
1887.Cm no .
1888The default is
1889.Cm no .
1890.It Cm StrictModes
1891Specifies whether
1892.Xr sshd 8
1893should check file modes and ownership of the
1894user's files and home directory before accepting login.
1895This is normally desirable because novices sometimes accidentally leave their
1896directory or files world-writable.
1897The default is
1898.Cm yes .
1899Note that this does not apply to
1900.Cm ChrootDirectory ,
1901whose permissions and ownership are checked unconditionally.
1902.It Cm Subsystem
1903Configures an external subsystem (e.g. file transfer daemon).
1904Arguments should be a subsystem name and a command (with optional arguments)
1905to execute upon subsystem request.
1906.Pp
1907The command
1908.Cm sftp-server
1909implements the SFTP file transfer subsystem.
1910.Pp
1911Alternately the name
1912.Cm internal-sftp
1913implements an in-process SFTP server.
1914This may simplify configurations using
1915.Cm ChrootDirectory
1916to force a different filesystem root on clients.
1917It accepts the same command line arguments as
1918.Cm sftp-server
1919and even though it is in-process, settings such as
1920.Cm LogLevel
1921or
1922.Cm SyslogFacility
1923do not apply to it and must be set explicitly via
1924command line arguments.
1925.Pp
1926By default no subsystems are defined.
1927.It Cm SyslogFacility
1928Gives the facility code that is used when logging messages from
1929.Xr sshd 8 .
1930The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1931LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1932The default is AUTH.
1933.It Cm TCPKeepAlive
1934Specifies whether the system should send TCP keepalive messages to the
1935other side.
1936If they are sent, death of the connection or crash of one
1937of the machines will be properly noticed.
1938However, this means that
1939connections will die if the route is down temporarily, and some people
1940find it annoying.
1941On the other hand, if TCP keepalives are not sent,
1942sessions may hang indefinitely on the server, leaving
1943.Qq ghost
1944users and consuming server resources.
1945.Pp
1946The default is
1947.Cm yes
1948(to send TCP keepalive messages), and the server will notice
1949if the network goes down or the client host crashes.
1950This avoids infinitely hanging sessions.
1951.Pp
1952To disable TCP keepalive messages, the value should be set to
1953.Cm no .
1954.It Cm TrustedUserCAKeys
1955Specifies a file containing public keys of certificate authorities that are
1956trusted to sign user certificates for authentication, or
1957.Cm none
1958to not use one.
1959Keys are listed one per line; empty lines and comments starting with
1960.Ql #
1961are allowed.
1962If a certificate is presented for authentication and has its signing CA key
1963listed in this file, then it may be used for authentication for any user
1964listed in the certificate's principals list.
1965Note that certificates that lack a list of principals will not be permitted
1966for authentication using
1967.Cm TrustedUserCAKeys .
1968For more details on certificates, see the CERTIFICATES section in
1969.Xr ssh-keygen 1 .
1970.It Cm UnusedConnectionTimeout
1971Specifies whether and how quickly
1972.Xr sshd 8
1973should close client connections with no open channels.
1974Open channels include active shell, command execution or subsystem
1975sessions, connected network, socket, agent or X11 forwardings.
1976Forwarding listeners, such as those from the
1977.Xr ssh 1
1978.Fl R
1979flag, are not considered as open channels and do not prevent the timeout.
1980The timeout value
1981is specified in seconds or may use any of the units documented in the
1982.Sx TIME FORMATS
1983section.
1984.Pp
1985Note that this timeout starts when the client connection completes
1986user authentication but before the client has an opportunity to open any
1987channels.
1988Caution should be used when using short timeout values, as they may not
1989provide sufficient time for the client to request and open its channels
1990before terminating the connection.
1991.Pp
1992The default
1993.Cm none
1994is to never expire connections for having no open channels.
1995This option may be useful in conjunction with
1996.Cm ChannelTimeout .
1997.It Cm UseDNS
1998Specifies whether
1999.Xr sshd 8
2000should look up the remote host name, and to check that
2001the resolved host name for the remote IP address maps back to the
2002very same IP address.
2003.Pp
2004If this option is set to
2005.Cm no
2006(the default) then only addresses and not host names may be used in
2007.Pa ~/.ssh/authorized_keys
2008.Cm from
2009and
2010.Nm
2011.Cm Match
2012.Cm Host
2013directives.
2014.It Cm VersionAddendum
2015Optionally specifies additional text to append to the SSH protocol banner
2016sent by the server upon connection.
2017The default is
2018.Cm none .
2019.It Cm X11DisplayOffset
2020Specifies the first display number available for
2021.Xr sshd 8 Ns 's
2022X11 forwarding.
2023This prevents sshd from interfering with real X11 servers.
2024The default is 10.
2025.It Cm X11Forwarding
2026Specifies whether X11 forwarding is permitted.
2027The argument must be
2028.Cm yes
2029or
2030.Cm no .
2031The default is
2032.Cm no .
2033.Pp
2034When X11 forwarding is enabled, there may be additional exposure to
2035the server and to client displays if the
2036.Xr sshd 8
2037proxy display is configured to listen on the wildcard address (see
2038.Cm X11UseLocalhost ) ,
2039though this is not the default.
2040Additionally, the authentication spoofing and authentication data
2041verification and substitution occur on the client side.
2042The security risk of using X11 forwarding is that the client's X11
2043display server may be exposed to attack when the SSH client requests
2044forwarding (see the warnings for
2045.Cm ForwardX11
2046in
2047.Xr ssh_config 5 ) .
2048A system administrator may have a stance in which they want to
2049protect clients that may expose themselves to attack by unwittingly
2050requesting X11 forwarding, which can warrant a
2051.Cm no
2052setting.
2053.Pp
2054Note that disabling X11 forwarding does not prevent users from
2055forwarding X11 traffic, as users can always install their own forwarders.
2056.It Cm X11UseLocalhost
2057Specifies whether
2058.Xr sshd 8
2059should bind the X11 forwarding server to the loopback address or to
2060the wildcard address.
2061By default,
2062sshd binds the forwarding server to the loopback address and sets the
2063hostname part of the
2064.Ev DISPLAY
2065environment variable to
2066.Cm localhost .
2067This prevents remote hosts from connecting to the proxy display.
2068However, some older X11 clients may not function with this
2069configuration.
2070.Cm X11UseLocalhost
2071may be set to
2072.Cm no
2073to specify that the forwarding server should be bound to the wildcard
2074address.
2075The argument must be
2076.Cm yes
2077or
2078.Cm no .
2079The default is
2080.Cm yes .
2081.It Cm XAuthLocation
2082Specifies the full pathname of the
2083.Xr xauth 1
2084program, or
2085.Cm none
2086to not use one.
2087The default is
2088.Pa /usr/X11R6/bin/xauth .
2089.El
2090.Sh TIME FORMATS
2091.Xr sshd 8
2092command-line arguments and configuration file options that specify time
2093may be expressed using a sequence of the form:
2094.Sm off
2095.Ar time Op Ar qualifier ,
2096.Sm on
2097where
2098.Ar time
2099is a positive integer value and
2100.Ar qualifier
2101is one of the following:
2102.Pp
2103.Bl -tag -width Ds -compact -offset indent
2104.It Aq Cm none
2105seconds
2106.It Cm s | Cm S
2107seconds
2108.It Cm m | Cm M
2109minutes
2110.It Cm h | Cm H
2111hours
2112.It Cm d | Cm D
2113days
2114.It Cm w | Cm W
2115weeks
2116.El
2117.Pp
2118Each member of the sequence is added together to calculate
2119the total time value.
2120.Pp
2121Time format examples:
2122.Pp
2123.Bl -tag -width Ds -compact -offset indent
2124.It 600
2125600 seconds (10 minutes)
2126.It 10m
212710 minutes
2128.It 1h30m
21291 hour 30 minutes (90 minutes)
2130.El
2131.Sh TOKENS
2132Arguments to some keywords can make use of tokens,
2133which are expanded at runtime:
2134.Pp
2135.Bl -tag -width XXXX -offset indent -compact
2136.It %%
2137A literal
2138.Sq % .
2139.It \&%C
2140Identifies the connection endpoints, containing
2141four space-separated values: client address, client port number,
2142server address, and server port number.
2143.It \&%D
2144The routing domain in which the incoming connection was received.
2145.It %F
2146The fingerprint of the CA key.
2147.It %f
2148The fingerprint of the key or certificate.
2149.It %h
2150The home directory of the user.
2151.It %i
2152The key ID in the certificate.
2153.It %K
2154The base64-encoded CA key.
2155.It %k
2156The base64-encoded key or certificate for authentication.
2157.It %s
2158The serial number of the certificate.
2159.It \&%T
2160The type of the CA key.
2161.It %t
2162The key or certificate type.
2163.It \&%U
2164The numeric user ID of the target user.
2165.It %u
2166The username.
2167.El
2168.Pp
2169.Cm AuthorizedKeysCommand
2170accepts the tokens %%, %C, %D, %f, %h, %k, %t, %U, and %u.
2171.Pp
2172.Cm AuthorizedKeysFile
2173accepts the tokens %%, %h, %U, and %u.
2174.Pp
2175.Cm AuthorizedPrincipalsCommand
2176accepts the tokens %%, %C, %D, %F, %f, %h, %i, %K, %k, %s, %T, %t, %U, and %u.
2177.Pp
2178.Cm AuthorizedPrincipalsFile
2179accepts the tokens %%, %h, %U, and %u.
2180.Pp
2181.Cm ChrootDirectory
2182accepts the tokens %%, %h, %U, and %u.
2183.Pp
2184.Cm RoutingDomain
2185accepts the token %D.
2186.Sh FILES
2187.Bl -tag -width Ds
2188.It Pa /etc/ssh/sshd_config
2189Contains configuration data for
2190.Xr sshd 8 .
2191This file should be writable by root only, but it is recommended
2192(though not necessary) that it be world-readable.
2193.El
2194.Sh SEE ALSO
2195.Xr sftp-server 8 ,
2196.Xr sshd 8
2197.Sh AUTHORS
2198.An -nosplit
2199OpenSSH is a derivative of the original and free
2200ssh 1.2.12 release by
2201.An Tatu Ylonen .
2202.An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos ,
2203.An Theo de Raadt
2204and
2205.An Dug Song
2206removed many bugs, re-added newer features and
2207created OpenSSH.
2208.An Markus Friedl
2209contributed the support for SSH protocol versions 1.5 and 2.0.
2210.An Niels Provos
2211and
2212.An Markus Friedl
2213contributed support for privilege separation.
2214