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