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.347 2023/01/18 06:55:32 jmc Exp $
37 .Dd $Mdocdate: January 18 2023 $
42 .Nd OpenSSH daemon configuration file
45 reads configuration data from
46 .Pa /etc/ssh/sshd_config
47 (or the file specified with
50 The file contains keyword-argument pairs, one per line.
51 For each keyword, the first obtained value will be used.
54 and empty lines are interpreted as comments.
55 Arguments may optionally be enclosed in double quotes
57 in order to represent arguments containing spaces.
60 keywords and their meanings are as follows (note that
61 keywords are case-insensitive and arguments are case-sensitive):
64 Specifies what environment variables sent by the client will be copied into
73 for how to configure the client.
76 environment variable is always accepted 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
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 groups directives are processed in the following order:
122 for more information on patterns.
123 .It Cm AllowStreamLocalForwarding
124 Specifies whether StreamLocal (Unix-domain socket) forwarding is permitted.
125 The available options are
130 to allow StreamLocal forwarding,
132 to prevent all StreamLocal forwarding,
134 to allow local (from the perspective of
138 to allow remote forwarding only.
139 Note that disabling StreamLocal forwarding does not improve security unless
140 users are also denied shell access, as they can always install their
142 .It Cm AllowTcpForwarding
143 Specifies whether TCP forwarding is permitted.
144 The available options are
149 to allow TCP forwarding,
151 to prevent all TCP forwarding,
153 to allow local (from the perspective of
157 to allow remote forwarding only.
158 Note that disabling TCP forwarding does not improve security unless
159 users are also denied shell access, as they can always install their
162 This keyword can be followed by a list of user name patterns, separated
164 If specified, login is allowed only for user names that
165 match one of the patterns.
166 Only user names are valid; a numerical user ID is not recognized.
167 By default, login is allowed for all users.
168 If the pattern takes the form USER@HOST then USER and HOST
169 are separately checked, restricting logins to particular
170 users from particular hosts.
171 HOST criteria may additionally contain addresses to match in CIDR
172 address/masklen format.
173 The allow/deny users directives are processed in the following order:
179 for more information on patterns.
180 .It Cm AuthenticationMethods
181 Specifies the authentication methods that must be successfully completed
182 for a user to be granted access.
183 This option must be followed by one or more lists of comma-separated
184 authentication method names, or by the single string
186 to indicate the default behaviour of accepting any single authentication
188 If the default is overridden, then successful authentication requires
189 completion of every method in at least one of these lists.
192 .Qq publickey,password publickey,keyboard-interactive
193 would require the user to complete public key authentication, followed by
194 either password or keyboard interactive authentication.
195 Only methods that are next in one or more lists are offered at each stage,
196 so for this example it would not be possible to attempt password or
197 keyboard-interactive authentication before public key.
199 For keyboard interactive authentication it is also possible to
200 restrict authentication to a specific device by appending a
201 colon followed by the device identifier
205 depending on the server configuration.
207 .Qq keyboard-interactive:bsdauth
208 would restrict keyboard interactive authentication to the
212 If the publickey method is listed more than once,
214 verifies that keys that have been used successfully are not reused for
215 subsequent authentications.
217 .Qq publickey,publickey
218 requires successful authentication using two different public keys.
220 Note that each authentication method listed should also be explicitly enabled
221 in the configuration.
223 The available authentication methods are:
224 .Qq gssapi-with-mic ,
226 .Qq keyboard-interactive ,
228 (used for access to password-less accounts when
229 .Cm PermitEmptyPasswords
234 .It Cm AuthorizedKeysCommand
235 Specifies a program to be used to look up the user's public keys.
236 The program must be owned by root, not writable by group or others and
237 specified by an absolute path.
239 .Cm AuthorizedKeysCommand
240 accept the tokens described in the
243 If no arguments are specified then the username of the target user is used.
245 The program should produce on standard output zero or
246 more lines of authorized_keys output (see
250 .Cm AuthorizedKeysCommand
251 is tried after the usual
252 .Cm AuthorizedKeysFile
253 files and will not be executed if a matching key is found there.
255 .Cm AuthorizedKeysCommand
257 .It Cm AuthorizedKeysCommandUser
258 Specifies the user under whose account the
259 .Cm AuthorizedKeysCommand
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 used for user authentication.
272 The format is described in the AUTHORIZED_KEYS FILE FORMAT section of
275 .Cm AuthorizedKeysFile
276 accept the tokens described in the
280 .Cm AuthorizedKeysFile
281 is taken to be an absolute path or one relative to the user's home
283 Multiple files may be listed, separated by whitespace.
284 Alternately this option may be set to
286 to skip checking for user keys in files.
288 .Qq .ssh/authorized_keys .ssh/authorized_keys2 .
289 .It Cm AuthorizedPrincipalsCommand
290 Specifies a program to be used to generate the list of allowed
291 certificate principals as per
292 .Cm AuthorizedPrincipalsFile .
293 The program must be owned by root, not writable by group or others and
294 specified by an absolute path.
296 .Cm AuthorizedPrincipalsCommand
297 accept the tokens described in the
300 If no arguments are specified then the username of the target user is used.
302 The program should produce on standard output zero or
304 .Cm AuthorizedPrincipalsFile
307 .Cm AuthorizedPrincipalsCommand
309 .Cm AuthorizedPrincipalsFile
310 is specified, then certificates offered by the client for authentication
311 must contain a principal that is listed.
313 .Cm AuthorizedPrincipalsCommand
315 .It Cm AuthorizedPrincipalsCommandUser
316 Specifies the user under whose account the
317 .Cm AuthorizedPrincipalsCommand
319 It is recommended to use a dedicated user that has no other role on the host
320 than running authorized principals commands.
322 .Cm AuthorizedPrincipalsCommand
324 .Cm AuthorizedPrincipalsCommandUser
327 will refuse to start.
328 .It Cm AuthorizedPrincipalsFile
329 Specifies a file that lists principal names that are accepted for
330 certificate authentication.
331 When using certificates signed by a key listed in
332 .Cm TrustedUserCAKeys ,
333 this file lists names, one of which must appear in the certificate for it
334 to be accepted for authentication.
335 Names are listed one per line preceded by key options (as described in
336 .Sx AUTHORIZED_KEYS FILE FORMAT
339 Empty lines and comments starting with
344 .Cm AuthorizedPrincipalsFile
345 accept the tokens described in the
349 .Cm AuthorizedPrincipalsFile
350 is taken to be an absolute path or one relative to the user's home directory.
353 i.e. not to use a principals file \(en in this case, the username
354 of the user must appear in a certificate's principals list for it to be
358 .Cm AuthorizedPrincipalsFile
359 is only used when authentication proceeds using a CA listed in
360 .Cm TrustedUserCAKeys
361 and is not consulted for certification authorities trusted via
362 .Pa ~/.ssh/authorized_keys ,
365 key option offers a similar facility (see
369 The contents of the specified file are sent to the remote user before
370 authentication is allowed.
373 then no banner is displayed.
374 By default, no banner is displayed.
375 .It Cm CASignatureAlgorithms
376 Specifies which algorithms are allowed for signing of certificates
377 by certificate authorities (CAs).
379 .Bd -literal -offset indent
380 ssh-ed25519,ecdsa-sha2-nistp256,
381 ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
382 sk-ssh-ed25519@openssh.com,
383 sk-ecdsa-sha2-nistp256@openssh.com,
384 rsa-sha2-512,rsa-sha2-256
387 If the specified list begins with a
389 character, then the specified algorithms will be appended to the default set
390 instead of replacing them.
391 If the specified list begins with a
393 character, then the specified algorithms (including wildcards) will be removed
394 from the default set instead of replacing them.
396 Certificates signed using other algorithms will not be accepted for
397 public key or host-based authentication.
398 .It Cm ChannelTimeout
399 Specifies whether and how quickly
401 should close inactive channels.
402 Timeouts are specified as one or more
404 pairs separated by whitespace, where the
406 must be a channel type name (as described in the table below), optionally
407 containing wildcard characters.
411 is specified in seconds or may use any of the units documented in the
416 would cause all sessions to terminate after five minutes of inactivity.
417 Specifying a zero value disables the inactivity timeout.
419 The available channel types include:
421 .It Cm agent-connection
424 .It Cm direct-tcpip , Cm direct-streamlocal@openssh.com
425 Open TCP or Unix socket (respectively) connections that have
426 been established from a
428 local forwarding, i.e.\&
432 .It Cm forwarded-tcpip , Cm forwarded-streamlocal@openssh.com
433 Open TCP or Unix socket (respectively) connections that have been
436 listening on behalf of a
438 remote forwarding, i.e.\&
440 .It Cm session:command
441 Command execution sessions.
443 Interactive shell sessions.
444 .It Cm session:subsystem:...
445 Subsystem sessions, e.g. for
447 which could be identified as
448 .Cm session:subsystem:sftp .
449 .It Cm x11-connection
450 Open X11 forwarding sessions.
453 Note that in all the above cases, terminating an inactive session does not
454 guarantee to remove all resources associated with the session, e.g. shell
455 processes or X11 clients relating to the session may continue to execute.
457 Moreover, terminating an inactive channel or session does not necessarily
458 close the SSH connection, nor does it prevent a client from
459 requesting another channel of the same type.
460 In particular, expiring an inactive forwarding session does not prevent
461 another identical forwarding from being subsequently created.
463 .Cm UnusedConnectionTimeout ,
464 which may be used in conjunction with this option.
466 The default is not to expire channels of any type for inactivity.
467 .It Cm ChrootDirectory
468 Specifies the pathname of a directory to
470 to after authentication.
473 checks that all components of the pathname are root-owned directories
474 which are not writable by any other user or group.
477 changes the working directory to the user's home directory.
480 accept the tokens described in the
486 must contain the necessary files and directories to support the
488 For an interactive session this requires at least a shell, typically
501 For file transfer sessions using SFTP
502 no additional configuration of the environment is necessary if the in-process
504 though sessions which use logging may require
506 inside the chroot directory on some operating systems (see
510 For safety, it is very important that the directory hierarchy be
511 prevented from modification by other processes on the system (especially
512 those outside the jail).
513 Misconfiguration can lead to unsafe environments which
522 Specifies the ciphers allowed.
523 Multiple ciphers must be comma-separated.
524 If the specified list begins with a
526 character, then the specified ciphers will be appended to the default set
527 instead of replacing them.
528 If the specified list begins with a
530 character, then the specified ciphers (including wildcards) will be removed
531 from the default set instead of replacing them.
532 If the specified list begins with a
534 character, then the specified ciphers will be placed at the head of the
537 The supported ciphers are:
539 .Bl -item -compact -offset indent
555 aes128-gcm@openssh.com
557 aes256-gcm@openssh.com
559 chacha20-poly1305@openssh.com
563 .Bd -literal -offset indent
564 chacha20-poly1305@openssh.com,
565 aes128-ctr,aes192-ctr,aes256-ctr,
566 aes128-gcm@openssh.com,aes256-gcm@openssh.com
569 The list of available ciphers may also be obtained using
571 .It Cm ClientAliveCountMax
572 Sets the number of client alive messages which may be sent without
574 receiving any messages back from the client.
575 If this threshold is reached while client alive messages are being sent,
576 sshd will disconnect the client, terminating the session.
577 It is important to note that the use of client alive messages is very
580 The client alive messages are sent through the encrypted channel
581 and therefore will not be spoofable.
582 The TCP keepalive option enabled by
585 The client alive mechanism is valuable when the client or
586 server depend on knowing when a connection has become unresponsive.
588 The default value is 3.
590 .Cm ClientAliveInterval
592 .Cm ClientAliveCountMax
593 is left at the default, unresponsive SSH clients
594 will be disconnected after approximately 45 seconds.
596 .Cm ClientAliveCountMax
597 disables connection termination.
598 .It Cm ClientAliveInterval
599 Sets a timeout interval in seconds after which if no data has been received
602 will send a message through the encrypted
603 channel to request a response from the client.
605 is 0, indicating that these messages will not be sent to the client.
607 Specifies whether compression is enabled after
608 the user has authenticated successfully.
612 (a legacy synonym for
619 This keyword can be followed by a list of group name patterns, separated
621 Login is disallowed for users whose primary group or supplementary
622 group list matches one of the patterns.
623 Only group names are valid; a numerical group ID is not recognized.
624 By default, login is allowed for all groups.
625 The allow/deny groups directives are processed in the following order:
631 for more information on patterns.
633 This keyword can be followed by a list of user name patterns, separated
635 Login is disallowed for user names that match one of the patterns.
636 Only user names are valid; a numerical user ID is not recognized.
637 By default, login is allowed for all users.
638 If the pattern takes the form USER@HOST then USER and HOST
639 are separately checked, restricting logins to particular
640 users from particular hosts.
641 HOST criteria may additionally contain addresses to match in CIDR
642 address/masklen format.
643 The allow/deny users directives are processed in the following order:
649 for more information on patterns.
650 .It Cm DisableForwarding
651 Disables all forwarding features, including X11,
654 This option overrides all other forwarding-related options and may
655 simplify restricted configurations.
656 .It Cm ExposeAuthInfo
657 Writes a temporary file containing a list of authentication methods and
658 public credentials (e.g. keys) used to authenticate the user.
659 The location of the file is exposed to the user session through the
661 environment variable.
664 .It Cm FingerprintHash
665 Specifies the hash algorithm used when logging key fingerprints.
673 Forces the execution of the command specified by
675 ignoring any command supplied by the client and
678 The command is invoked by using the user's login shell with the -c option.
679 This applies to shell, command, or subsystem execution.
680 It is most useful inside a
683 The command originally supplied by the client is available in the
684 .Ev SSH_ORIGINAL_COMMAND
685 environment variable.
686 Specifying a command of
688 will force the use of an in-process SFTP server that requires no support
690 .Cm ChrootDirectory .
694 Specifies whether remote hosts are allowed to connect to ports
695 forwarded for the client.
698 binds remote port forwardings to the loopback address.
699 This prevents other remote hosts from connecting to forwarded ports.
701 can be used to specify that sshd
702 should allow remote port forwardings to bind to non-loopback addresses, thus
703 allowing other hosts to connect.
706 to force remote port forwardings to be available to the local host only,
708 to force remote port forwardings to bind to the wildcard address, or
710 to allow the client to select the address to which the forwarding is bound.
713 .It Cm GSSAPIAuthentication
714 Specifies whether user authentication based on GSSAPI is allowed.
717 .It Cm GSSAPICleanupCredentials
718 Specifies whether to automatically destroy the user's credentials cache
722 .It Cm GSSAPIStrictAcceptorCheck
723 Determines whether to be strict about the identity of the GSSAPI acceptor
724 a client authenticates against.
727 then the client must authenticate against the host
728 service on the current hostname.
731 then the client may authenticate against any service key stored in the
732 machine's default store.
733 This facility is provided to assist with operation on multi homed machines.
736 .It Cm HostbasedAcceptedAlgorithms
737 Specifies the signature algorithms that will be accepted for hostbased
738 authentication as a list of comma-separated patterns.
739 Alternately if the specified list begins with a
741 character, then the specified signature algorithms will be appended to
742 the default set instead of replacing them.
743 If the specified list begins with a
745 character, then the specified signature algorithms (including wildcards)
746 will be removed from the default set instead of replacing them.
747 If the specified list begins with a
749 character, then the specified signature algorithms will be placed at
750 the head of the default set.
751 The default for this option is:
752 .Bd -literal -offset 3n
753 ssh-ed25519-cert-v01@openssh.com,
754 ecdsa-sha2-nistp256-cert-v01@openssh.com,
755 ecdsa-sha2-nistp384-cert-v01@openssh.com,
756 ecdsa-sha2-nistp521-cert-v01@openssh.com,
757 sk-ssh-ed25519-cert-v01@openssh.com,
758 sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
759 rsa-sha2-512-cert-v01@openssh.com,
760 rsa-sha2-256-cert-v01@openssh.com,
762 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
763 sk-ssh-ed25519@openssh.com,
764 sk-ecdsa-sha2-nistp256@openssh.com,
765 rsa-sha2-512,rsa-sha2-256
768 The list of available signature algorithms may also be obtained using
769 .Qq ssh -Q HostbasedAcceptedAlgorithms .
770 This was formerly named HostbasedAcceptedKeyTypes.
771 .It Cm HostbasedAuthentication
772 Specifies whether rhosts or /etc/hosts.equiv authentication together
773 with successful public key client host authentication is allowed
774 (host-based authentication).
777 .It Cm HostbasedUsesNameFromPacketOnly
778 Specifies whether or not the server will attempt to perform a reverse
779 name lookup when matching the name in the
785 .Cm HostbasedAuthentication .
790 uses the name supplied by the client rather than
791 attempting to resolve the name from the TCP connection itself.
794 .It Cm HostCertificate
795 Specifies a file containing a public host certificate.
796 The certificate's public key must match a private host key already specified
799 The default behaviour of
801 is not to load any certificates.
803 Specifies a file containing a private host key
806 .Pa /etc/ssh/ssh_host_ecdsa_key ,
807 .Pa /etc/ssh/ssh_host_ed25519_key
809 .Pa /etc/ssh/ssh_host_rsa_key .
813 will refuse to use a file if it is group/world-accessible
815 .Cm HostKeyAlgorithms
816 option restricts which of the keys are actually used by
819 It is possible to have multiple host key files.
820 It is also possible to specify public host key files instead.
821 In this case operations on the private key will be delegated
825 Identifies the UNIX-domain socket used to communicate
826 with an agent that has access to the private host keys.
829 is specified, the location of the socket will be read from the
831 environment variable.
832 .It Cm HostKeyAlgorithms
833 Specifies the host key signature algorithms
834 that the server offers.
835 The default for this option is:
836 .Bd -literal -offset 3n
837 ssh-ed25519-cert-v01@openssh.com,
838 ecdsa-sha2-nistp256-cert-v01@openssh.com,
839 ecdsa-sha2-nistp384-cert-v01@openssh.com,
840 ecdsa-sha2-nistp521-cert-v01@openssh.com,
841 sk-ssh-ed25519-cert-v01@openssh.com,
842 sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
843 rsa-sha2-512-cert-v01@openssh.com,
844 rsa-sha2-256-cert-v01@openssh.com,
846 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
847 sk-ssh-ed25519@openssh.com,
848 sk-ecdsa-sha2-nistp256@openssh.com,
849 rsa-sha2-512,rsa-sha2-256
852 The list of available signature algorithms may also be obtained using
853 .Qq ssh -Q HostKeyAlgorithms .
855 Specifies whether to ignore per-user
860 .Cm HostbasedAuthentication .
864 .Pa /etc/ssh/shosts.equiv
865 are still used regardless of this setting.
869 (the default) to ignore all per-user files,
881 .It Cm IgnoreUserKnownHosts
884 should ignore the user's
885 .Pa ~/.ssh/known_hosts
887 .Cm HostbasedAuthentication
888 and use only the system-wide known hosts file
889 .Pa /etc/ssh/ssh_known_hosts .
893 Include the specified configuration file(s).
894 Multiple pathnames may be specified and each pathname may contain
896 wildcards that will be expanded and processed in lexical order.
897 Files without absolute paths are assumed to be in
901 directive may appear inside a
904 to perform conditional inclusion.
906 Specifies the IPv4 type-of-service or DSCP class for the connection.
935 to use the operating system default.
936 This option may take one or two arguments, separated by whitespace.
937 If one argument is specified, it is used as the packet class unconditionally.
938 If two values are specified, the first is automatically selected for
939 interactive sessions and the second for non-interactive sessions.
943 for interactive sessions and
946 for non-interactive sessions.
947 .It Cm KbdInteractiveAuthentication
948 Specifies whether to allow keyboard-interactive authentication.
949 All authentication styles from
954 The argument to this keyword must be
958 .Cm ChallengeResponseAuthentication
959 is a deprecated alias for this.
960 .It Cm KerberosAuthentication
961 Specifies whether the password provided by the user for
962 .Cm PasswordAuthentication
963 will be validated through the Kerberos KDC.
964 To use this option, the server needs a
965 Kerberos servtab which allows the verification of the KDC's identity.
968 .It Cm KerberosGetAFSToken
969 If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
970 an AFS token before accessing the user's home directory.
973 .It Cm KerberosOrLocalPasswd
974 If password authentication through Kerberos fails then
975 the password will be validated via any additional local mechanism
980 .It Cm KerberosTicketCleanup
981 Specifies whether to automatically destroy the user's ticket cache
986 Specifies the available KEX (Key Exchange) algorithms.
987 Multiple algorithms must be comma-separated.
988 Alternately if the specified list begins with a
990 character, then the specified algorithms will be appended to the default set
991 instead of replacing them.
992 If the specified list begins with a
994 character, then the specified algorithms (including wildcards) will be removed
995 from the default set instead of replacing them.
996 If the specified list begins with a
998 character, then the specified algorithms will be placed at the head of the
1000 The supported algorithms are:
1002 .Bl -item -compact -offset indent
1006 curve25519-sha256@libssh.org
1008 diffie-hellman-group1-sha1
1010 diffie-hellman-group14-sha1
1012 diffie-hellman-group14-sha256
1014 diffie-hellman-group16-sha512
1016 diffie-hellman-group18-sha512
1018 diffie-hellman-group-exchange-sha1
1020 diffie-hellman-group-exchange-sha256
1028 sntrup761x25519-sha512@openssh.com
1032 .Bd -literal -offset indent
1033 sntrup761x25519-sha512@openssh.com,
1034 curve25519-sha256,curve25519-sha256@libssh.org,
1035 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
1036 diffie-hellman-group-exchange-sha256,
1037 diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,
1038 diffie-hellman-group14-sha256
1041 The list of available key exchange algorithms may also be obtained using
1042 .Qq ssh -Q KexAlgorithms .
1043 .It Cm ListenAddress
1044 Specifies the local addresses
1047 The following forms may be used:
1049 .Bl -item -offset indent -compact
1053 .Ar hostname | address
1055 .Op Cm rdomain Ar domain
1061 .Op Cm rdomain Ar domain
1065 .Ar IPv4_address : port
1067 .Op Cm rdomain Ar domain
1071 .Oo Ar hostname | address Oc : Ar port
1073 .Op Cm rdomain Ar domain
1080 listen in an explicit routing domain.
1084 sshd will listen on the address and all
1087 The default is to listen on all local addresses on the current default
1091 options are permitted.
1092 For more information on routing domains, see
1094 .It Cm LoginGraceTime
1095 The server disconnects after this time if the user has not
1096 successfully logged in.
1097 If the value is 0, there is no time limit.
1098 The default is 120 seconds.
1100 Gives the verbosity level that is used when logging messages from
1102 The possible values are:
1103 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
1104 The default is INFO.
1105 DEBUG and DEBUG1 are equivalent.
1106 DEBUG2 and DEBUG3 each specify higher levels of debugging output.
1107 Logging with a DEBUG level violates the privacy of users and is not recommended.
1109 Specify one or more overrides to LogLevel.
1110 An override consists of a pattern lists that matches the source file, function
1111 and line number to force detailed logging for.
1112 For example, an override pattern of:
1113 .Bd -literal -offset indent
1114 kex.c:*:1000,*:kex_exchange_identification():*,packet.c:*
1117 would enable detailed logging for line 1000 of
1120 .Fn kex_exchange_identification
1121 function, and all code in the
1124 This option is intended for debugging and no overrides are enabled by default.
1126 Specifies the available MAC (message authentication code) algorithms.
1127 The MAC algorithm is used for data integrity protection.
1128 Multiple algorithms must be comma-separated.
1129 If the specified list begins with a
1131 character, then the specified algorithms will be appended to the default set
1132 instead of replacing them.
1133 If the specified list begins with a
1135 character, then the specified algorithms (including wildcards) will be removed
1136 from the default set instead of replacing them.
1137 If the specified list begins with a
1139 character, then the specified algorithms will be placed at the head of the
1142 The algorithms that contain
1144 calculate the MAC after encryption (encrypt-then-mac).
1145 These are considered safer and their use recommended.
1146 The supported MACs are:
1148 .Bl -item -compact -offset indent
1164 umac-128@openssh.com
1166 hmac-md5-etm@openssh.com
1168 hmac-md5-96-etm@openssh.com
1170 hmac-sha1-etm@openssh.com
1172 hmac-sha1-96-etm@openssh.com
1174 hmac-sha2-256-etm@openssh.com
1176 hmac-sha2-512-etm@openssh.com
1178 umac-64-etm@openssh.com
1180 umac-128-etm@openssh.com
1184 .Bd -literal -offset indent
1185 umac-64-etm@openssh.com,umac-128-etm@openssh.com,
1186 hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
1187 hmac-sha1-etm@openssh.com,
1188 umac-64@openssh.com,umac-128@openssh.com,
1189 hmac-sha2-256,hmac-sha2-512,hmac-sha1
1192 The list of available MAC algorithms may also be obtained using
1195 Introduces a conditional block.
1196 If all of the criteria on the
1198 line are satisfied, the keywords on the following lines override those
1199 set in the global section of the config file, until either another
1201 line or the end of the file.
1202 If a keyword appears in multiple
1204 blocks that are satisfied, only the first instance of the keyword is
1209 are one or more criteria-pattern pairs or the single token
1211 which matches all criteria.
1212 The available criteria are
1225 on which the connection was received).
1227 The match patterns may consist of single entries or comma-separated
1228 lists and may use the wildcard and negation operators described in the
1235 criteria may additionally contain addresses to match in CIDR
1236 address/masklen format,
1237 such as 192.0.2.0/24 or 2001:db8::/32.
1238 Note that the mask length provided must be consistent with the address -
1239 it is an error to specify a mask length that is too long for the address
1240 or one with bits set in this host portion of the address.
1241 For example, 192.0.2.0/33 and 192.0.2.0/8, respectively.
1243 Only a subset of keywords may be used on the lines following a
1246 Available keywords are
1248 .Cm AllowAgentForwarding ,
1250 .Cm AllowStreamLocalForwarding ,
1251 .Cm AllowTcpForwarding ,
1253 .Cm AuthenticationMethods ,
1254 .Cm AuthorizedKeysCommand ,
1255 .Cm AuthorizedKeysCommandUser ,
1256 .Cm AuthorizedKeysFile ,
1257 .Cm AuthorizedPrincipalsCommand ,
1258 .Cm AuthorizedPrincipalsCommandUser ,
1259 .Cm AuthorizedPrincipalsFile ,
1261 .Cm CASignatureAlgorithms ,
1262 .Cm ChannelTimeout ,
1263 .Cm ChrootDirectory ,
1264 .Cm ClientAliveCountMax ,
1265 .Cm ClientAliveInterval ,
1268 .Cm DisableForwarding ,
1269 .Cm ExposeAuthInfo ,
1272 .Cm GSSAPIAuthentication ,
1273 .Cm HostbasedAcceptedAlgorithms ,
1274 .Cm HostbasedAuthentication ,
1275 .Cm HostbasedUsesNameFromPacketOnly ,
1279 .Cm KbdInteractiveAuthentication ,
1280 .Cm KerberosAuthentication ,
1284 .Cm PasswordAuthentication ,
1285 .Cm PermitEmptyPasswords ,
1288 .Cm PermitRootLogin ,
1292 .Cm PubkeyAcceptedAlgorithms ,
1293 .Cm PubkeyAuthentication ,
1294 .Cm PubkeyAuthOptions ,
1299 .Cm StreamLocalBindMask ,
1300 .Cm StreamLocalBindUnlink ,
1301 .Cm TrustedUserCAKeys ,
1302 .Cm UnusedConnectionTimeout ,
1303 .Cm X11DisplayOffset ,
1306 .Cm X11UseLocalhost .
1308 Specifies the maximum number of authentication attempts permitted per
1310 Once the number of failures reaches half this value,
1311 additional failures are logged.
1314 Specifies the maximum number of open shell, login or subsystem (e.g. sftp)
1315 sessions permitted per network connection.
1316 Multiple sessions may be established by clients that support connection
1320 to 1 will effectively disable session multiplexing, whereas setting it to 0
1321 will prevent all shell, login and subsystem sessions while still permitting
1325 Specifies the maximum number of concurrent unauthenticated connections to the
1327 Additional connections will be dropped until authentication succeeds or the
1329 expires for a connection.
1330 The default is 10:30:100.
1332 Alternatively, random early drop can be enabled by specifying
1333 the three colon separated values
1334 start:rate:full (e.g. "10:30:60").
1336 will refuse connection attempts with a probability of rate/100 (30%)
1337 if there are currently start (10) unauthenticated connections.
1338 The probability increases linearly and all connection attempts
1339 are refused if the number of unauthenticated connections reaches full (60).
1343 file that contains the Diffie-Hellman groups used for the
1344 .Dq diffie-hellman-group-exchange-sha1
1346 .Dq diffie-hellman-group-exchange-sha256
1347 key exchange methods.
1350 .It Cm PasswordAuthentication
1351 Specifies whether password authentication is allowed.
1352 Note that passwords may also be accepted via
1353 .Cm KbdInteractiveAuthentication .
1358 .It Cm PermitEmptyPasswords
1359 When password authentication is allowed, it specifies whether the
1360 server allows login to accounts with empty password strings.
1364 Specifies the addresses/ports on which a remote TCP port forwarding may listen.
1365 The listen specification must be one of the following forms:
1367 .Bl -item -offset indent -compact
1380 Multiple permissions may be specified by separating them with whitespace.
1383 can be used to remove all restrictions and permit any listen requests.
1386 can be used to prohibit all listen requests.
1387 The host name may contain wildcards as described in the PATTERNS section in
1391 can also be used in place of a port number to allow all ports.
1392 By default all port forwarding listen requests are permitted.
1395 option may further restrict which addresses may be listened on.
1398 will request a listen host of
1400 if no listen host was specifically requested, and this name is
1401 treated differently to explicit localhost addresses of
1406 Specifies the destinations to which TCP port forwarding is permitted.
1407 The forwarding specification must be one of the following forms:
1409 .Bl -item -offset indent -compact
1418 .Ar IPv4_addr : port
1423 .Ar \&[ IPv6_addr \&] : port
1427 Multiple forwards may be specified by separating them with whitespace.
1430 can be used to remove all restrictions and permit any forwarding requests.
1433 can be used to prohibit all forwarding requests.
1436 can be used for host or port to allow all hosts or ports respectively.
1437 Otherwise, no pattern matching or address lookups are performed on supplied
1439 By default all port forwarding requests are permitted.
1440 .It Cm PermitRootLogin
1441 Specifies whether root can log in using
1443 The argument must be
1445 .Cm prohibit-password ,
1446 .Cm forced-commands-only ,
1452 .Cm ChallengeResponseAuthentication
1457 this setting may be overridden by the PAM policy.
1459 If this option is set to
1460 .Cm prohibit-password
1461 (or its deprecated alias,
1462 .Cm without-password ) ,
1463 password and keyboard-interactive authentication are disabled for root.
1465 If this option is set to
1466 .Cm forced-commands-only ,
1467 root login with public key authentication will be allowed,
1470 option has been specified
1471 (which may be useful for taking remote backups even if root login is
1472 normally not allowed).
1473 All other authentication methods are disabled for root.
1475 If this option is set to
1477 root is not allowed to log in.
1481 allocation is permitted.
1487 device forwarding is allowed.
1488 The argument must be
1504 Independent of this setting, the permissions of the selected
1506 device must allow access to the user.
1507 .It Cm PermitUserEnvironment
1509 .Pa ~/.ssh/environment
1513 .Pa ~/.ssh/authorized_keys
1519 or a pattern-list specifying which environment variable names to accept
1524 Enabling environment processing may enable users to bypass access
1525 restrictions in some configurations using mechanisms such as
1528 Specifies whether any
1533 .It Cm PerSourceMaxStartups
1534 Specifies the number of unauthenticated connections allowed from a
1535 given source address, or
1537 if there is no limit.
1538 This limit is applied in addition to
1543 .It Cm PerSourceNetBlockSize
1544 Specifies the number of bits of source address that are grouped together
1545 for the purposes of applying PerSourceMaxStartups limits.
1546 Values for IPv4 and optionally IPv6 may be specified, separated by a colon.
1549 which means each address is considered individually.
1551 Specifies the file that contains the process ID of the
1556 .Pa /var/run/sshd.pid .
1558 Specifies the port number that
1562 Multiple options of this type are permitted.
1568 should print the date and time of the last user login when a user logs
1577 when a user logs in interactively.
1578 (On some systems it is also printed by the shell,
1583 .It Cm PubkeyAcceptedAlgorithms
1584 Specifies the signature algorithms that will be accepted for public key
1585 authentication as a list of comma-separated patterns.
1586 Alternately if the specified list begins with a
1588 character, then the specified algorithms will be appended to the default set
1589 instead of replacing them.
1590 If the specified list begins with a
1592 character, then the specified algorithms (including wildcards) will be removed
1593 from the default set instead of replacing them.
1594 If the specified list begins with a
1596 character, then the specified algorithms will be placed at the head of the
1598 The default for this option is:
1599 .Bd -literal -offset 3n
1600 ssh-ed25519-cert-v01@openssh.com,
1601 ecdsa-sha2-nistp256-cert-v01@openssh.com,
1602 ecdsa-sha2-nistp384-cert-v01@openssh.com,
1603 ecdsa-sha2-nistp521-cert-v01@openssh.com,
1604 sk-ssh-ed25519-cert-v01@openssh.com,
1605 sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
1606 rsa-sha2-512-cert-v01@openssh.com,
1607 rsa-sha2-256-cert-v01@openssh.com,
1609 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
1610 sk-ssh-ed25519@openssh.com,
1611 sk-ecdsa-sha2-nistp256@openssh.com,
1612 rsa-sha2-512,rsa-sha2-256
1615 The list of available signature algorithms may also be obtained using
1616 .Qq ssh -Q PubkeyAcceptedAlgorithms .
1617 .It Cm PubkeyAuthOptions
1618 Sets one or more public key authentication options.
1619 The supported keywords are:
1621 (the default; indicating no additional options are enabled),
1624 .Cm verify-required .
1628 option causes public key authentication using a FIDO authenticator algorithm
1633 to always require the signature to attest that a physically present user
1634 explicitly confirmed the authentication (usually by touching the authenticator).
1637 requires user presence unless overridden with an authorized_keys option.
1640 flag disables this override.
1644 option requires a FIDO key signature attest that the user was verified,
1651 options have any effect for other, non-FIDO, public key types.
1652 .It Cm PubkeyAuthentication
1653 Specifies whether public key authentication is allowed.
1657 Specifies the maximum amount of data that may be transmitted or received
1658 before the session key is renegotiated, optionally followed by a maximum
1659 amount of time that may pass before the session key is renegotiated.
1660 The first argument is specified in bytes and may have a suffix of
1665 to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1666 The default is between
1670 depending on the cipher.
1671 The optional second value is specified in seconds and may use any of the
1672 units documented in the
1675 The default value for
1679 which means that rekeying is performed after the cipher's default amount
1680 of data has been sent or received and no time based rekeying is done.
1681 .It Cm RequiredRSASize
1682 Specifies the minimum RSA key size (in bits) that
1685 User and host-based authentication keys smaller than this limit will be
1690 Note that this limit may only be raised from the default.
1692 Specifies revoked public keys file, or
1695 Keys listed in this file will be refused for public key authentication.
1696 Note that if this file is not readable, then public key authentication will
1697 be refused for all users.
1698 Keys may be specified as a text file, listing one public key per line, or as
1699 an OpenSSH Key Revocation List (KRL) as generated by
1701 For more information on KRLs, see the KEY REVOCATION LISTS section in
1704 Specifies an explicit routing domain that is applied after authentication
1706 The user session, as well as any forwarded or listening IP sockets,
1707 will be bound to this
1709 If the routing domain is set to
1711 then the domain in which the incoming connection was received will be applied.
1712 .It Cm SecurityKeyProvider
1713 Specifies a path to a library that will be used when loading
1714 FIDO authenticator-hosted keys, overriding the default of using
1715 the built-in USB HID support.
1717 Specifies one or more environment variables to set in child sessions started
1722 The environment value may be quoted (e.g. if it contains whitespace
1724 Environment variables set by
1726 override the default environment and any variables specified by the user
1730 .Cm PermitUserEnvironment .
1731 .It Cm StreamLocalBindMask
1732 Sets the octal file creation mode mask
1734 used when creating a Unix-domain socket file for local or remote
1736 This option is only used for port forwarding to a Unix-domain socket file.
1738 The default value is 0177, which creates a Unix-domain socket file that is
1739 readable and writable only by the owner.
1740 Note that not all operating systems honor the file mode on Unix-domain
1742 .It Cm StreamLocalBindUnlink
1743 Specifies whether to remove an existing Unix-domain socket file for local
1744 or remote port forwarding before creating a new one.
1745 If the socket file already exists and
1746 .Cm StreamLocalBindUnlink
1749 will be unable to forward the port to the Unix-domain socket file.
1750 This option is only used for port forwarding to a Unix-domain socket file.
1752 The argument must be
1761 should check file modes and ownership of the
1762 user's files and home directory before accepting login.
1763 This is normally desirable because novices sometimes accidentally leave their
1764 directory or files world-writable.
1767 Note that this does not apply to
1768 .Cm ChrootDirectory ,
1769 whose permissions and ownership are checked unconditionally.
1771 Configures an external subsystem (e.g. file transfer daemon).
1772 Arguments should be a subsystem name and a command (with optional arguments)
1773 to execute upon subsystem request.
1777 implements the SFTP file transfer subsystem.
1779 Alternately the name
1781 implements an in-process SFTP server.
1782 This may simplify configurations using
1784 to force a different filesystem root on clients.
1786 By default no subsystems are defined.
1787 .It Cm SyslogFacility
1788 Gives the facility code that is used when logging messages from
1790 The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1791 LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1792 The default is AUTH.
1794 Specifies whether the system should send TCP keepalive messages to the
1796 If they are sent, death of the connection or crash of one
1797 of the machines will be properly noticed.
1798 However, this means that
1799 connections will die if the route is down temporarily, and some people
1801 On the other hand, if TCP keepalives are not sent,
1802 sessions may hang indefinitely on the server, leaving
1804 users and consuming server resources.
1808 (to send TCP keepalive messages), and the server will notice
1809 if the network goes down or the client host crashes.
1810 This avoids infinitely hanging sessions.
1812 To disable TCP keepalive messages, the value should be set to
1814 .It Cm TrustedUserCAKeys
1815 Specifies a file containing public keys of certificate authorities that are
1816 trusted to sign user certificates for authentication, or
1819 Keys are listed one per line; empty lines and comments starting with
1822 If a certificate is presented for authentication and has its signing CA key
1823 listed in this file, then it may be used for authentication for any user
1824 listed in the certificate's principals list.
1825 Note that certificates that lack a list of principals will not be permitted
1826 for authentication using
1827 .Cm TrustedUserCAKeys .
1828 For more details on certificates, see the CERTIFICATES section in
1830 .It Cm UnusedConnectionTimeout
1831 Specifies whether and how quickly
1833 should close client connections with no open channels.
1834 Open channels include active shell, command execution or subsystem
1835 sessions, connected network, socket, agent or X11 forwardings.
1836 Forwarding listeners, such as those from the
1839 flag, are not considered as open channels and do not prevent the timeout.
1841 is specified in seconds or may use any of the units documented in the
1845 Note that this timeout starts when the client connection completes
1846 user authentication but before the client has an opportunity to open any
1848 Caution should be used when using short timeout values, as they may not
1849 provide sufficient time for the client to request and open its channels
1850 before terminating the connection.
1854 is to never expire connections for having no open channels.
1855 This option may be useful in conjunction with
1856 .Cm ChannelTimeout .
1860 attempts to send authentication success and failure messages
1866 For forward compatibility with an upcoming
1870 alias can be used instead.
1874 should look up the remote host name, and to check that
1875 the resolved host name for the remote IP address maps back to the
1876 very same IP address.
1878 If this option is set to
1880 then only addresses and not host names may be used in
1881 .Pa ~/.ssh/authorized_keys
1891 Enables the Pluggable Authentication Module interface.
1894 this will enable PAM authentication using
1895 .Cm KbdInteractiveAuthentication
1897 .Cm PasswordAuthentication
1898 in addition to PAM account and session module processing for all
1899 authentication types.
1901 Because PAM keyboard-interactive authentication usually serves an equivalent
1902 role to password authentication, you should disable either
1903 .Cm PasswordAuthentication
1905 .Cm KbdInteractiveAuthentication .
1909 is enabled, you will not be able to run
1914 .It Cm VersionAddendum
1915 Optionally specifies additional text to append to the SSH protocol banner
1916 sent by the server upon connection.
1918 .Qq FreeBSD-20230205 .
1921 may be used to disable this.
1922 .It Cm X11DisplayOffset
1923 Specifies the first display number available for
1926 This prevents sshd from interfering with real X11 servers.
1928 .It Cm X11Forwarding
1929 Specifies whether X11 forwarding is permitted.
1930 The argument must be
1937 When X11 forwarding is enabled, there may be additional exposure to
1938 the server and to client displays if the
1940 proxy display is configured to listen on the wildcard address (see
1941 .Cm X11UseLocalhost ) ,
1942 though this is not the default.
1943 Additionally, the authentication spoofing and authentication data
1944 verification and substitution occur on the client side.
1945 The security risk of using X11 forwarding is that the client's X11
1946 display server may be exposed to attack when the SSH client requests
1947 forwarding (see the warnings for
1950 .Xr ssh_config 5 ) .
1951 A system administrator may have a stance in which they want to
1952 protect clients that may expose themselves to attack by unwittingly
1953 requesting X11 forwarding, which can warrant a
1957 Note that disabling X11 forwarding does not prevent users from
1958 forwarding X11 traffic, as users can always install their own forwarders.
1959 .It Cm X11UseLocalhost
1962 should bind the X11 forwarding server to the loopback address or to
1963 the wildcard address.
1965 sshd binds the forwarding server to the loopback address and sets the
1966 hostname part of the
1968 environment variable to
1970 This prevents remote hosts from connecting to the proxy display.
1971 However, some older X11 clients may not function with this
1976 to specify that the forwarding server should be bound to the wildcard
1978 The argument must be
1984 .It Cm XAuthLocation
1985 Specifies the full pathname of the
1991 .Pa /usr/local/bin/xauth .
1995 command-line arguments and configuration file options that specify time
1996 may be expressed using a sequence of the form:
1998 .Ar time Op Ar qualifier ,
2002 is a positive integer value and
2004 is one of the following:
2006 .Bl -tag -width Ds -compact -offset indent
2021 Each member of the sequence is added together to calculate
2022 the total time value.
2024 Time format examples:
2026 .Bl -tag -width Ds -compact -offset indent
2028 600 seconds (10 minutes)
2032 1 hour 30 minutes (90 minutes)
2035 Arguments to some keywords can make use of tokens,
2036 which are expanded at runtime:
2038 .Bl -tag -width XXXX -offset indent -compact
2043 The routing domain in which the incoming connection was received.
2045 The fingerprint of the CA key.
2047 The fingerprint of the key or certificate.
2049 The home directory of the user.
2051 The key ID in the certificate.
2053 The base64-encoded CA key.
2055 The base64-encoded key or certificate for authentication.
2057 The serial number of the certificate.
2059 The type of the CA key.
2061 The key or certificate type.
2063 The numeric user ID of the target user.
2068 .Cm AuthorizedKeysCommand
2069 accepts the tokens %%, %f, %h, %k, %t, %U, and %u.
2071 .Cm AuthorizedKeysFile
2072 accepts the tokens %%, %h, %U, and %u.
2074 .Cm AuthorizedPrincipalsCommand
2075 accepts the tokens %%, %F, %f, %h, %i, %K, %k, %s, %T, %t, %U, and %u.
2077 .Cm AuthorizedPrincipalsFile
2078 accepts the tokens %%, %h, %U, and %u.
2081 accepts the tokens %%, %h, %U, and %u.
2084 accepts the token %D.
2087 .It Pa /etc/ssh/sshd_config
2088 Contains configuration data for
2090 This file should be writable by root only, but it is recommended
2091 (though not necessary) that it be world-readable.
2098 OpenSSH is a derivative of the original and free
2099 ssh 1.2.12 release by
2101 .An Aaron Campbell , Bob Beck , Markus Friedl , Niels Provos ,
2105 removed many bugs, re-added newer features and
2108 contributed the support for SSH protocol versions 1.5 and 2.0.
2112 contributed support for privilege separation.