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