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.227 2016/07/19 12:59:16 jmc Exp $
37 .Dd $Mdocdate: July 19 2016 $
42 .Nd OpenSSH SSH daemon configuration file
44 .Nm /etc/ssh/sshd_config
47 reads configuration data from
48 .Pa /etc/ssh/sshd_config
49 (or the file specified with
52 The file contains keyword-argument pairs, one per line.
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
72 for how to configure the client.
75 environment variable is always sent whenever the client
76 requests a pseudo-terminal as it is required by the protocol.
77 Variables are specified by name, which may contain the wildcard characters
81 Multiple environment variables may be separated by whitespace or spread
85 Be warned that some environment variables could be used to bypass restricted
87 For this reason, care should be taken in the use of this directive.
88 The default is not to accept any environment variables.
90 Specifies which address family should be used by
100 .It Cm AllowAgentForwarding
103 forwarding is permitted.
106 Note that disabling agent forwarding does not improve security
107 unless users are also denied shell access, as they can always install
108 their own forwarders.
110 This keyword can be followed by a list of group name patterns, separated
112 If specified, login is allowed only for users whose primary
113 group or supplementary group list matches one of the patterns.
114 Only group names are valid; a numerical group ID is not recognized.
115 By default, login is allowed for all groups.
116 The allow/deny directives are processed in the following order:
125 for more information on patterns.
126 .It Cm AllowTcpForwarding
127 Specifies whether TCP forwarding is permitted.
128 The available options are
132 to allow TCP forwarding,
134 to prevent all TCP forwarding,
136 to allow local (from the perspective of
140 to allow remote forwarding only.
143 Note that disabling TCP forwarding does not improve security unless
144 users are also denied shell access, as they can always install their
146 .It Cm AllowStreamLocalForwarding
147 Specifies whether StreamLocal (Unix-domain socket) forwarding is permitted.
148 The available options are
152 to allow StreamLocal forwarding,
154 to prevent all StreamLocal forwarding,
156 to allow local (from the perspective of
160 to allow remote forwarding only.
163 Note that disabling StreamLocal forwarding does not improve security unless
164 users are also denied shell access, as they can always install their
167 This keyword can be followed by a list of user name patterns, separated
169 If specified, login is allowed only for user names that
170 match one of the patterns.
171 Only user names are valid; a numerical user ID is not recognized.
172 By default, login is allowed for all users.
173 If the pattern takes the form USER@HOST then USER and HOST
174 are separately checked, restricting logins to particular
175 users from particular hosts.
176 HOST criteria may additionally contain addresses to match in CIDR
177 address/masklen format.
178 The allow/deny directives are processed in the following order:
187 for more information on patterns.
188 .It Cm AuthenticationMethods
189 Specifies the authentication methods that must be successfully completed
190 for a user to be granted access.
191 This option must be followed by one or more comma-separated lists of
192 authentication method names, or by the single string
194 to indicate the default behaviour of accepting any single authentication
196 if the default is overridden, then successful authentication requires
197 completion of every method in at least one of these lists.
199 For example, an argument of
200 .Dq publickey,password publickey,keyboard-interactive
201 would require the user to complete public key authentication, followed by
202 either password or keyboard interactive authentication.
203 Only methods that are next in one or more lists are offered at each stage,
204 so for this example, it would not be possible to attempt password or
205 keyboard-interactive authentication before public key.
207 For keyboard interactive authentication it is also possible to
208 restrict authentication to a specific device by appending a
209 colon followed by the device identifier
214 depending on the server configuration.
216 .Dq keyboard-interactive:bsdauth
217 would restrict keyboard interactive authentication to the
223 method is listed more than once,
225 verifies that keys that have been used successfully are not reused for
226 subsequent authentications.
228 .Cm AuthenticationMethods
230 .Dq publickey,publickey
231 will require successful authentication using two different public keys.
233 This option will yield a fatal
234 error if enabled if protocol 1 is also enabled.
235 Note that each authentication method listed should also be explicitly enabled
236 in the configuration.
239 is not to require multiple authentication; successful completion
240 of a single authentication method is sufficient.
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.
247 .Cm AuthorizedKeysCommand
248 may be provided using the following tokens, which will be expanded
249 at runtime: %% is replaced by a literal '%', %u is replaced by the
250 username being authenticated, %h is replaced by the home directory
251 of the user being authenticated, %t is replaced with the key type
252 offered for authentication, %f is replaced with the fingerprint of
253 the key, and %k is replaced with the key being offered for authentication.
254 If no arguments are specified then the username of the target user
257 The program should produce on standard output zero or
258 more lines of authorized_keys output (see AUTHORIZED_KEYS in
260 If a key supplied by AuthorizedKeysCommand does not successfully authenticate
261 and authorize the user then public key authentication continues using the usual
262 .Cm AuthorizedKeysFile
264 By default, no AuthorizedKeysCommand is run.
265 .It Cm AuthorizedKeysCommandUser
266 Specifies the user under whose account the AuthorizedKeysCommand is run.
267 It is recommended to use a dedicated user that has no other role on the host
268 than running authorized keys commands.
270 .Cm AuthorizedKeysCommand
272 .Cm AuthorizedKeysCommandUser
275 will refuse to start.
276 .It Cm AuthorizedKeysFile
277 Specifies the file that contains the public keys that can be used
278 for user authentication.
279 The format is described in the
280 AUTHORIZED_KEYS FILE FORMAT
283 .Cm AuthorizedKeysFile
284 may contain tokens of the form %T which are substituted during connection
286 The following tokens are defined: %% is replaced by a literal '%',
287 %h is replaced by the home directory of the user being authenticated, and
288 %u is replaced by the username of that user.
290 .Cm AuthorizedKeysFile
291 is taken to be an absolute path or one relative to the user's home
293 Multiple files may be listed, separated by whitespace.
294 Alternately this option may be set to
296 to skip checking for user keys in files.
298 .Dq .ssh/authorized_keys .ssh/authorized_keys2 .
299 .It Cm AuthorizedPrincipalsCommand
300 Specifies a program to be used to generate the list of allowed
301 certificate principals as per
302 .Cm AuthorizedPrincipalsFile .
303 The program must be owned by root, not writable by group or others and
304 specified by an absolute path.
307 .Cm AuthorizedPrincipalsCommand
308 may be provided using the following tokens, which will be expanded
309 at runtime: %% is replaced by a literal '%', %u is replaced by the
310 username being authenticated and %h is replaced by the home directory
311 of the user being authenticated.
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.
323 By default, no AuthorizedPrincipalsCommand is run.
324 .It Cm AuthorizedPrincipalsCommandUser
325 Specifies the user under whose account the AuthorizedPrincipalsCommand is run.
326 It is recommended to use a dedicated user that has no other role on the host
327 than running authorized principals commands.
329 .Cm AuthorizedPrincipalsCommand
331 .Cm AuthorizedPrincipalsCommandUser
334 will refuse to start.
335 .It Cm AuthorizedPrincipalsFile
336 Specifies a file that lists principal names that are accepted for
337 certificate authentication.
338 When using certificates signed by a key listed in
339 .Cm TrustedUserCAKeys ,
340 this file lists names, one of which must appear in the certificate for it
341 to be accepted for authentication.
342 Names are listed one per line preceded by key options (as described
343 in AUTHORIZED_KEYS FILE FORMAT in
345 Empty lines and comments starting with
349 .Cm AuthorizedPrincipalsFile
350 may contain tokens of the form %T which are substituted during connection
352 The following tokens are defined: %% is replaced by a literal '%',
353 %h is replaced by the home directory of the user being authenticated, and
354 %u is replaced by the username of that user.
356 .Cm AuthorizedPrincipalsFile
357 is taken to be an absolute path or one relative to the user's home
362 i.e. not to use a principals file \(en in this case, the username
363 of the user must appear in a certificate's principals list for it to be
366 .Cm AuthorizedPrincipalsFile
367 is only used when authentication proceeds using a CA listed in
368 .Cm TrustedUserCAKeys
369 and is not consulted for certification authorities trusted via
370 .Pa ~/.ssh/authorized_keys ,
373 key option offers a similar facility (see
377 The contents of the specified file are sent to the remote user before
378 authentication is allowed.
381 then no banner is displayed.
382 By default, no banner is displayed.
383 .It Cm ChallengeResponseAuthentication
384 Specifies whether challenge-response authentication is allowed (e.g. via
385 PAM or through authentication styles supported in
389 .It Cm ChrootDirectory
390 Specifies the pathname of a directory to
392 to after authentication.
395 checks that all components of the pathname are root-owned directories
396 which are not writable by any other user or group.
399 changes the working directory to the user's home directory.
401 The pathname may contain the following tokens that are expanded at runtime once
402 the connecting user has been authenticated: %% is replaced by a literal '%',
403 %h is replaced by the home directory of the user being authenticated, and
404 %u is replaced by the username of that user.
408 must contain the necessary files and directories to support the
410 For an interactive session this requires at least a shell, typically
423 For file transfer sessions using
425 no additional configuration of the environment is necessary if the
426 in-process sftp server is used,
427 though sessions which use logging may require
429 inside the chroot directory on some operating systems (see
433 For safety, it is very important that the directory hierarchy be
434 prevented from modification by other processes on the system (especially
435 those outside the jail).
436 Misconfiguration can lead to unsafe environments which
445 Specifies the ciphers allowed.
446 Multiple ciphers must be comma-separated.
447 If the specified value begins with a
449 character, then the specified ciphers will be appended to the default set
450 instead of replacing them.
452 The supported ciphers are:
454 .Bl -item -compact -offset indent
470 aes128-gcm@openssh.com
472 aes256-gcm@openssh.com
484 chacha20-poly1305@openssh.com
488 .Bd -literal -offset indent
489 chacha20-poly1305@openssh.com,
490 aes128-ctr,aes192-ctr,aes256-ctr,
491 aes128-gcm@openssh.com,aes256-gcm@openssh.com
494 The list of available ciphers may also be obtained using the
500 .It Cm ClientAliveCountMax
501 Sets the number of client alive messages (see below) which may be
504 receiving any messages back from the client.
505 If this threshold is reached while client alive messages are being sent,
506 sshd will disconnect the client, terminating the session.
507 It is important to note that the use of client alive messages is very
511 The client alive messages are sent through the encrypted channel
512 and therefore will not be spoofable.
513 The TCP keepalive option enabled by
516 The client alive mechanism is valuable when the client or
517 server depend on knowing when a connection has become inactive.
519 The default value is 3.
521 .Cm ClientAliveInterval
522 (see below) is set to 15, and
523 .Cm ClientAliveCountMax
524 is left at the default, unresponsive SSH clients
525 will be disconnected after approximately 45 seconds.
526 .It Cm ClientAliveInterval
527 Sets a timeout interval in seconds after which if no data has been received
530 will send a message through the encrypted
531 channel to request a response from the client.
533 is 0, indicating that these messages will not be sent to the client.
535 Specifies whether compression is allowed, or delayed until
536 the user has authenticated successfully.
545 This keyword can be followed by a list of group name patterns, separated
547 Login is disallowed for users whose primary group or supplementary
548 group list matches one of the patterns.
549 Only group names are valid; a numerical group ID is not recognized.
550 By default, login is allowed for all groups.
551 The allow/deny directives are processed in the following order:
560 for more information on patterns.
562 This keyword can be followed by a list of user name patterns, separated
564 Login is disallowed for user names that match one of the patterns.
565 Only user names are valid; a numerical user ID is not recognized.
566 By default, login is allowed for all users.
567 If the pattern takes the form USER@HOST then USER and HOST
568 are separately checked, restricting logins to particular
569 users from particular hosts.
570 HOST criteria may additionally contain addresses to match in CIDR
571 address/masklen format.
572 The allow/deny directives are processed in the following order:
581 for more information on patterns.
582 .It Cm FingerprintHash
583 Specifies the hash algorithm used when logging key fingerprints.
591 Forces the execution of the command specified by
593 ignoring any command supplied by the client and
596 The command is invoked by using the user's login shell with the -c option.
597 This applies to shell, command, or subsystem execution.
598 It is most useful inside a
601 The command originally supplied by the client is available in the
602 .Ev SSH_ORIGINAL_COMMAND
603 environment variable.
604 Specifying a command of
606 will force the use of an in-process sftp server that requires no support
608 .Cm ChrootDirectory .
612 Specifies whether remote hosts are allowed to connect to ports
613 forwarded for the client.
616 binds remote port forwardings to the loopback address.
617 This prevents other remote hosts from connecting to forwarded ports.
619 can be used to specify that sshd
620 should allow remote port forwardings to bind to non-loopback addresses, thus
621 allowing other hosts to connect.
624 to force remote port forwardings to be available to the local host only,
626 to force remote port forwardings to bind to the wildcard address, or
628 to allow the client to select the address to which the forwarding is bound.
631 .It Cm GSSAPIAuthentication
632 Specifies whether user authentication based on GSSAPI is allowed.
635 .It Cm GSSAPICleanupCredentials
636 Specifies whether to automatically destroy the user's credentials cache
640 .It Cm GSSAPIStrictAcceptorCheck
641 Determines whether to be strict about the identity of the GSSAPI acceptor
642 a client authenticates against.
645 then the client must authenticate against the
647 service on the current hostname.
650 then the client may authenticate against any service key stored in the
651 machine's default store.
652 This facility is provided to assist with operation on multi homed machines.
655 .It Cm HostbasedAcceptedKeyTypes
656 Specifies the key types that will be accepted for hostbased authentication
657 as a comma-separated pattern list.
658 Alternately if the specified value begins with a
660 character, then the specified key types will be appended to the default set
661 instead of replacing them.
662 The default for this option is:
663 .Bd -literal -offset 3n
664 ecdsa-sha2-nistp256-cert-v01@openssh.com,
665 ecdsa-sha2-nistp384-cert-v01@openssh.com,
666 ecdsa-sha2-nistp521-cert-v01@openssh.com,
667 ssh-ed25519-cert-v01@openssh.com,
668 ssh-rsa-cert-v01@openssh.com,
669 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
677 may be used to list supported key types.
678 .It Cm HostbasedAuthentication
679 Specifies whether rhosts or /etc/hosts.equiv authentication together
680 with successful public key client host authentication is allowed
681 (host-based authentication).
684 .It Cm HostbasedUsesNameFromPacketOnly
685 Specifies whether or not the server will attempt to perform a reverse
686 name lookup when matching the name in the
692 .Cm HostbasedAuthentication .
697 uses the name supplied by the client rather than
698 attempting to resolve the name from the TCP connection itself.
701 .It Cm HostCertificate
702 Specifies a file containing a public host certificate.
703 The certificate's public key must match a private host key already specified
706 The default behaviour of
708 is not to load any certificates.
710 Specifies a file containing a private host key
713 .Pa /etc/ssh/ssh_host_key
714 for protocol version 1, and
715 .Pa /etc/ssh/ssh_host_dsa_key ,
716 .Pa /etc/ssh/ssh_host_ecdsa_key ,
717 .Pa /etc/ssh/ssh_host_ed25519_key
719 .Pa /etc/ssh/ssh_host_rsa_key
720 for protocol version 2.
724 will refuse to use a file if it is group/world-accessible
726 .Cm HostKeyAlgorithms
727 option restricts which of the keys are actually used by
730 It is possible to have multiple host key files.
732 keys are used for version 1 and
738 are used for version 2 of the SSH protocol.
739 It is also possible to specify public host key files instead.
740 In this case operations on the private key will be delegated
744 Identifies the UNIX-domain socket used to communicate
745 with an agent that has access to the private host keys.
748 is specified, the location of the socket will be read from the
750 environment variable.
751 .It Cm HostKeyAlgorithms
752 Specifies the host key algorithms
753 that the server offers.
754 The default for this option is:
755 .Bd -literal -offset 3n
756 ecdsa-sha2-nistp256-cert-v01@openssh.com,
757 ecdsa-sha2-nistp384-cert-v01@openssh.com,
758 ecdsa-sha2-nistp521-cert-v01@openssh.com,
759 ssh-ed25519-cert-v01@openssh.com,
760 ssh-rsa-cert-v01@openssh.com,
761 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
765 The list of available key types may also be obtained using the
776 files will not be used in
777 .Cm RhostsRSAAuthentication
779 .Cm HostbasedAuthentication .
783 .Pa /etc/ssh/shosts.equiv
787 .It Cm IgnoreUserKnownHosts
790 should ignore the user's
791 .Pa ~/.ssh/known_hosts
793 .Cm RhostsRSAAuthentication
795 .Cm HostbasedAuthentication .
799 Specifies the IPv4 type-of-service or DSCP class for the connection.
826 This option may take one or two arguments, separated by whitespace.
827 If one argument is specified, it is used as the packet class unconditionally.
828 If two values are specified, the first is automatically selected for
829 interactive sessions and the second for non-interactive sessions.
832 for interactive sessions and
834 for non-interactive sessions.
835 .It Cm KbdInteractiveAuthentication
836 Specifies whether to allow keyboard-interactive authentication.
837 The argument to this keyword must be
841 The default is to use whatever value
842 .Cm ChallengeResponseAuthentication
846 .It Cm KerberosAuthentication
847 Specifies whether the password provided by the user for
848 .Cm PasswordAuthentication
849 will be validated through the Kerberos KDC.
850 To use this option, the server needs a
851 Kerberos servtab which allows the verification of the KDC's identity.
854 .It Cm KerberosGetAFSToken
855 If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
856 an AFS token before accessing the user's home directory.
859 .It Cm KerberosOrLocalPasswd
860 If password authentication through Kerberos fails then
861 the password will be validated via any additional local mechanism
866 .It Cm KerberosTicketCleanup
867 Specifies whether to automatically destroy the user's ticket cache
872 Specifies the available KEX (Key Exchange) algorithms.
873 Multiple algorithms must be comma-separated.
874 Alternately if the specified value begins with a
876 character, then the specified methods will be appended to the default set
877 instead of replacing them.
878 The supported algorithms are:
880 .Bl -item -compact -offset indent
882 curve25519-sha256@libssh.org
884 diffie-hellman-group1-sha1
886 diffie-hellman-group14-sha1
888 diffie-hellman-group-exchange-sha1
890 diffie-hellman-group-exchange-sha256
900 .Bd -literal -offset indent
901 curve25519-sha256@libssh.org,
902 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
903 diffie-hellman-group-exchange-sha256,
904 diffie-hellman-group14-sha1
907 The list of available key exchange algorithms may also be obtained using the
913 .It Cm KeyRegenerationInterval
914 In protocol version 1, the ephemeral server key is automatically regenerated
915 after this many seconds (if it has been used).
916 The purpose of regeneration is to prevent
917 decrypting captured sessions by later breaking into the machine and
919 The key is never stored anywhere.
920 If the value is 0, the key is never regenerated.
921 The default is 3600 (seconds).
923 Specifies the local addresses
926 The following forms may be used:
928 .Bl -item -offset indent -compact
932 .Ar host | Ar IPv4_addr | Ar IPv6_addr
937 .Ar host | Ar IPv4_addr : Ar port
943 .Ar host | Ar IPv6_addr Oc : Ar port
950 sshd will listen on the address and all
953 The default is to listen on all local addresses.
956 options are permitted.
957 .It Cm LoginGraceTime
958 The server disconnects after this time if the user has not
959 successfully logged in.
960 If the value is 0, there is no time limit.
961 The default is 120 seconds.
963 Gives the verbosity level that is used when logging messages from
965 The possible values are:
966 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
968 DEBUG and DEBUG1 are equivalent.
969 DEBUG2 and DEBUG3 each specify higher levels of debugging output.
970 Logging with a DEBUG level violates the privacy of users and is not recommended.
972 Specifies the available MAC (message authentication code) algorithms.
973 The MAC algorithm is used for data integrity protection.
974 Multiple algorithms must be comma-separated.
975 If the specified value begins with a
977 character, then the specified algorithms will be appended to the default set
978 instead of replacing them.
980 The algorithms that contain
982 calculate the MAC after encryption (encrypt-then-mac).
983 These are considered safer and their use recommended.
984 The supported MACs are:
986 .Bl -item -compact -offset indent
1004 umac-128@openssh.com
1006 hmac-md5-etm@openssh.com
1008 hmac-md5-96-etm@openssh.com
1010 hmac-ripemd160-etm@openssh.com
1012 hmac-sha1-etm@openssh.com
1014 hmac-sha1-96-etm@openssh.com
1016 hmac-sha2-256-etm@openssh.com
1018 hmac-sha2-512-etm@openssh.com
1020 umac-64-etm@openssh.com
1022 umac-128-etm@openssh.com
1026 .Bd -literal -offset indent
1027 umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1028 hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1029 hmac-sha1-etm@openssh.com,
1030 umac-64@openssh.com,umac-128@openssh.com,
1031 hmac-sha2-256,hmac-sha2-512,hmac-sha1
1034 The list of available MAC algorithms may also be obtained using the
1041 Introduces a conditional block.
1042 If all of the criteria on the
1044 line are satisfied, the keywords on the following lines override those
1045 set in the global section of the config file, until either another
1047 line or the end of the file.
1048 If a keyword appears in multiple
1050 blocks that are satisfied, only the first instance of the keyword is
1055 are one or more criteria-pattern pairs or the single token
1057 which matches all criteria.
1058 The available criteria are
1066 The match patterns may consist of single entries or comma-separated
1067 lists and may use the wildcard and negation operators described in the
1073 criteria may additionally contain addresses to match in CIDR
1074 address/masklen format, e.g.\&
1077 .Dq 3ffe:ffff::/32 .
1078 Note that the mask length provided must be consistent with the address -
1079 it is an error to specify a mask length that is too long for the address
1080 or one with bits set in this host portion of the address.
1087 Only a subset of keywords may be used on the lines following a
1090 Available keywords are
1092 .Cm AllowAgentForwarding ,
1094 .Cm AllowStreamLocalForwarding ,
1095 .Cm AllowTcpForwarding ,
1097 .Cm AuthenticationMethods ,
1098 .Cm AuthorizedKeysCommand ,
1099 .Cm AuthorizedKeysCommandUser ,
1100 .Cm AuthorizedKeysFile ,
1101 .Cm AuthorizedPrincipalsCommand ,
1102 .Cm AuthorizedPrincipalsCommandUser ,
1103 .Cm AuthorizedPrincipalsFile ,
1105 .Cm ChrootDirectory ,
1110 .Cm GSSAPIAuthentication ,
1111 .Cm HostbasedAcceptedKeyTypes ,
1112 .Cm HostbasedAuthentication ,
1113 .Cm HostbasedUsesNameFromPacketOnly ,
1115 .Cm KbdInteractiveAuthentication ,
1116 .Cm KerberosAuthentication ,
1119 .Cm PasswordAuthentication ,
1120 .Cm PermitEmptyPasswords ,
1122 .Cm PermitRootLogin ,
1126 .Cm PubkeyAcceptedKeyTypes ,
1127 .Cm PubkeyAuthentication ,
1130 .Cm RhostsRSAAuthentication ,
1131 .Cm RSAAuthentication ,
1132 .Cm StreamLocalBindMask ,
1133 .Cm StreamLocalBindUnlink ,
1134 .Cm TrustedUserCAKeys ,
1135 .Cm X11DisplayOffset ,
1138 .Cm X11UseLocalHost .
1140 Specifies the maximum number of authentication attempts permitted per
1142 Once the number of failures reaches half this value,
1143 additional failures are logged.
1146 Specifies the maximum number of open shell, login or subsystem (e.g. sftp)
1147 sessions permitted per network connection.
1148 Multiple sessions may be established by clients that support connection
1152 to 1 will effectively disable session multiplexing, whereas setting it to 0
1153 will prevent all shell, login and subsystem sessions while still permitting
1157 Specifies the maximum number of concurrent unauthenticated connections to the
1159 Additional connections will be dropped until authentication succeeds or the
1161 expires for a connection.
1162 The default is 10:30:100.
1164 Alternatively, random early drop can be enabled by specifying
1165 the three colon separated values
1169 will refuse connection attempts with a probability of
1172 if there are currently
1175 unauthenticated connections.
1176 The probability increases linearly and all connection attempts
1177 are refused if the number of unauthenticated connections reaches
1180 .It Cm PasswordAuthentication
1181 Specifies whether password authentication is allowed.
1185 .Cm ChallengeResponseAuthentication
1191 and the PAM authentication policy for
1195 password authentication will be allowed through the challenge-response
1196 mechanism regardless of the value of
1197 .Cm PasswordAuthentication .
1198 .It Cm PermitEmptyPasswords
1199 When password authentication is allowed, it specifies whether the
1200 server allows login to accounts with empty password strings.
1204 Specifies the destinations to which TCP port forwarding is permitted.
1205 The forwarding specification must be one of the following forms:
1207 .Bl -item -offset indent -compact
1216 .Ar IPv4_addr : port
1221 .Ar \&[ IPv6_addr \&] : port
1225 Multiple forwards may be specified by separating them with whitespace.
1228 can be used to remove all restrictions and permit any forwarding requests.
1231 can be used to prohibit all forwarding requests.
1234 can be used for host or port to allow all hosts or ports, respectively.
1235 By default all port forwarding requests are permitted.
1236 .It Cm PermitRootLogin
1237 Specifies whether root can log in using
1239 The argument must be
1241 .Dq prohibit-password ,
1242 .Dq without-password ,
1243 .Dq forced-commands-only ,
1247 .Dq prohibit-password .
1249 If this option is set to
1250 .Dq prohibit-password
1252 .Dq without-password ,
1253 password and keyboard-interactive authentication are disabled for root.
1255 If this option is set to
1256 .Dq forced-commands-only ,
1257 root login with public key authentication will be allowed,
1260 option has been specified
1261 (which may be useful for taking remote backups even if root login is
1262 normally not allowed).
1263 All other authentication methods are disabled for root.
1265 If this option is set to
1267 root is not allowed to log in.
1271 device forwarding is allowed.
1272 The argument must be
1288 Independent of this setting, the permissions of the selected
1290 device must allow access to the user.
1294 allocation is permitted.
1297 .It Cm PermitUserEnvironment
1299 .Pa ~/.ssh/environment
1303 .Pa ~/.ssh/authorized_keys
1308 Enabling environment processing may enable users to bypass access
1309 restrictions in some configurations using mechanisms such as
1312 Specifies whether any
1318 Specifies the file that contains the process ID of the
1323 .Pa /var/run/sshd.pid .
1325 Specifies the port number that
1329 Multiple options of this type are permitted.
1335 should print the date and time of the last user login when a user logs
1344 when a user logs in interactively.
1345 (On some systems it is also printed by the shell,
1351 Specifies the protocol versions
1354 The possible values are
1358 Multiple versions must be comma-separated.
1361 Protocol 1 suffers from a number of cryptographic weaknesses and should
1363 It is only offered to support legacy devices.
1365 Note that the order of the protocol list does not indicate preference,
1366 because the client selects among multiple protocol versions offered
1372 .It Cm PubkeyAcceptedKeyTypes
1373 Specifies the key types that will be accepted for public key authentication
1374 as a comma-separated pattern list.
1375 Alternately if the specified value begins with a
1377 character, then the specified key types will be appended to the default set
1378 instead of replacing them.
1379 The default for this option is:
1380 .Bd -literal -offset 3n
1381 ecdsa-sha2-nistp256-cert-v01@openssh.com,
1382 ecdsa-sha2-nistp384-cert-v01@openssh.com,
1383 ecdsa-sha2-nistp521-cert-v01@openssh.com,
1384 ssh-ed25519-cert-v01@openssh.com,
1385 ssh-rsa-cert-v01@openssh.com,
1386 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1394 may be used to list supported key types.
1395 .It Cm PubkeyAuthentication
1396 Specifies whether public key authentication is allowed.
1400 Specifies the maximum amount of data that may be transmitted before the
1401 session key is renegotiated, optionally followed a maximum amount of
1402 time that may pass before the session key is renegotiated.
1403 The first argument is specified in bytes and may have a suffix of
1408 to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1409 The default is between
1413 depending on the cipher.
1414 The optional second value is specified in seconds and may use any of the
1415 units documented in the
1418 The default value for
1422 which means that rekeying is performed after the cipher's default amount
1423 of data has been sent or received and no time based rekeying is done.
1425 Specifies revoked public keys file, or
1428 Keys listed in this file will be refused for public key authentication.
1429 Note that if this file is not readable, then public key authentication will
1430 be refused for all users.
1431 Keys may be specified as a text file, listing one public key per line, or as
1432 an OpenSSH Key Revocation List (KRL) as generated by
1434 For more information on KRLs, see the KEY REVOCATION LISTS section in
1436 .It Cm RhostsRSAAuthentication
1437 Specifies whether rhosts or
1438 .Pa /etc/hosts.equiv
1439 authentication together
1440 with successful RSA host authentication is allowed.
1443 This option applies to protocol version 1 only.
1444 .It Cm RSAAuthentication
1445 Specifies whether pure RSA authentication is allowed.
1448 This option applies to protocol version 1 only.
1449 .It Cm ServerKeyBits
1450 Defines the number of bits in the ephemeral protocol version 1 server key.
1451 The default and minimum value is 1024.
1452 .It Cm StreamLocalBindMask
1453 Sets the octal file creation mode mask
1455 used when creating a Unix-domain socket file for local or remote
1457 This option is only used for port forwarding to a Unix-domain socket file.
1459 The default value is 0177, which creates a Unix-domain socket file that is
1460 readable and writable only by the owner.
1461 Note that not all operating systems honor the file mode on Unix-domain
1463 .It Cm StreamLocalBindUnlink
1464 Specifies whether to remove an existing Unix-domain socket file for local
1465 or remote port forwarding before creating a new one.
1466 If the socket file already exists and
1467 .Cm StreamLocalBindUnlink
1470 will be unable to forward the port to the Unix-domain socket file.
1471 This option is only used for port forwarding to a Unix-domain socket file.
1473 The argument must be
1482 should check file modes and ownership of the
1483 user's files and home directory before accepting login.
1484 This is normally desirable because novices sometimes accidentally leave their
1485 directory or files world-writable.
1488 Note that this does not apply to
1489 .Cm ChrootDirectory ,
1490 whose permissions and ownership are checked unconditionally.
1492 Configures an external subsystem (e.g. file transfer daemon).
1493 Arguments should be a subsystem name and a command (with optional arguments)
1494 to execute upon subsystem request.
1500 file transfer subsystem.
1502 Alternately the name
1504 implements an in-process
1507 This may simplify configurations using
1509 to force a different filesystem root on clients.
1511 By default no subsystems are defined.
1512 .It Cm SyslogFacility
1513 Gives the facility code that is used when logging messages from
1515 The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1516 LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1517 The default is AUTH.
1519 Specifies whether the system should send TCP keepalive messages to the
1521 If they are sent, death of the connection or crash of one
1522 of the machines will be properly noticed.
1523 However, this means that
1524 connections will die if the route is down temporarily, and some people
1526 On the other hand, if TCP keepalives are not sent,
1527 sessions may hang indefinitely on the server, leaving
1529 users and consuming server resources.
1533 (to send TCP keepalive messages), and the server will notice
1534 if the network goes down or the client host crashes.
1535 This avoids infinitely hanging sessions.
1537 To disable TCP keepalive messages, the value should be set to
1539 .It Cm TrustedUserCAKeys
1540 Specifies a file containing public keys of certificate authorities that are
1541 trusted to sign user certificates for authentication, or
1544 Keys are listed one per line; empty lines and comments starting with
1547 If a certificate is presented for authentication and has its signing CA key
1548 listed in this file, then it may be used for authentication for any user
1549 listed in the certificate's principals list.
1550 Note that certificates that lack a list of principals will not be permitted
1551 for authentication using
1552 .Cm TrustedUserCAKeys .
1553 For more details on certificates, see the CERTIFICATES section in
1558 should look up the remote host name, and to check that
1559 the resolved host name for the remote IP address maps back to the
1560 very same IP address.
1562 If this option is set to
1564 (the default) then only addresses and not host names may be used in
1565 .Pa ~/.ssh/authorized_keys
1575 is used for interactive login sessions.
1580 is never used for remote command execution.
1581 Note also, that if this is enabled,
1583 will be disabled because
1585 does not know how to handle
1589 .Cm UsePrivilegeSeparation
1590 is specified, it will be disabled after authentication.
1592 Enables the Pluggable Authentication Module interface.
1595 this will enable PAM authentication using
1596 .Cm ChallengeResponseAuthentication
1598 .Cm PasswordAuthentication
1599 in addition to PAM account and session module processing for all
1600 authentication types.
1602 Because PAM challenge-response authentication usually serves an equivalent
1603 role to password authentication, you should disable either
1604 .Cm PasswordAuthentication
1606 .Cm ChallengeResponseAuthentication.
1610 is enabled, you will not be able to run
1615 .It Cm UsePrivilegeSeparation
1618 separates privileges by creating an unprivileged child process
1619 to deal with incoming network traffic.
1620 After successful authentication, another process will be created that has
1621 the privilege of the authenticated user.
1622 The goal of privilege separation is to prevent privilege
1623 escalation by containing any corruption within the unprivileged processes.
1624 The argument must be
1630 .Cm UsePrivilegeSeparation
1633 then the pre-authentication unprivileged process is subject to additional
1637 .It Cm VersionAddendum
1638 Optionally specifies additional text to append to the SSH protocol banner
1639 sent by the server upon connection.
1641 .Dq DragonFly-20160813 .
1642 .It Cm X11DisplayOffset
1643 Specifies the first display number available for
1646 This prevents sshd from interfering with real X11 servers.
1648 .It Cm X11Forwarding
1649 Specifies whether X11 forwarding is permitted.
1650 The argument must be
1657 When X11 forwarding is enabled, there may be additional exposure to
1658 the server and to client displays if the
1660 proxy display is configured to listen on the wildcard address (see
1662 below), though this is not the default.
1663 Additionally, the authentication spoofing and authentication data
1664 verification and substitution occur on the client side.
1665 The security risk of using X11 forwarding is that the client's X11
1666 display server may be exposed to attack when the SSH client requests
1667 forwarding (see the warnings for
1670 .Xr ssh_config 5 ) .
1671 A system administrator may have a stance in which they want to
1672 protect clients that may expose themselves to attack by unwittingly
1673 requesting X11 forwarding, which can warrant a
1677 Note that disabling X11 forwarding does not prevent users from
1678 forwarding X11 traffic, as users can always install their own forwarders.
1679 X11 forwarding is automatically disabled if
1682 .It Cm X11UseLocalhost
1685 should bind the X11 forwarding server to the loopback address or to
1686 the wildcard address.
1688 sshd binds the forwarding server to the loopback address and sets the
1689 hostname part of the
1691 environment variable to
1693 This prevents remote hosts from connecting to the proxy display.
1694 However, some older X11 clients may not function with this
1699 to specify that the forwarding server should be bound to the wildcard
1701 The argument must be
1707 .It Cm XAuthLocation
1708 Specifies the full pathname of the
1714 .Pa /usr/X11R6/bin/xauth .
1718 command-line arguments and configuration file options that specify time
1719 may be expressed using a sequence of the form:
1721 .Ar time Op Ar qualifier ,
1725 is a positive integer value and
1727 is one of the following:
1729 .Bl -tag -width Ds -compact -offset indent
1744 Each member of the sequence is added together to calculate
1745 the total time value.
1747 Time format examples:
1749 .Bl -tag -width Ds -compact -offset indent
1751 600 seconds (10 minutes)
1755 1 hour 30 minutes (90 minutes)
1759 .It Pa /etc/ssh/sshd_config
1760 Contains configuration data for
1762 This file should be writable by root only, but it is recommended
1763 (though not necessary) that it be world-readable.
1768 OpenSSH is a derivative of the original and free
1769 ssh 1.2.12 release by Tatu Ylonen.
1770 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1771 Theo de Raadt and Dug Song
1772 removed many bugs, re-added newer features and
1774 Markus Friedl contributed the support for SSH
1775 protocol versions 1.5 and 2.0.
1776 Niels Provos and Markus Friedl contributed support
1777 for privilege separation.