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.220 2016/02/17 08:57:34 djm Exp $
38 .Dd $Mdocdate: February 17 2016 $
43 .Nd OpenSSH SSH daemon configuration file
45 .Nm /etc/ssh/sshd_config
48 reads configuration data from
49 .Pa /etc/ssh/sshd_config
50 (or the file specified with
53 The file contains keyword-argument pairs, one per line.
56 and empty lines are interpreted as comments.
57 Arguments may optionally be enclosed in double quotes
59 in order to represent arguments containing spaces.
62 keywords and their meanings are as follows (note that
63 keywords are case-insensitive and arguments are case-sensitive):
66 Specifies what environment variables sent by the client will be copied into
73 for how to configure the client.
76 environment variable is always sent whenever the client
77 requests a pseudo-terminal as it is required by the protocol.
78 Variables are specified by name, which may contain the wildcard characters
82 Multiple environment variables may be separated by whitespace or spread
86 Be warned that some environment variables could be used to bypass restricted
88 For this reason, care should be taken in the use of this directive.
89 The default is not to accept any environment variables.
91 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 AllowTcpForwarding
128 Specifies whether TCP forwarding is permitted.
129 The available options are
133 to allow TCP forwarding,
135 to prevent all TCP forwarding,
137 to allow local (from the perspective of
141 to allow remote forwarding only.
144 Note that disabling TCP forwarding does not improve security unless
145 users are also denied shell access, as they can always install their
147 .It Cm AllowStreamLocalForwarding
148 Specifies whether StreamLocal (Unix-domain socket) forwarding is permitted.
149 The available options are
153 to allow StreamLocal forwarding,
155 to prevent all StreamLocal forwarding,
157 to allow local (from the perspective of
161 to allow remote forwarding only.
164 Note that disabling StreamLocal forwarding does not improve security unless
165 users are also denied shell access, as they can always install their
168 This keyword can be followed by a list of user name patterns, separated
170 If specified, login is allowed only for user names that
171 match one of the patterns.
172 Only user names are valid; a numerical user ID is not recognized.
173 By default, login is allowed for all users.
174 If the pattern takes the form USER@HOST then USER and HOST
175 are separately checked, restricting logins to particular
176 users from particular hosts.
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 comma-separated lists of
191 authentication method names.
192 Successful authentication requires completion of every method in at least
195 For example, an argument of
196 .Dq publickey,password publickey,keyboard-interactive
197 would require the user to complete public key authentication, followed by
198 either password or keyboard interactive authentication.
199 Only methods that are next in one or more lists are offered at each stage,
200 so for this example, it would not be possible to attempt password or
201 keyboard-interactive authentication before public key.
203 For keyboard interactive authentication it is also possible to
204 restrict authentication to a specific device by appending a
205 colon followed by the device identifier
210 depending on the server configuration.
212 .Dq keyboard-interactive:bsdauth
213 would restrict keyboard interactive authentication to the
219 method is listed more than once,
221 verifies that keys that have been used successfully are not reused for
222 subsequent authentications.
224 .Cm AuthenticationMethods
226 .Dq publickey,publickey
227 will require successful authentication using two different public keys.
229 This option will yield a fatal
230 error if enabled if protocol 1 is also enabled.
231 Note that each authentication method listed should also be explicitly enabled
232 in the configuration.
233 The default is not to require multiple authentication; successful completion
234 of a single authentication method is sufficient.
235 .It Cm AuthorizedKeysCommand
236 Specifies a program to be used to look up the user's public keys.
237 The program must be owned by root, not writable by group or others and
238 specified by an absolute path.
241 .Cm AuthorizedKeysCommand
242 may be provided using the following tokens, which will be expanded
243 at runtime: %% is replaced by a literal '%', %u is replaced by the
244 username being authenticated, %h is replaced by the home directory
245 of the user being authenticated, %t is replaced with the key type
246 offered for authentication, %f is replaced with the fingerprint of
247 the key, and %k is replaced with the key being offered for authentication.
248 If no arguments are specified then the username of the target user
251 The program should produce on standard output zero or
252 more lines of authorized_keys output (see AUTHORIZED_KEYS in
254 If a key supplied by AuthorizedKeysCommand does not successfully authenticate
255 and authorize the user then public key authentication continues using the usual
256 .Cm AuthorizedKeysFile
258 By default, no AuthorizedKeysCommand is run.
259 .It Cm AuthorizedKeysCommandUser
260 Specifies the user under whose account the AuthorizedKeysCommand is run.
261 It is recommended to use a dedicated user that has no other role on the host
262 than running authorized keys commands.
264 .Cm AuthorizedKeysCommand
266 .Cm AuthorizedKeysCommandUser
269 will refuse to start.
270 .It Cm AuthorizedKeysFile
271 Specifies the file that contains the public keys that can be used
272 for user authentication.
273 The format is described in the
274 AUTHORIZED_KEYS FILE FORMAT
277 .Cm AuthorizedKeysFile
278 may contain tokens of the form %T which are substituted during connection
280 The following tokens are defined: %% is replaced by a literal '%',
281 %h is replaced by the home directory of the user being authenticated, and
282 %u is replaced by the username of that user.
284 .Cm AuthorizedKeysFile
285 is taken to be an absolute path or one relative to the user's home
287 Multiple files may be listed, separated by whitespace.
288 Alternately this option may be set to
290 to skip checking for user keys in files.
292 .Dq .ssh/authorized_keys .ssh/authorized_keys2 .
293 .It Cm AuthorizedPrincipalsCommand
294 Specifies a program to be used to generate the list of allowed
295 certificate principals as per
296 .Cm AuthorizedPrincipalsFile .
297 The program must be owned by root, not writable by group or others and
298 specified by an absolute path.
301 .Cm AuthorizedPrincipalsCommand
302 may be provided using the following tokens, which will be expanded
303 at runtime: %% is replaced by a literal '%', %u is replaced by the
304 username being authenticated and %h is replaced by the home directory
305 of the user being authenticated.
307 The program should produce on standard output zero or
309 .Cm AuthorizedPrincipalsFile
312 .Cm AuthorizedPrincipalsCommand
314 .Cm AuthorizedPrincipalsFile
315 is specified, then certificates offered by the client for authentication
316 must contain a principal that is listed.
317 By default, no AuthorizedPrincipalsCommand is run.
318 .It Cm AuthorizedPrincipalsCommandUser
319 Specifies the user under whose account the AuthorizedPrincipalsCommand is run.
320 It is recommended to use a dedicated user that has no other role on the host
321 than running authorized principals commands.
323 .Cm AuthorizedPrincipalsCommand
325 .Cm AuthorizedPrincipalsCommandUser
328 will refuse to start.
329 .It Cm AuthorizedPrincipalsFile
330 Specifies a file that lists principal names that are accepted for
331 certificate authentication.
332 When using certificates signed by a key listed in
333 .Cm TrustedUserCAKeys ,
334 this file lists names, one of which must appear in the certificate for it
335 to be accepted for authentication.
336 Names are listed one per line preceded by key options (as described
337 in AUTHORIZED_KEYS FILE FORMAT in
339 Empty lines and comments starting with
343 .Cm AuthorizedPrincipalsFile
344 may contain tokens of the form %T which are substituted during connection
346 The following tokens are defined: %% is replaced by a literal '%',
347 %h is replaced by the home directory of the user being authenticated, and
348 %u is replaced by the username of that user.
350 .Cm AuthorizedPrincipalsFile
351 is taken to be an absolute path or one relative to the user's home
356 i.e. not to use a principals file \(en in this case, the username
357 of the user must appear in a certificate's principals list for it to be
360 .Cm AuthorizedPrincipalsFile
361 is only used when authentication proceeds using a CA listed in
362 .Cm TrustedUserCAKeys
363 and is not consulted for certification authorities trusted via
364 .Pa ~/.ssh/authorized_keys ,
367 key option offers a similar facility (see
371 The contents of the specified file are sent to the remote user before
372 authentication is allowed.
375 then no banner is displayed.
376 By default, no banner is displayed.
377 .It Cm ChallengeResponseAuthentication
378 Specifies whether challenge-response authentication is allowed (e.g. via
379 PAM or through authentication styles supported in
383 .It Cm ChrootDirectory
384 Specifies the pathname of a directory to
386 to after authentication.
389 checks that all components of the pathname are root-owned directories
390 which are not writable by any other user or group.
393 changes the working directory to the user's home directory.
395 The pathname may contain the following tokens that are expanded at runtime once
396 the connecting user has been authenticated: %% is replaced by a literal '%',
397 %h is replaced by the home directory of the user being authenticated, and
398 %u is replaced by the username of that user.
402 must contain the necessary files and directories to support the
404 For an interactive session this requires at least a shell, typically
417 For file transfer sessions using
419 no additional configuration of the environment is necessary if the
420 in-process sftp server is used,
421 though sessions which use logging may require
423 inside the chroot directory on some operating systems (see
427 For safety, it is very important that the directory hierarchy be
428 prevented from modification by other processes on the system (especially
429 those outside the jail).
430 Misconfiguration can lead to unsafe environments which
439 Specifies the ciphers allowed.
440 Multiple ciphers must be comma-separated.
441 If the specified value begins with a
443 character, then the specified ciphers will be appended to the default set
444 instead of replacing them.
446 The supported ciphers are:
448 .Bl -item -compact -offset indent
464 aes128-gcm@openssh.com
466 aes256-gcm@openssh.com
478 chacha20-poly1305@openssh.com
482 .Bd -literal -offset indent
483 chacha20-poly1305@openssh.com,
484 aes128-ctr,aes192-ctr,aes256-ctr,
485 aes128-gcm@openssh.com,aes256-gcm@openssh.com,
486 aes128-cbc,aes192-cbc,aes256-cbc
489 The list of available ciphers may also be obtained using the
495 .It Cm ClientAliveCountMax
496 Sets the number of client alive messages (see below) which may be
499 receiving any messages back from the client.
500 If this threshold is reached while client alive messages are being sent,
501 sshd will disconnect the client, terminating the session.
502 It is important to note that the use of client alive messages is very
506 The client alive messages are sent through the encrypted channel
507 and therefore will not be spoofable.
508 The TCP keepalive option enabled by
511 The client alive mechanism is valuable when the client or
512 server depend on knowing when a connection has become inactive.
514 The default value is 3.
516 .Cm ClientAliveInterval
517 (see below) is set to 15, and
518 .Cm ClientAliveCountMax
519 is left at the default, unresponsive SSH clients
520 will be disconnected after approximately 45 seconds.
521 .It Cm ClientAliveInterval
522 Sets a timeout interval in seconds after which if no data has been received
525 will send a message through the encrypted
526 channel to request a response from the client.
528 is 0, indicating that these messages will not be sent to the client.
530 Specifies whether compression is allowed, or delayed until
531 the user has authenticated successfully.
540 This keyword can be followed by a list of group name patterns, separated
542 Login is disallowed for users whose primary group or supplementary
543 group list matches one of the patterns.
544 Only group names are valid; a numerical group ID is not recognized.
545 By default, login is allowed for all groups.
546 The allow/deny directives are processed in the following order:
555 for more information on patterns.
557 This keyword can be followed by a list of user name patterns, separated
559 Login is disallowed for user names that match one of the patterns.
560 Only user names are valid; a numerical user ID is not recognized.
561 By default, login is allowed for all users.
562 If the pattern takes the form USER@HOST then USER and HOST
563 are separately checked, restricting logins to particular
564 users from particular hosts.
565 The allow/deny directives are processed in the following order:
574 for more information on patterns.
575 .It Cm FingerprintHash
576 Specifies the hash algorithm used when logging key fingerprints.
584 Forces the execution of the command specified by
586 ignoring any command supplied by the client and
589 The command is invoked by using the user's login shell with the -c option.
590 This applies to shell, command, or subsystem execution.
591 It is most useful inside a
594 The command originally supplied by the client is available in the
595 .Ev SSH_ORIGINAL_COMMAND
596 environment variable.
597 Specifying a command of
599 will force the use of an in-process sftp server that requires no support
601 .Cm ChrootDirectory .
605 Specifies whether remote hosts are allowed to connect to ports
606 forwarded for the client.
609 binds remote port forwardings to the loopback address.
610 This prevents other remote hosts from connecting to forwarded ports.
612 can be used to specify that sshd
613 should allow remote port forwardings to bind to non-loopback addresses, thus
614 allowing other hosts to connect.
617 to force remote port forwardings to be available to the local host only,
619 to force remote port forwardings to bind to the wildcard address, or
621 to allow the client to select the address to which the forwarding is bound.
624 .It Cm GSSAPIAuthentication
625 Specifies whether user authentication based on GSSAPI is allowed.
628 .It Cm GSSAPICleanupCredentials
629 Specifies whether to automatically destroy the user's credentials cache
633 .It Cm GSSAPIStrictAcceptorCheck
634 Determines whether to be strict about the identity of the GSSAPI acceptor
635 a client authenticates against.
638 then the client must authenticate against the
640 service on the current hostname.
643 then the client may authenticate against any service key stored in the
644 machine's default store.
645 This facility is provided to assist with operation on multi homed machines.
648 .It Cm HostbasedAcceptedKeyTypes
649 Specifies the key types that will be accepted for hostbased authentication
650 as a comma-separated pattern list.
651 Alternately if the specified value begins with a
653 character, then the specified key types will be appended to the default set
654 instead of replacing them.
655 The default for this option is:
656 .Bd -literal -offset 3n
657 ecdsa-sha2-nistp256-cert-v01@openssh.com,
658 ecdsa-sha2-nistp384-cert-v01@openssh.com,
659 ecdsa-sha2-nistp521-cert-v01@openssh.com,
660 ssh-ed25519-cert-v01@openssh.com,
661 ssh-rsa-cert-v01@openssh.com,
662 ssh-dss-cert-v01@openssh.com,
663 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,
664 ecdsa-sha2-nistp521,ssh-ed25519,
672 may be used to list supported key types.
673 .It Cm HostbasedAuthentication
674 Specifies whether rhosts or /etc/hosts.equiv authentication together
675 with successful public key client host authentication is allowed
676 (host-based authentication).
679 .It Cm HostbasedUsesNameFromPacketOnly
680 Specifies whether or not the server will attempt to perform a reverse
681 name lookup when matching the name in the
687 .Cm HostbasedAuthentication .
692 uses the name supplied by the client rather than
693 attempting to resolve the name from the TCP connection itself.
696 .It Cm HostCertificate
697 Specifies a file containing a public host certificate.
698 The certificate's public key must match a private host key already specified
701 The default behaviour of
703 is not to load any certificates.
705 Specifies a file containing a private host key
708 .Pa /etc/ssh/ssh_host_key
709 for protocol version 1, and
710 .Pa /etc/ssh/ssh_host_dsa_key ,
711 .Pa /etc/ssh/ssh_host_ecdsa_key ,
712 .Pa /etc/ssh/ssh_host_ed25519_key
714 .Pa /etc/ssh/ssh_host_rsa_key
715 for protocol version 2.
719 will refuse to use a file if it is group/world-accessible
721 .Cm HostKeyAlgorithms
722 option restricts which of the keys are actually used by
725 It is possible to have multiple host key files.
727 keys are used for version 1 and
733 are used for version 2 of the SSH protocol.
734 It is also possible to specify public host key files instead.
735 In this case operations on the private key will be delegated
739 Identifies the UNIX-domain socket used to communicate
740 with an agent that has access to the private host keys.
743 is specified, the location of the socket will be read from the
745 environment variable.
746 .It Cm HostKeyAlgorithms
747 Specifies the host key algorithms
748 that the server offers.
749 The default for this option is:
750 .Bd -literal -offset 3n
751 ecdsa-sha2-nistp256-cert-v01@openssh.com,
752 ecdsa-sha2-nistp384-cert-v01@openssh.com,
753 ecdsa-sha2-nistp521-cert-v01@openssh.com,
754 ssh-ed25519-cert-v01@openssh.com,
755 ssh-rsa-cert-v01@openssh.com,
756 ssh-dss-cert-v01@openssh.com,
757 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,
758 ecdsa-sha2-nistp521,ssh-ed25519,
762 The list of available key types may also be obtained using the
773 files will not be used in
774 .Cm RhostsRSAAuthentication
776 .Cm HostbasedAuthentication .
780 .Pa /etc/ssh/shosts.equiv
784 .It Cm IgnoreUserKnownHosts
787 should ignore the user's
788 .Pa ~/.ssh/known_hosts
790 .Cm RhostsRSAAuthentication
792 .Cm HostbasedAuthentication .
796 Specifies the IPv4 type-of-service or DSCP class for the connection.
823 This option may take one or two arguments, separated by whitespace.
824 If one argument is specified, it is used as the packet class unconditionally.
825 If two values are specified, the first is automatically selected for
826 interactive sessions and the second for non-interactive sessions.
829 for interactive sessions and
831 for non-interactive sessions.
832 .It Cm KbdInteractiveAuthentication
833 Specifies whether to allow keyboard-interactive authentication.
834 The argument to this keyword must be
838 The default is to use whatever value
839 .Cm ChallengeResponseAuthentication
843 .It Cm KerberosAuthentication
844 Specifies whether the password provided by the user for
845 .Cm PasswordAuthentication
846 will be validated through the Kerberos KDC.
847 To use this option, the server needs a
848 Kerberos servtab which allows the verification of the KDC's identity.
851 .It Cm KerberosGetAFSToken
852 If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
853 an AFS token before accessing the user's home directory.
856 .It Cm KerberosOrLocalPasswd
857 If password authentication through Kerberos fails then
858 the password will be validated via any additional local mechanism
863 .It Cm KerberosTicketCleanup
864 Specifies whether to automatically destroy the user's ticket cache
869 Specifies the available KEX (Key Exchange) algorithms.
870 Multiple algorithms must be comma-separated.
871 Alternately if the specified value begins with a
873 character, then the specified methods will be appended to the default set
874 instead of replacing them.
875 The supported algorithms are:
877 .Bl -item -compact -offset indent
879 curve25519-sha256@libssh.org
881 diffie-hellman-group1-sha1
883 diffie-hellman-group14-sha1
885 diffie-hellman-group-exchange-sha1
887 diffie-hellman-group-exchange-sha256
897 .Bd -literal -offset indent
898 curve25519-sha256@libssh.org,
899 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
900 diffie-hellman-group-exchange-sha256,
901 diffie-hellman-group14-sha1
904 The list of available key exchange algorithms may also be obtained using the
910 .It Cm KeyRegenerationInterval
911 In protocol version 1, the ephemeral server key is automatically regenerated
912 after this many seconds (if it has been used).
913 The purpose of regeneration is to prevent
914 decrypting captured sessions by later breaking into the machine and
916 The key is never stored anywhere.
917 If the value is 0, the key is never regenerated.
918 The default is 3600 (seconds).
920 Specifies the local addresses
923 The following forms may be used:
925 .Bl -item -offset indent -compact
929 .Ar host | Ar IPv4_addr | Ar IPv6_addr
934 .Ar host | Ar IPv4_addr : Ar port
940 .Ar host | Ar IPv6_addr Oc : Ar port
947 sshd will listen on the address and all
950 The default is to listen on all local addresses.
953 options are permitted.
954 .It Cm LoginGraceTime
955 The server disconnects after this time if the user has not
956 successfully logged in.
957 If the value is 0, there is no time limit.
958 The default is 120 seconds.
960 Gives the verbosity level that is used when logging messages from
962 The possible values are:
963 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
965 DEBUG and DEBUG1 are equivalent.
966 DEBUG2 and DEBUG3 each specify higher levels of debugging output.
967 Logging with a DEBUG level violates the privacy of users and is not recommended.
969 Specifies the available MAC (message authentication code) algorithms.
970 The MAC algorithm is used for data integrity protection.
971 Multiple algorithms must be comma-separated.
972 If the specified value begins with a
974 character, then the specified algorithms will be appended to the default set
975 instead of replacing them.
977 The algorithms that contain
979 calculate the MAC after encryption (encrypt-then-mac).
980 These are considered safer and their use recommended.
981 The supported MACs are:
983 .Bl -item -compact -offset indent
1001 umac-128@openssh.com
1003 hmac-md5-etm@openssh.com
1005 hmac-md5-96-etm@openssh.com
1007 hmac-ripemd160-etm@openssh.com
1009 hmac-sha1-etm@openssh.com
1011 hmac-sha1-96-etm@openssh.com
1013 hmac-sha2-256-etm@openssh.com
1015 hmac-sha2-512-etm@openssh.com
1017 umac-64-etm@openssh.com
1019 umac-128-etm@openssh.com
1023 .Bd -literal -offset indent
1024 umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1025 hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1026 hmac-sha1-etm@openssh.com,
1027 umac-64@openssh.com,umac-128@openssh.com,
1028 hmac-sha2-256,hmac-sha2-512,hmac-sha1
1031 The list of available MAC algorithms may also be obtained using the
1038 Introduces a conditional block.
1039 If all of the criteria on the
1041 line are satisfied, the keywords on the following lines override those
1042 set in the global section of the config file, until either another
1044 line or the end of the file.
1045 If a keyword appears in multiple
1047 blocks that are satisfied, only the first instance of the keyword is
1052 are one or more criteria-pattern pairs or the single token
1054 which matches all criteria.
1055 The available criteria are
1063 The match patterns may consist of single entries or comma-separated
1064 lists and may use the wildcard and negation operators described in the
1070 criteria may additionally contain addresses to match in CIDR
1071 address/masklen format, e.g.\&
1074 .Dq 3ffe:ffff::/32 .
1075 Note that the mask length provided must be consistent with the address -
1076 it is an error to specify a mask length that is too long for the address
1077 or one with bits set in this host portion of the address.
1084 Only a subset of keywords may be used on the lines following a
1087 Available keywords are
1089 .Cm AllowAgentForwarding ,
1091 .Cm AllowStreamLocalForwarding ,
1092 .Cm AllowTcpForwarding ,
1094 .Cm AuthenticationMethods ,
1095 .Cm AuthorizedKeysCommand ,
1096 .Cm AuthorizedKeysCommandUser ,
1097 .Cm AuthorizedKeysFile ,
1098 .Cm AuthorizedPrincipalsCommand ,
1099 .Cm AuthorizedPrincipalsCommandUser ,
1100 .Cm AuthorizedPrincipalsFile ,
1102 .Cm ChrootDirectory ,
1107 .Cm GSSAPIAuthentication ,
1108 .Cm HostbasedAcceptedKeyTypes ,
1109 .Cm HostbasedAuthentication ,
1110 .Cm HostbasedUsesNameFromPacketOnly ,
1112 .Cm KbdInteractiveAuthentication ,
1113 .Cm KerberosAuthentication ,
1116 .Cm PasswordAuthentication ,
1117 .Cm PermitEmptyPasswords ,
1119 .Cm PermitRootLogin ,
1123 .Cm PubkeyAcceptedKeyTypes ,
1124 .Cm PubkeyAuthentication ,
1127 .Cm RhostsRSAAuthentication ,
1128 .Cm RSAAuthentication ,
1129 .Cm StreamLocalBindMask ,
1130 .Cm StreamLocalBindUnlink ,
1131 .Cm TrustedUserCAKeys ,
1132 .Cm X11DisplayOffset ,
1135 .Cm X11UseLocalHost .
1137 Specifies the maximum number of authentication attempts permitted per
1139 Once the number of failures reaches half this value,
1140 additional failures are logged.
1143 Specifies the maximum number of open shell, login or subsystem (e.g. sftp)
1144 sessions permitted per network connection.
1145 Multiple sessions may be established by clients that support connection
1149 to 1 will effectively disable session multiplexing, whereas setting it to 0
1150 will prevent all shell, login and subsystem sessions while still permitting
1154 Specifies the maximum number of concurrent unauthenticated connections to the
1156 Additional connections will be dropped until authentication succeeds or the
1158 expires for a connection.
1159 The default is 10:30:100.
1161 Alternatively, random early drop can be enabled by specifying
1162 the three colon separated values
1166 will refuse connection attempts with a probability of
1169 if there are currently
1172 unauthenticated connections.
1173 The probability increases linearly and all connection attempts
1174 are refused if the number of unauthenticated connections reaches
1177 .It Cm PasswordAuthentication
1178 Specifies whether password authentication is allowed.
1183 .It Cm PermitEmptyPasswords
1184 When password authentication is allowed, it specifies whether the
1185 server allows login to accounts with empty password strings.
1189 Specifies the destinations to which TCP port forwarding is permitted.
1190 The forwarding specification must be one of the following forms:
1192 .Bl -item -offset indent -compact
1201 .Ar IPv4_addr : port
1206 .Ar \&[ IPv6_addr \&] : port
1210 Multiple forwards may be specified by separating them with whitespace.
1213 can be used to remove all restrictions and permit any forwarding requests.
1216 can be used to prohibit all forwarding requests.
1217 By default all port forwarding requests are permitted.
1218 .It Cm PermitRootLogin
1219 Specifies whether root can log in using
1221 The argument must be
1223 .Dq prohibit-password ,
1224 .Dq without-password ,
1225 .Dq forced-commands-only ,
1231 .Cm ChallengeResponseAuthentication
1234 the root user may be allowed in with its password even if
1235 .Cm PermitRootLogin is set to
1236 .Dq without-password .
1238 If this option is set to
1239 .Dq prohibit-password
1241 .Dq without-password ,
1242 password and keyboard-interactive authentication are disabled for root.
1244 If this option is set to
1245 .Dq forced-commands-only ,
1246 root login with public key authentication will be allowed,
1249 option has been specified
1250 (which may be useful for taking remote backups even if root login is
1251 normally not allowed).
1252 All other authentication methods are disabled for root.
1254 If this option is set to
1256 root is not allowed to log in.
1260 device forwarding is allowed.
1261 The argument must be
1277 Independent of this setting, the permissions of the selected
1279 device must allow access to the user.
1283 allocation is permitted.
1286 .It Cm PermitUserEnvironment
1288 .Pa ~/.ssh/environment
1292 .Pa ~/.ssh/authorized_keys
1297 Enabling environment processing may enable users to bypass access
1298 restrictions in some configurations using mechanisms such as
1301 Specifies whether any
1307 Specifies the file that contains the process ID of the
1312 .Pa /var/run/sshd.pid .
1314 Specifies the port number that
1318 Multiple options of this type are permitted.
1324 should print the date and time of the last user login when a user logs
1333 when a user logs in interactively.
1334 (On some systems it is also printed by the shell,
1340 Specifies the protocol versions
1343 The possible values are
1347 Multiple versions must be comma-separated.
1350 Protocol 1 suffers from a number of cryptographic weaknesses and should
1352 It is only offered to support legacy devices.
1354 Note that the order of the protocol list does not indicate preference,
1355 because the client selects among multiple protocol versions offered
1361 .It Cm PubkeyAcceptedKeyTypes
1362 Specifies the key types that will be accepted for public key authentication
1363 as a comma-separated pattern list.
1364 Alternately if the specified value begins with a
1366 character, then the specified key types will be appended to the default set
1367 instead of replacing them.
1368 The default for this option is:
1369 .Bd -literal -offset 3n
1370 ecdsa-sha2-nistp256-cert-v01@openssh.com,
1371 ecdsa-sha2-nistp384-cert-v01@openssh.com,
1372 ecdsa-sha2-nistp521-cert-v01@openssh.com,
1373 ssh-ed25519-cert-v01@openssh.com,
1374 ssh-rsa-cert-v01@openssh.com,
1375 ssh-dss-cert-v01@openssh.com,
1376 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,
1377 ecdsa-sha2-nistp521,ssh-ed25519,
1385 may be used to list supported key types.
1386 .It Cm PubkeyAuthentication
1387 Specifies whether public key authentication is allowed.
1391 Specifies the maximum amount of data that may be transmitted before the
1392 session key is renegotiated, optionally followed a maximum amount of
1393 time that may pass before the session key is renegotiated.
1394 The first argument is specified in bytes and may have a suffix of
1399 to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1400 The default is between
1404 depending on the cipher.
1405 The optional second value is specified in seconds and may use any of the
1406 units documented in the
1409 The default value for
1413 which means that rekeying is performed after the cipher's default amount
1414 of data has been sent or received and no time based rekeying is done.
1416 Specifies revoked public keys file, or
1419 Keys listed in this file will be refused for public key authentication.
1420 Note that if this file is not readable, then public key authentication will
1421 be refused for all users.
1422 Keys may be specified as a text file, listing one public key per line, or as
1423 an OpenSSH Key Revocation List (KRL) as generated by
1425 For more information on KRLs, see the KEY REVOCATION LISTS section in
1427 .It Cm RhostsRSAAuthentication
1428 Specifies whether rhosts or
1429 .Pa /etc/hosts.equiv
1430 authentication together
1431 with successful RSA host authentication is allowed.
1434 This option applies to protocol version 1 only.
1435 .It Cm RSAAuthentication
1436 Specifies whether pure RSA authentication is allowed.
1439 This option applies to protocol version 1 only.
1440 .It Cm ServerKeyBits
1441 Defines the number of bits in the ephemeral protocol version 1 server key.
1442 The default and minimum value is 1024.
1443 .It Cm StreamLocalBindMask
1444 Sets the octal file creation mode mask
1446 used when creating a Unix-domain socket file for local or remote
1448 This option is only used for port forwarding to a Unix-domain socket file.
1450 The default value is 0177, which creates a Unix-domain socket file that is
1451 readable and writable only by the owner.
1452 Note that not all operating systems honor the file mode on Unix-domain
1454 .It Cm StreamLocalBindUnlink
1455 Specifies whether to remove an existing Unix-domain socket file for local
1456 or remote port forwarding before creating a new one.
1457 If the socket file already exists and
1458 .Cm StreamLocalBindUnlink
1461 will be unable to forward the port to the Unix-domain socket file.
1462 This option is only used for port forwarding to a Unix-domain socket file.
1464 The argument must be
1473 should check file modes and ownership of the
1474 user's files and home directory before accepting login.
1475 This is normally desirable because novices sometimes accidentally leave their
1476 directory or files world-writable.
1479 Note that this does not apply to
1480 .Cm ChrootDirectory ,
1481 whose permissions and ownership are checked unconditionally.
1483 Configures an external subsystem (e.g. file transfer daemon).
1484 Arguments should be a subsystem name and a command (with optional arguments)
1485 to execute upon subsystem request.
1491 file transfer subsystem.
1493 Alternately the name
1495 implements an in-process
1498 This may simplify configurations using
1500 to force a different filesystem root on clients.
1502 By default no subsystems are defined.
1503 .It Cm SyslogFacility
1504 Gives the facility code that is used when logging messages from
1506 The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1507 LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1508 The default is AUTH.
1510 Specifies whether the system should send TCP keepalive messages to the
1512 If they are sent, death of the connection or crash of one
1513 of the machines will be properly noticed.
1514 However, this means that
1515 connections will die if the route is down temporarily, and some people
1517 On the other hand, if TCP keepalives are not sent,
1518 sessions may hang indefinitely on the server, leaving
1520 users and consuming server resources.
1524 (to send TCP keepalive messages), and the server will notice
1525 if the network goes down or the client host crashes.
1526 This avoids infinitely hanging sessions.
1528 To disable TCP keepalive messages, the value should be set to
1530 .It Cm TrustedUserCAKeys
1531 Specifies a file containing public keys of certificate authorities that are
1532 trusted to sign user certificates for authentication, or
1535 Keys are listed one per line; empty lines and comments starting with
1538 If a certificate is presented for authentication and has its signing CA key
1539 listed in this file, then it may be used for authentication for any user
1540 listed in the certificate's principals list.
1541 Note that certificates that lack a list of principals will not be permitted
1542 for authentication using
1543 .Cm TrustedUserCAKeys .
1544 For more details on certificates, see the CERTIFICATES section in
1549 should look up the remote host name, and to check that
1550 the resolved host name for the remote IP address maps back to the
1551 very same IP address.
1553 If this option is set to
1555 then only addresses and not host names may be used in
1556 .Pa ~/.ssh/known_hosts
1568 is used for interactive login sessions.
1573 is never used for remote command execution.
1574 Note also, that if this is enabled,
1576 will be disabled because
1578 does not know how to handle
1582 .Cm UsePrivilegeSeparation
1583 is specified, it will be disabled after authentication.
1585 Enables the Pluggable Authentication Module interface.
1588 this will enable PAM authentication using
1589 .Cm ChallengeResponseAuthentication
1591 .Cm PasswordAuthentication
1592 in addition to PAM account and session module processing for all
1593 authentication types.
1595 Because PAM challenge-response authentication usually serves an equivalent
1596 role to password authentication, you should disable either
1597 .Cm PasswordAuthentication
1599 .Cm ChallengeResponseAuthentication.
1603 is enabled, you will not be able to run
1608 .It Cm UsePrivilegeSeparation
1611 separates privileges by creating an unprivileged child process
1612 to deal with incoming network traffic.
1613 After successful authentication, another process will be created that has
1614 the privilege of the authenticated user.
1615 The goal of privilege separation is to prevent privilege
1616 escalation by containing any corruption within the unprivileged processes.
1617 The argument must be
1623 .Cm UsePrivilegeSeparation
1626 then the pre-authentication unprivileged process is subject to additional
1630 .It Cm VersionAddendum
1631 Optionally specifies additional text to append to the SSH protocol banner
1632 sent by the server upon connection.
1634 .Dq FreeBSD-20160310 .
1637 may be used to disable this.
1638 .It Cm X11DisplayOffset
1639 Specifies the first display number available for
1642 This prevents sshd from interfering with real X11 servers.
1644 .It Cm X11Forwarding
1645 Specifies whether X11 forwarding is permitted.
1646 The argument must be
1653 When X11 forwarding is enabled, there may be additional exposure to
1654 the server and to client displays if the
1656 proxy display is configured to listen on the wildcard address (see
1658 below), though this is not the default.
1659 Additionally, the authentication spoofing and authentication data
1660 verification and substitution occur on the client side.
1661 The security risk of using X11 forwarding is that the client's X11
1662 display server may be exposed to attack when the SSH client requests
1663 forwarding (see the warnings for
1666 .Xr ssh_config 5 ) .
1667 A system administrator may have a stance in which they want to
1668 protect clients that may expose themselves to attack by unwittingly
1669 requesting X11 forwarding, which can warrant a
1673 Note that disabling X11 forwarding does not prevent users from
1674 forwarding X11 traffic, as users can always install their own forwarders.
1675 X11 forwarding is automatically disabled if
1678 .It Cm X11UseLocalhost
1681 should bind the X11 forwarding server to the loopback address or to
1682 the wildcard address.
1684 sshd binds the forwarding server to the loopback address and sets the
1685 hostname part of the
1687 environment variable to
1689 This prevents remote hosts from connecting to the proxy display.
1690 However, some older X11 clients may not function with this
1695 to specify that the forwarding server should be bound to the wildcard
1697 The argument must be
1703 .It Cm XAuthLocation
1704 Specifies the full pathname of the
1710 .Pa /usr/local/bin/xauth .
1714 command-line arguments and configuration file options that specify time
1715 may be expressed using a sequence of the form:
1717 .Ar time Op Ar qualifier ,
1721 is a positive integer value and
1723 is one of the following:
1725 .Bl -tag -width Ds -compact -offset indent
1740 Each member of the sequence is added together to calculate
1741 the total time value.
1743 Time format examples:
1745 .Bl -tag -width Ds -compact -offset indent
1747 600 seconds (10 minutes)
1751 1 hour 30 minutes (90 minutes)
1755 .It Pa /etc/ssh/sshd_config
1756 Contains configuration data for
1758 This file should be writable by root only, but it is recommended
1759 (though not necessary) that it be world-readable.
1764 OpenSSH is a derivative of the original and free
1765 ssh 1.2.12 release by Tatu Ylonen.
1766 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1767 Theo de Raadt and Dug Song
1768 removed many bugs, re-added newer features and
1770 Markus Friedl contributed the support for SSH
1771 protocol versions 1.5 and 2.0.
1772 Niels Provos and Markus Friedl contributed support
1773 for privilege separation.