2 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
3 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 .\" All rights reserved
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".
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.
16 .\" Redistribution and use in source and binary forms, with or without
17 .\" modification, are permitted provided that the following conditions
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.
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.
36 .\" $OpenBSD: sshd_config.5,v 1.281 2018/07/20 05:01:10 djm Exp $
38 .Dd $Mdocdate: July 20 2018 $
43 .Nd OpenSSH SSH daemon configuration file
46 reads configuration data from
47 .Pa /etc/ssh/sshd_config
48 (or the file specified with
51 The file contains keyword-argument pairs, one per line.
52 For each keyword, the first obtained value will be used.
55 and empty lines are interpreted as comments.
56 Arguments may optionally be enclosed in double quotes
58 in order to represent arguments containing spaces.
61 keywords and their meanings are as follows (note that
62 keywords are case-insensitive and arguments are case-sensitive):
65 Specifies what environment variables sent by the client will be copied into
74 for how to configure the client.
77 environment variable is always accepted whenever the client
78 requests a pseudo-terminal as it is required by the protocol.
79 Variables are specified by name, which may contain the wildcard characters
83 Multiple environment variables may be separated by whitespace or spread
87 Be warned that some environment variables could be used to bypass restricted
89 For this reason, care should be taken in the use of this directive.
90 The default is not to accept any environment variables.
92 Specifies which address family should be used by
101 .It Cm AllowAgentForwarding
104 forwarding is permitted.
107 Note that disabling agent forwarding does not improve security
108 unless users are also denied shell access, as they can always install
109 their own forwarders.
111 This keyword can be followed by a list of group name patterns, separated
113 If specified, login is allowed only for users whose primary
114 group or supplementary group list matches one of the patterns.
115 Only group names are valid; a numerical group ID is not recognized.
116 By default, login is allowed for all groups.
117 The allow/deny directives are processed in the following order:
126 for more information on patterns.
127 .It Cm AllowStreamLocalForwarding
128 Specifies whether StreamLocal (Unix-domain socket) forwarding is permitted.
129 The available options are
134 to allow StreamLocal forwarding,
136 to prevent all StreamLocal forwarding,
138 to allow local (from the perspective of
142 to allow remote forwarding only.
143 Note that disabling StreamLocal forwarding does not improve security unless
144 users are also denied shell access, as they can always install their
146 .It Cm AllowTcpForwarding
147 Specifies whether TCP forwarding is permitted.
148 The available options are
153 to allow TCP forwarding,
155 to prevent all TCP forwarding,
157 to allow local (from the perspective of
161 to allow remote forwarding only.
162 Note that disabling TCP forwarding does not improve security unless
163 users are also denied shell access, as they can always install their
166 This keyword can be followed by a list of user name patterns, separated
168 If specified, login is allowed only for user names that
169 match one of the patterns.
170 Only user names are valid; a numerical user ID is not recognized.
171 By default, login is allowed for all users.
172 If the pattern takes the form USER@HOST then USER and HOST
173 are separately checked, restricting logins to particular
174 users from particular hosts.
175 HOST criteria may additionally contain addresses to match in CIDR
176 address/masklen format.
177 The allow/deny directives are processed in the following order:
186 for more information on patterns.
187 .It Cm AuthenticationMethods
188 Specifies the authentication methods that must be successfully completed
189 for a user to be granted access.
190 This option must be followed by one or more lists of comma-separated
191 authentication method names, or by the single string
193 to indicate the default behaviour of accepting any single authentication
195 If the default is overridden, then successful authentication requires
196 completion of every method in at least one of these lists.
199 .Qq publickey,password publickey,keyboard-interactive
200 would require the user to complete public key authentication, followed by
201 either password or keyboard interactive authentication.
202 Only methods that are next in one or more lists are offered at each stage,
203 so for this example it would not be possible to attempt password or
204 keyboard-interactive authentication before public key.
206 For keyboard interactive authentication it is also possible to
207 restrict authentication to a specific device by appending a
208 colon followed by the device identifier
212 depending on the server configuration.
214 .Qq keyboard-interactive:bsdauth
215 would restrict keyboard interactive authentication to the
219 If the publickey method is listed more than once,
221 verifies that keys that have been used successfully are not reused for
222 subsequent authentications.
224 .Qq publickey,publickey
225 requires successful authentication using two different public keys.
227 Note that each authentication method listed should also be explicitly enabled
228 in the configuration.
230 The available authentication methods are:
231 .Qq gssapi-with-mic ,
233 .Qq keyboard-interactive ,
235 (used for access to password-less accounts when
236 .Cm PermitEmptyPasswords
241 .It Cm AuthorizedKeysCommand
242 Specifies a program to be used to look up the user's public keys.
243 The program must be owned by root, not writable by group or others and
244 specified by an absolute path.
246 .Cm AuthorizedKeysCommand
247 accept the tokens described in the
250 If no arguments are specified then the username of the target user is used.
252 The program should produce on standard output zero or
253 more lines of authorized_keys output (see
258 .Cm AuthorizedKeysCommand
259 does not successfully authenticate
260 and authorize the user then public key authentication continues using the usual
261 .Cm AuthorizedKeysFile
264 .Cm AuthorizedKeysCommand
266 .It Cm AuthorizedKeysCommandUser
267 Specifies the user under whose account the
268 .Cm AuthorizedKeysCommand
270 It is recommended to use a dedicated user that has no other role on the host
271 than running authorized keys commands.
273 .Cm AuthorizedKeysCommand
275 .Cm AuthorizedKeysCommandUser
278 will refuse to start.
279 .It Cm AuthorizedKeysFile
280 Specifies the file that contains the public keys used for user authentication.
281 The format is described in the
282 .Sx AUTHORIZED_KEYS FILE FORMAT
286 .Cm AuthorizedKeysFile
287 accept the tokens described in the
291 .Cm AuthorizedKeysFile
292 is taken to be an absolute path or one relative to the user's home
294 Multiple files may be listed, separated by whitespace.
295 Alternately this option may be set to
297 to skip checking for user keys in files.
299 .Qq .ssh/authorized_keys .ssh/authorized_keys2 .
300 .It Cm AuthorizedPrincipalsCommand
301 Specifies a program to be used to generate the list of allowed
302 certificate principals as per
303 .Cm AuthorizedPrincipalsFile .
304 The program must be owned by root, not writable by group or others and
305 specified by an absolute path.
307 .Cm AuthorizedPrincipalsCommand
308 accept the tokens described in the
311 If no arguments are specified then the username of the target user is used.
313 The program should produce on standard output zero or
315 .Cm AuthorizedPrincipalsFile
318 .Cm AuthorizedPrincipalsCommand
320 .Cm AuthorizedPrincipalsFile
321 is specified, then certificates offered by the client for authentication
322 must contain a principal that is listed.
324 .Cm AuthorizedPrincipalsCommand
326 .It Cm AuthorizedPrincipalsCommandUser
327 Specifies the user under whose account the
328 .Cm AuthorizedPrincipalsCommand
330 It is recommended to use a dedicated user that has no other role on the host
331 than running authorized principals commands.
333 .Cm AuthorizedPrincipalsCommand
335 .Cm AuthorizedPrincipalsCommandUser
338 will refuse to start.
339 .It Cm AuthorizedPrincipalsFile
340 Specifies a file that lists principal names that are accepted for
341 certificate authentication.
342 When using certificates signed by a key listed in
343 .Cm TrustedUserCAKeys ,
344 this file lists names, one of which must appear in the certificate for it
345 to be accepted for authentication.
346 Names are listed one per line preceded by key options (as described in
347 .Sx AUTHORIZED_KEYS FILE FORMAT
350 Empty lines and comments starting with
355 .Cm AuthorizedPrincipalsFile
356 accept the tokens described in the
360 .Cm AuthorizedPrincipalsFile
361 is taken to be an absolute path or one relative to the user's home directory.
364 i.e. not to use a principals file \(en in this case, the username
365 of the user must appear in a certificate's principals list for it to be
369 .Cm AuthorizedPrincipalsFile
370 is only used when authentication proceeds using a CA listed in
371 .Cm TrustedUserCAKeys
372 and is not consulted for certification authorities trusted via
373 .Pa ~/.ssh/authorized_keys ,
376 key option offers a similar facility (see
380 The contents of the specified file are sent to the remote user before
381 authentication is allowed.
384 then no banner is displayed.
385 By default, no banner is displayed.
386 .It Cm ChallengeResponseAuthentication
387 Specifies whether challenge-response authentication is allowed (e.g. via
388 PAM or through authentication styles supported in
392 .It Cm ChrootDirectory
393 Specifies the pathname of a directory to
395 to after authentication.
398 checks that all components of the pathname are root-owned directories
399 which are not writable by any other user or group.
402 changes the working directory to the user's home directory.
405 accept the tokens described in the
411 must contain the necessary files and directories to support the
413 For an interactive session this requires at least a shell, typically
426 For file transfer sessions using SFTP
427 no additional configuration of the environment is necessary if the in-process
429 though sessions which use logging may require
431 inside the chroot directory on some operating systems (see
435 For safety, it is very important that the directory hierarchy be
436 prevented from modification by other processes on the system (especially
437 those outside the jail).
438 Misconfiguration can lead to unsafe environments which
447 Specifies the ciphers allowed.
448 Multiple ciphers must be comma-separated.
449 If the specified value begins with a
451 character, then the specified ciphers will be appended to the default set
452 instead of replacing them.
453 If the specified value begins with a
455 character, then the specified ciphers (including wildcards) will be removed
456 from the default set instead of replacing them.
458 The supported ciphers are:
460 .Bl -item -compact -offset indent
476 aes128-gcm@openssh.com
478 aes256-gcm@openssh.com
480 chacha20-poly1305@openssh.com
484 .Bd -literal -offset indent
485 chacha20-poly1305@openssh.com,
486 aes128-ctr,aes192-ctr,aes256-ctr,
487 aes128-gcm@openssh.com,aes256-gcm@openssh.com,
488 aes128-cbc,aes192-cbc,aes256-cbc
491 The list of available ciphers may also be obtained using
493 .It Cm ClientAliveCountMax
494 Sets the number of client alive messages which may be sent without
496 receiving any messages back from the client.
497 If this threshold is reached while client alive messages are being sent,
498 sshd will disconnect the client, terminating the session.
499 It is important to note that the use of client alive messages is very
502 The client alive messages are sent through the encrypted channel
503 and therefore will not be spoofable.
504 The TCP keepalive option enabled by
507 The client alive mechanism is valuable when the client or
508 server depend on knowing when a connection has become inactive.
510 The default value is 3.
512 .Cm ClientAliveInterval
514 .Cm ClientAliveCountMax
515 is left at the default, unresponsive SSH clients
516 will be disconnected after approximately 45 seconds.
517 .It Cm ClientAliveInterval
518 Sets a timeout interval in seconds after which if no data has been received
521 will send a message through the encrypted
522 channel to request a response from the client.
524 is 0, indicating that these messages will not be sent to the client.
526 Specifies whether compression is enabled after
527 the user has authenticated successfully.
531 (a legacy synonym for
538 This keyword can be followed by a list of group name patterns, separated
540 Login is disallowed for users whose primary group or supplementary
541 group list matches one of the patterns.
542 Only group names are valid; a numerical group ID is not recognized.
543 By default, login is allowed for all groups.
544 The allow/deny directives are processed in the following order:
553 for more information on patterns.
555 This keyword can be followed by a list of user name patterns, separated
557 Login is disallowed for user names that match one of the patterns.
558 Only user names are valid; a numerical user ID is not recognized.
559 By default, login is allowed for all users.
560 If the pattern takes the form USER@HOST then USER and HOST
561 are separately checked, restricting logins to particular
562 users from particular hosts.
563 HOST criteria may additionally contain addresses to match in CIDR
564 address/masklen format.
565 The allow/deny directives are processed in the following order:
574 for more information on patterns.
575 .It Cm DisableForwarding
576 Disables all forwarding features, including X11,
579 This option overrides all other forwarding-related options and may
580 simplify restricted configurations.
581 .It Cm ExposeAuthInfo
582 Writes a temporary file containing a list of authentication methods and
583 public credentials (e.g. keys) used to authenticate the user.
584 The location of the file is exposed to the user session through the
586 environment variable.
589 .It Cm FingerprintHash
590 Specifies the hash algorithm used when logging key fingerprints.
598 Forces the execution of the command specified by
600 ignoring any command supplied by the client and
603 The command is invoked by using the user's login shell with the -c option.
604 This applies to shell, command, or subsystem execution.
605 It is most useful inside a
608 The command originally supplied by the client is available in the
609 .Ev SSH_ORIGINAL_COMMAND
610 environment variable.
611 Specifying a command of
613 will force the use of an in-process SFTP server that requires no support
615 .Cm ChrootDirectory .
619 Specifies whether remote hosts are allowed to connect to ports
620 forwarded for the client.
623 binds remote port forwardings to the loopback address.
624 This prevents other remote hosts from connecting to forwarded ports.
626 can be used to specify that sshd
627 should allow remote port forwardings to bind to non-loopback addresses, thus
628 allowing other hosts to connect.
631 to force remote port forwardings to be available to the local host only,
633 to force remote port forwardings to bind to the wildcard address, or
635 to allow the client to select the address to which the forwarding is bound.
638 .It Cm GSSAPIAuthentication
639 Specifies whether user authentication based on GSSAPI is allowed.
642 .It Cm GSSAPICleanupCredentials
643 Specifies whether to automatically destroy the user's credentials cache
647 .It Cm GSSAPIStrictAcceptorCheck
648 Determines whether to be strict about the identity of the GSSAPI acceptor
649 a client authenticates against.
652 then the client must authenticate against the host
653 service on the current hostname.
656 then the client may authenticate against any service key stored in the
657 machine's default store.
658 This facility is provided to assist with operation on multi homed machines.
661 .It Cm HostbasedAcceptedKeyTypes
662 Specifies the key types that will be accepted for hostbased authentication
663 as a list of comma-separated patterns.
664 Alternately if the specified value begins with a
666 character, then the specified key types will be appended to the default set
667 instead of replacing them.
668 If the specified value begins with a
670 character, then the specified key types (including wildcards) will be removed
671 from the default set instead of replacing them.
672 The default for this option is:
673 .Bd -literal -offset 3n
674 ecdsa-sha2-nistp256-cert-v01@openssh.com,
675 ecdsa-sha2-nistp384-cert-v01@openssh.com,
676 ecdsa-sha2-nistp521-cert-v01@openssh.com,
677 ssh-ed25519-cert-v01@openssh.com,
678 rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,
679 ssh-rsa-cert-v01@openssh.com,
680 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
681 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
684 The list of available key types may also be obtained using
686 .It Cm HostbasedAuthentication
687 Specifies whether rhosts or /etc/hosts.equiv authentication together
688 with successful public key client host authentication is allowed
689 (host-based authentication).
692 .It Cm HostbasedUsesNameFromPacketOnly
693 Specifies whether or not the server will attempt to perform a reverse
694 name lookup when matching the name in the
700 .Cm HostbasedAuthentication .
705 uses the name supplied by the client rather than
706 attempting to resolve the name from the TCP connection itself.
709 .It Cm HostCertificate
710 Specifies a file containing a public host certificate.
711 The certificate's public key must match a private host key already specified
714 The default behaviour of
716 is not to load any certificates.
718 Specifies a file containing a private host key
721 .Pa /etc/ssh/ssh_host_ecdsa_key ,
722 .Pa /etc/ssh/ssh_host_ed25519_key
724 .Pa /etc/ssh/ssh_host_rsa_key .
728 will refuse to use a file if it is group/world-accessible
730 .Cm HostKeyAlgorithms
731 option restricts which of the keys are actually used by
734 It is possible to have multiple host key files.
735 It is also possible to specify public host key files instead.
736 In this case operations on the private key will be delegated
740 Identifies the UNIX-domain socket used to communicate
741 with an agent that has access to the private host keys.
744 is specified, the location of the socket will be read from the
746 environment variable.
747 .It Cm HostKeyAlgorithms
748 Specifies the host key algorithms
749 that the server offers.
750 The default for this option is:
751 .Bd -literal -offset 3n
752 ecdsa-sha2-nistp256-cert-v01@openssh.com,
753 ecdsa-sha2-nistp384-cert-v01@openssh.com,
754 ecdsa-sha2-nistp521-cert-v01@openssh.com,
755 ssh-ed25519-cert-v01@openssh.com,
756 rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,
757 ssh-rsa-cert-v01@openssh.com,
758 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
759 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
762 The list of available key types may also be obtained using
769 files will not be used in
770 .Cm HostbasedAuthentication .
774 .Pa /etc/ssh/shosts.equiv
778 .It Cm IgnoreUserKnownHosts
781 should ignore the user's
782 .Pa ~/.ssh/known_hosts
784 .Cm HostbasedAuthentication
785 and use only the system-wide known hosts file
786 .Pa /etc/ssh/known_hosts .
790 Specifies the IPv4 type-of-service or DSCP class for the connection.
818 to use the operating system default.
819 This option may take one or two arguments, separated by whitespace.
820 If one argument is specified, it is used as the packet class unconditionally.
821 If two values are specified, the first is automatically selected for
822 interactive sessions and the second for non-interactive sessions.
826 for interactive sessions and
829 for non-interactive sessions.
830 .It Cm KbdInteractiveAuthentication
831 Specifies whether to allow keyboard-interactive authentication.
832 The argument to this keyword must be
836 The default is to use whatever value
837 .Cm ChallengeResponseAuthentication
841 .It Cm KerberosAuthentication
842 Specifies whether the password provided by the user for
843 .Cm PasswordAuthentication
844 will be validated through the Kerberos KDC.
845 To use this option, the server needs a
846 Kerberos servtab which allows the verification of the KDC's identity.
849 .It Cm KerberosGetAFSToken
850 If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
851 an AFS token before accessing the user's home directory.
854 .It Cm KerberosOrLocalPasswd
855 If password authentication through Kerberos fails then
856 the password will be validated via any additional local mechanism
861 .It Cm KerberosTicketCleanup
862 Specifies whether to automatically destroy the user's ticket cache
867 Specifies the available KEX (Key Exchange) algorithms.
868 Multiple algorithms must be comma-separated.
869 Alternately if the specified value begins with a
871 character, then the specified methods will be appended to the default set
872 instead of replacing them.
873 If the specified value begins with a
875 character, then the specified methods (including wildcards) will be removed
876 from the default set instead of replacing them.
877 The supported algorithms are:
879 .Bl -item -compact -offset indent
883 curve25519-sha256@libssh.org
885 diffie-hellman-group1-sha1
887 diffie-hellman-group14-sha1
889 diffie-hellman-group14-sha256
891 diffie-hellman-group16-sha512
893 diffie-hellman-group18-sha512
895 diffie-hellman-group-exchange-sha1
897 diffie-hellman-group-exchange-sha256
907 .Bd -literal -offset indent
908 curve25519-sha256,curve25519-sha256@libssh.org,
909 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
910 diffie-hellman-group-exchange-sha256,
911 diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,
912 diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
915 The list of available key exchange algorithms may also be obtained using
918 Specifies the local addresses
921 The following forms may be used:
923 .Bl -item -offset indent -compact
927 .Ar hostname | address
929 .Op Cm rdomain Ar domain
935 .Op Cm rdomain Ar domain
939 .Ar IPv4_address : port
941 .Op Cm rdomain Ar domain
945 .Oo Ar hostname | address Oc : Ar port
947 .Op Cm rdomain Ar domain
954 listen in an explicit routing domain.
958 sshd will listen on the address and all
961 The default is to listen on all local addresses on the current default
965 options are permitted.
966 For more information on routing domains, see
968 .It Cm LoginGraceTime
969 The server disconnects after this time if the user has not
970 successfully logged in.
971 If the value is 0, there is no time limit.
972 The default is 120 seconds.
974 Gives the verbosity level that is used when logging messages from
976 The possible values are:
977 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
979 DEBUG and DEBUG1 are equivalent.
980 DEBUG2 and DEBUG3 each specify higher levels of debugging output.
981 Logging with a DEBUG level violates the privacy of users and is not recommended.
983 Specifies the available MAC (message authentication code) algorithms.
984 The MAC algorithm is used for data integrity protection.
985 Multiple algorithms must be comma-separated.
986 If the specified value begins with a
988 character, then the specified algorithms will be appended to the default set
989 instead of replacing them.
990 If the specified value begins with a
992 character, then the specified algorithms (including wildcards) will be removed
993 from the default set instead of replacing them.
995 The algorithms that contain
997 calculate the MAC after encryption (encrypt-then-mac).
998 These are considered safer and their use recommended.
999 The supported MACs are:
1001 .Bl -item -compact -offset indent
1017 umac-128@openssh.com
1019 hmac-md5-etm@openssh.com
1021 hmac-md5-96-etm@openssh.com
1023 hmac-sha1-etm@openssh.com
1025 hmac-sha1-96-etm@openssh.com
1027 hmac-sha2-256-etm@openssh.com
1029 hmac-sha2-512-etm@openssh.com
1031 umac-64-etm@openssh.com
1033 umac-128-etm@openssh.com
1037 .Bd -literal -offset indent
1038 umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1039 hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1040 hmac-sha1-etm@openssh.com,
1041 umac-64@openssh.com,umac-128@openssh.com,
1042 hmac-sha2-256,hmac-sha2-512,hmac-sha1
1045 The list of available MAC algorithms may also be obtained using
1048 Introduces a conditional block.
1049 If all of the criteria on the
1051 line are satisfied, the keywords on the following lines override those
1052 set in the global section of the config file, until either another
1054 line or the end of the file.
1055 If a keyword appears in multiple
1057 blocks that are satisfied, only the first instance of the keyword is
1062 are one or more criteria-pattern pairs or the single token
1064 which matches all criteria.
1065 The available criteria are
1078 on which the connection was received.)
1080 The match patterns may consist of single entries or comma-separated
1081 lists and may use the wildcard and negation operators described in the
1088 criteria may additionally contain addresses to match in CIDR
1089 address/masklen format,
1090 such as 192.0.2.0/24 or 2001:db8::/32.
1091 Note that the mask length provided must be consistent with the address -
1092 it is an error to specify a mask length that is too long for the address
1093 or one with bits set in this host portion of the address.
1094 For example, 192.0.2.0/33 and 192.0.2.0/8, respectively.
1096 Only a subset of keywords may be used on the lines following a
1099 Available keywords are
1101 .Cm AllowAgentForwarding ,
1103 .Cm AllowStreamLocalForwarding ,
1104 .Cm AllowTcpForwarding ,
1106 .Cm AuthenticationMethods ,
1107 .Cm AuthorizedKeysCommand ,
1108 .Cm AuthorizedKeysCommandUser ,
1109 .Cm AuthorizedKeysFile ,
1110 .Cm AuthorizedPrincipalsCommand ,
1111 .Cm AuthorizedPrincipalsCommandUser ,
1112 .Cm AuthorizedPrincipalsFile ,
1114 .Cm ChrootDirectory ,
1115 .Cm ClientAliveCountMax ,
1116 .Cm ClientAliveInterval ,
1121 .Cm GSSAPIAuthentication ,
1122 .Cm HostbasedAcceptedKeyTypes ,
1123 .Cm HostbasedAuthentication ,
1124 .Cm HostbasedUsesNameFromPacketOnly ,
1126 .Cm KbdInteractiveAuthentication ,
1127 .Cm KerberosAuthentication ,
1131 .Cm PasswordAuthentication ,
1132 .Cm PermitEmptyPasswords ,
1135 .Cm PermitRootLogin ,
1139 .Cm PubkeyAcceptedKeyTypes ,
1140 .Cm PubkeyAuthentication ,
1145 .Cm StreamLocalBindMask ,
1146 .Cm StreamLocalBindUnlink ,
1147 .Cm TrustedUserCAKeys ,
1148 .Cm X11DisplayOffset ,
1151 .Cm X11UseLocalHost .
1153 Specifies the maximum number of authentication attempts permitted per
1155 Once the number of failures reaches half this value,
1156 additional failures are logged.
1159 Specifies the maximum number of open shell, login or subsystem (e.g. sftp)
1160 sessions permitted per network connection.
1161 Multiple sessions may be established by clients that support connection
1165 to 1 will effectively disable session multiplexing, whereas setting it to 0
1166 will prevent all shell, login and subsystem sessions while still permitting
1170 Specifies the maximum number of concurrent unauthenticated connections to the
1172 Additional connections will be dropped until authentication succeeds or the
1174 expires for a connection.
1175 The default is 10:30:100.
1177 Alternatively, random early drop can be enabled by specifying
1178 the three colon separated values
1179 start:rate:full (e.g. "10:30:60").
1181 will refuse connection attempts with a probability of rate/100 (30%)
1182 if there are currently start (10) unauthenticated connections.
1183 The probability increases linearly and all connection attempts
1184 are refused if the number of unauthenticated connections reaches full (60).
1185 .It Cm PasswordAuthentication
1186 Specifies whether password authentication is allowed.
1191 .It Cm PermitEmptyPasswords
1192 When password authentication is allowed, it specifies whether the
1193 server allows login to accounts with empty password strings.
1197 Specifies the addresses/ports on which a remote TCP port forwarding may listen.
1198 The listen specification must be one of the following forms:
1200 .Bl -item -offset indent -compact
1213 Multiple permissions may be specified by separating them with whitespace.
1216 can be used to remove all restrictions and permit any listen requests.
1219 can be used to prohibit all listen requests.
1220 The host name may contain wildcards as described in the PATTERNS section in
1224 can also be used in place of a port number to allow all ports.
1225 By default all port forwarding listen requests are permitted.
1228 option may further restrict which addresses may be listened on.
1231 will request a listen host of
1233 if no listen host was specifically requested, and this this name is
1234 treated differently to explicit localhost addresses of
1239 Specifies the destinations to which TCP port forwarding is permitted.
1240 The forwarding specification must be one of the following forms:
1242 .Bl -item -offset indent -compact
1251 .Ar IPv4_addr : port
1256 .Ar \&[ IPv6_addr \&] : port
1260 Multiple forwards may be specified by separating them with whitespace.
1263 can be used to remove all restrictions and permit any forwarding requests.
1266 can be used to prohibit all forwarding requests.
1269 can be used for host or port to allow all hosts or ports, respectively.
1270 By default all port forwarding requests are permitted.
1271 .It Cm PermitRootLogin
1272 Specifies whether root can log in using
1274 The argument must be
1276 .Cm prohibit-password ,
1277 .Cm forced-commands-only ,
1283 .Cm ChallengeResponseAuthentication
1288 this setting may be overridden by the PAM policy.
1290 If this option is set to
1291 .Cm prohibit-password
1292 (or its deprecated alias,
1293 .Cm without-password ) ,
1294 password and keyboard-interactive authentication are disabled for root.
1296 If this option is set to
1297 .Cm forced-commands-only ,
1298 root login with public key authentication will be allowed,
1301 option has been specified
1302 (which may be useful for taking remote backups even if root login is
1303 normally not allowed).
1304 All other authentication methods are disabled for root.
1306 If this option is set to
1308 root is not allowed to log in.
1312 allocation is permitted.
1318 device forwarding is allowed.
1319 The argument must be
1335 Independent of this setting, the permissions of the selected
1337 device must allow access to the user.
1338 .It Cm PermitUserEnvironment
1340 .Pa ~/.ssh/environment
1344 .Pa ~/.ssh/authorized_keys
1350 or a pattern-list specifying which environment variable names to accept
1355 Enabling environment processing may enable users to bypass access
1356 restrictions in some configurations using mechanisms such as
1359 Specifies whether any
1365 Specifies the file that contains the process ID of the
1370 .Pa /var/run/sshd.pid .
1372 Specifies the port number that
1376 Multiple options of this type are permitted.
1382 should print the date and time of the last user login when a user logs
1391 when a user logs in interactively.
1392 (On some systems it is also printed by the shell,
1397 .It Cm PubkeyAcceptedKeyTypes
1398 Specifies the key types that will be accepted for public key authentication
1399 as a list of comma-separated patterns.
1400 Alternately if the specified value begins with a
1402 character, then the specified key types will be appended to the default set
1403 instead of replacing them.
1404 If the specified value begins with a
1406 character, then the specified key types (including wildcards) will be removed
1407 from the default set instead of replacing them.
1408 The default for this option is:
1409 .Bd -literal -offset 3n
1410 ecdsa-sha2-nistp256-cert-v01@openssh.com,
1411 ecdsa-sha2-nistp384-cert-v01@openssh.com,
1412 ecdsa-sha2-nistp521-cert-v01@openssh.com,
1413 ssh-ed25519-cert-v01@openssh.com,
1414 rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,
1415 ssh-rsa-cert-v01@openssh.com,
1416 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1417 ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
1420 The list of available key types may also be obtained using
1422 .It Cm PubkeyAuthentication
1423 Specifies whether public key authentication is allowed.
1427 Specifies the maximum amount of data that may be transmitted before the
1428 session key is renegotiated, optionally followed a maximum amount of
1429 time that may pass before the session key is renegotiated.
1430 The first argument is specified in bytes and may have a suffix of
1435 to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1436 The default is between
1440 depending on the cipher.
1441 The optional second value is specified in seconds and may use any of the
1442 units documented in the
1445 The default value for
1449 which means that rekeying is performed after the cipher's default amount
1450 of data has been sent or received and no time based rekeying is done.
1452 Specifies revoked public keys file, or
1455 Keys listed in this file will be refused for public key authentication.
1456 Note that if this file is not readable, then public key authentication will
1457 be refused for all users.
1458 Keys may be specified as a text file, listing one public key per line, or as
1459 an OpenSSH Key Revocation List (KRL) as generated by
1461 For more information on KRLs, see the KEY REVOCATION LISTS section in
1464 Specifies an explicit routing domain that is applied after authentication
1466 The user session, as well and any forwarded or listening IP sockets,
1467 will be bound to this
1469 If the routing domain is set to
1471 then the domain in which the incoming connection was received will be applied.
1473 Specifies one or more environment variables to set in child sessions started
1478 The environment value may be quoted (e.g. if it contains whitespace
1480 Environment variables set by
1482 override the default environment and any variables specified by the user
1486 .Cm PermitUserEnvironment .
1487 .It Cm StreamLocalBindMask
1488 Sets the octal file creation mode mask
1490 used when creating a Unix-domain socket file for local or remote
1492 This option is only used for port forwarding to a Unix-domain socket file.
1494 The default value is 0177, which creates a Unix-domain socket file that is
1495 readable and writable only by the owner.
1496 Note that not all operating systems honor the file mode on Unix-domain
1498 .It Cm StreamLocalBindUnlink
1499 Specifies whether to remove an existing Unix-domain socket file for local
1500 or remote port forwarding before creating a new one.
1501 If the socket file already exists and
1502 .Cm StreamLocalBindUnlink
1505 will be unable to forward the port to the Unix-domain socket file.
1506 This option is only used for port forwarding to a Unix-domain socket file.
1508 The argument must be
1517 should check file modes and ownership of the
1518 user's files and home directory before accepting login.
1519 This is normally desirable because novices sometimes accidentally leave their
1520 directory or files world-writable.
1523 Note that this does not apply to
1524 .Cm ChrootDirectory ,
1525 whose permissions and ownership are checked unconditionally.
1527 Configures an external subsystem (e.g. file transfer daemon).
1528 Arguments should be a subsystem name and a command (with optional arguments)
1529 to execute upon subsystem request.
1533 implements the SFTP file transfer subsystem.
1535 Alternately the name
1537 implements an in-process SFTP server.
1538 This may simplify configurations using
1540 to force a different filesystem root on clients.
1542 By default no subsystems are defined.
1543 .It Cm SyslogFacility
1544 Gives the facility code that is used when logging messages from
1546 The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1547 LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1548 The default is AUTH.
1550 Specifies whether the system should send TCP keepalive messages to the
1552 If they are sent, death of the connection or crash of one
1553 of the machines will be properly noticed.
1554 However, this means that
1555 connections will die if the route is down temporarily, and some people
1557 On the other hand, if TCP keepalives are not sent,
1558 sessions may hang indefinitely on the server, leaving
1560 users and consuming server resources.
1564 (to send TCP keepalive messages), and the server will notice
1565 if the network goes down or the client host crashes.
1566 This avoids infinitely hanging sessions.
1568 To disable TCP keepalive messages, the value should be set to
1570 .It Cm TrustedUserCAKeys
1571 Specifies a file containing public keys of certificate authorities that are
1572 trusted to sign user certificates for authentication, or
1575 Keys are listed one per line; empty lines and comments starting with
1578 If a certificate is presented for authentication and has its signing CA key
1579 listed in this file, then it may be used for authentication for any user
1580 listed in the certificate's principals list.
1581 Note that certificates that lack a list of principals will not be permitted
1582 for authentication using
1583 .Cm TrustedUserCAKeys .
1584 For more details on certificates, see the CERTIFICATES section in
1589 attempts to send authentication success and failure messages
1598 should look up the remote host name, and to check that
1599 the resolved host name for the remote IP address maps back to the
1600 very same IP address.
1602 If this option is set to
1604 then only addresses and not host names may be used in
1605 .Pa ~/.ssh/authorized_keys
1615 Enables the Pluggable Authentication Module interface.
1618 this will enable PAM authentication using
1619 .Cm ChallengeResponseAuthentication
1621 .Cm PasswordAuthentication
1622 in addition to PAM account and session module processing for all
1623 authentication types.
1625 Because PAM challenge-response authentication usually serves an equivalent
1626 role to password authentication, you should disable either
1627 .Cm PasswordAuthentication
1629 .Cm ChallengeResponseAuthentication.
1633 is enabled, you will not be able to run
1638 .It Cm VersionAddendum
1639 Optionally specifies additional text to append to the SSH protocol banner
1640 sent by the server upon connection.
1642 .Qq FreeBSD-20180909 .
1645 may be used to disable this.
1646 .It Cm X11DisplayOffset
1647 Specifies the first display number available for
1650 This prevents sshd from interfering with real X11 servers.
1652 .It Cm X11Forwarding
1653 Specifies whether X11 forwarding is permitted.
1654 The argument must be
1661 When X11 forwarding is enabled, there may be additional exposure to
1662 the server and to client displays if the
1664 proxy display is configured to listen on the wildcard address (see
1665 .Cm X11UseLocalhost ) ,
1666 though this is not the default.
1667 Additionally, the authentication spoofing and authentication data
1668 verification and substitution occur on the client side.
1669 The security risk of using X11 forwarding is that the client's X11
1670 display server may be exposed to attack when the SSH client requests
1671 forwarding (see the warnings for
1674 .Xr ssh_config 5 ) .
1675 A system administrator may have a stance in which they want to
1676 protect clients that may expose themselves to attack by unwittingly
1677 requesting X11 forwarding, which can warrant a
1681 Note that disabling X11 forwarding does not prevent users from
1682 forwarding X11 traffic, as users can always install their own forwarders.
1683 .It Cm X11UseLocalhost
1686 should bind the X11 forwarding server to the loopback address or to
1687 the wildcard address.
1689 sshd binds the forwarding server to the loopback address and sets the
1690 hostname part of the
1692 environment variable to
1694 This prevents remote hosts from connecting to the proxy display.
1695 However, some older X11 clients may not function with this
1700 to specify that the forwarding server should be bound to the wildcard
1702 The argument must be
1708 .It Cm XAuthLocation
1709 Specifies the full pathname of the
1715 .Pa /usr/local/bin/xauth .
1719 command-line arguments and configuration file options that specify time
1720 may be expressed using a sequence of the form:
1722 .Ar time Op Ar qualifier ,
1726 is a positive integer value and
1728 is one of the following:
1730 .Bl -tag -width Ds -compact -offset indent
1745 Each member of the sequence is added together to calculate
1746 the total time value.
1748 Time format examples:
1750 .Bl -tag -width Ds -compact -offset indent
1752 600 seconds (10 minutes)
1756 1 hour 30 minutes (90 minutes)
1759 Arguments to some keywords can make use of tokens,
1760 which are expanded at runtime:
1762 .Bl -tag -width XXXX -offset indent -compact
1767 The routing domain in which the incoming connection was received.
1769 The fingerprint of the CA key.
1771 The fingerprint of the key or certificate.
1773 The home directory of the user.
1775 The key ID in the certificate.
1777 The base64-encoded CA key.
1779 The base64-encoded key or certificate for authentication.
1781 The serial number of the certificate.
1783 The type of the CA key.
1785 The key or certificate type.
1787 The numeric user ID of the target user.
1792 .Cm AuthorizedKeysCommand
1793 accepts the tokens %%, %f, %h, %k, %t, %U, and %u.
1795 .Cm AuthorizedKeysFile
1796 accepts the tokens %%, %h, %U, and %u.
1798 .Cm AuthorizedPrincipalsCommand
1799 accepts the tokens %%, %F, %f, %h, %i, %K, %k, %s, %T, %t, %U, and %u.
1801 .Cm AuthorizedPrincipalsFile
1802 accepts the tokens %%, %h, %U, and %u.
1805 accepts the tokens %%, %h, %U, and %u.
1808 accepts the token %D.
1811 .It Pa /etc/ssh/sshd_config
1812 Contains configuration data for
1814 This file should be writable by root only, but it is recommended
1815 (though not necessary) that it be world-readable.
1822 OpenSSH is a derivative of the original and free
1823 ssh 1.2.12 release by
1825 .An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos ,
1829 removed many bugs, re-added newer features and
1832 contributed the support for SSH protocol versions 1.5 and 2.0.
1836 contributed support for privilege separation.