3 .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4 .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 .\" All rights reserved
7 .\" As far as I am concerned, the code I have written for this software
8 .\" can be used freely for any purpose. Any derived versions of this
9 .\" software must be clearly marked as such, and if the derived work is
10 .\" incompatible with the protocol description in the RFC file, it must be
11 .\" called by a name other than "ssh" or "Secure Shell".
13 .\" Copyright (c) 1999,2000 Markus Friedl. All rights reserved.
14 .\" Copyright (c) 1999 Aaron Campbell. All rights reserved.
15 .\" Copyright (c) 1999 Theo de Raadt. All rights reserved.
17 .\" Redistribution and use in source and binary forms, with or without
18 .\" modification, are permitted provided that the following conditions
20 .\" 1. Redistributions of source code must retain the above copyright
21 .\" notice, this list of conditions and the following disclaimer.
22 .\" 2. Redistributions in binary form must reproduce the above copyright
23 .\" notice, this list of conditions and the following disclaimer in the
24 .\" documentation and/or other materials provided with the distribution.
26 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 .\" $OpenBSD: sshd_config.5,v 1.102 2009/02/22 23:59:25 djm Exp $
44 .Nd OpenSSH SSH daemon configuration file
46 .Nm /etc/ssh/sshd_config
49 reads configuration data from
50 .Pa /etc/ssh/sshd_config
51 (or the file specified with
54 The file contains keyword-argument pairs, one per line.
57 and empty lines are interpreted as comments.
58 Arguments may optionally be enclosed in double quotes
60 in order to represent arguments containing spaces.
63 keywords and their meanings are as follows (note that
64 keywords are case-insensitive and arguments are case-sensitive):
67 Specifies what environment variables sent by the client will be copied into
74 for how to configure the client.
75 Note that environment passing is only supported for protocol 2.
76 Variables are specified by name, which may contain the wildcard characters
80 Multiple environment variables may be separated by whitespace or spread
84 Be warned that some environment variables could be used to bypass restricted
86 For this reason, care should be taken in the use of this directive.
87 The default is not to accept any environment variables.
89 Specifies which address family should be used by
99 .It Cm AllowAgentForwarding
102 forwarding is permitted.
105 Note that disabling agent forwarding does not improve security
106 unless users are also denied shell access, as they can always install
107 their own forwarders.
109 This keyword can be followed by a list of group name patterns, separated
111 If specified, login is allowed only for users whose primary
112 group or supplementary group list matches one of the patterns.
113 Only group names are valid; a numerical group ID is not recognized.
114 By default, login is allowed for all groups.
115 The allow/deny directives are processed in the following order:
126 for more information on patterns.
127 .It Cm AllowTcpForwarding
128 Specifies whether TCP forwarding is permitted.
131 Note that disabling TCP forwarding does not improve security unless
132 users are also denied shell access, as they can always install their
135 This keyword can be followed by a list of user name patterns, separated
137 If specified, login is allowed only for user names that
138 match one of the patterns.
139 Only user names are valid; a numerical user ID is not recognized.
140 By default, login is allowed for all users.
141 If the pattern takes the form USER@HOST then USER and HOST
142 are separately checked, restricting logins to particular
143 users from particular hosts.
144 The allow/deny directives are processed in the following order:
155 for more information on patterns.
156 .It Cm AuthorizedKeysFile
157 Specifies the file that contains the public keys that can be used
158 for user authentication.
159 .Cm AuthorizedKeysFile
160 may contain tokens of the form %T which are substituted during connection
162 The following tokens are defined: %% is replaced by a literal '%',
163 %h is replaced by the home directory of the user being authenticated, and
164 %u is replaced by the username of that user.
166 .Cm AuthorizedKeysFile
167 is taken to be an absolute path or one relative to the user's home
170 .Dq .ssh/authorized_keys .
172 The contents of the specified file are sent to the remote user before
173 authentication is allowed.
176 then no banner is displayed.
177 This option is only available for protocol version 2.
178 By default, no banner is displayed.
179 .It Cm ChallengeResponseAuthentication
180 Specifies whether challenge-response authentication is allowed.
185 .It Cm ChrootDirectory
188 to after authentication.
189 This path, and all its components, must be root-owned directories that are
190 not writable by any other user or group.
192 The path may contain the following tokens that are expanded at runtime once
193 the connecting user has been authenticated: %% is replaced by a literal '%',
194 %h is replaced by the home directory of the user being authenticated, and
195 %u is replaced by the username of that user.
199 must contain the necessary files and directories to support the
201 For an interactive session this requires at least a shell, typically
215 For file transfer sessions using
217 no additional configuration of the environment is necessary if the
218 in-process sftp server is used (see
222 The default is not to
225 Specifies the ciphers allowed for protocol version 2.
226 Multiple ciphers must be comma-separated.
227 The supported ciphers are
242 .Bd -literal -offset 3n
243 aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
244 aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
247 .It Cm ClientAliveCountMax
248 Sets the number of client alive messages (see below) which may be
251 receiving any messages back from the client.
252 If this threshold is reached while client alive messages are being sent,
253 sshd will disconnect the client, terminating the session.
254 It is important to note that the use of client alive messages is very
258 The client alive messages are sent through the encrypted channel
259 and therefore will not be spoofable.
260 The TCP keepalive option enabled by
263 The client alive mechanism is valuable when the client or
264 server depend on knowing when a connection has become inactive.
266 The default value is 3.
268 .Cm ClientAliveInterval
269 (see below) is set to 15, and
270 .Cm ClientAliveCountMax
271 is left at the default, unresponsive SSH clients
272 will be disconnected after approximately 45 seconds.
273 This option applies to protocol version 2 only.
274 .It Cm ClientAliveInterval
275 Sets a timeout interval in seconds after which if no data has been received
278 will send a message through the encrypted
279 channel to request a response from the client.
281 is 0, indicating that these messages will not be sent to the client.
282 This option applies to protocol version 2 only.
284 Specifies whether compression is allowed, or delayed until
285 the user has authenticated successfully.
294 This keyword can be followed by a list of group name patterns, separated
296 Login is disallowed for users whose primary group or supplementary
297 group list matches one of the patterns.
298 Only group names are valid; a numerical group ID is not recognized.
299 By default, login is allowed for all groups.
300 The allow/deny directives are processed in the following order:
311 for more information on patterns.
313 This keyword can be followed by a list of user name patterns, separated
315 Login is disallowed for user names that match one of the patterns.
316 Only user names are valid; a numerical user ID is not recognized.
317 By default, login is allowed for all users.
318 If the pattern takes the form USER@HOST then USER and HOST
319 are separately checked, restricting logins to particular
320 users from particular hosts.
321 The allow/deny directives are processed in the following order:
332 for more information on patterns.
334 Forces the execution of the command specified by
336 ignoring any command supplied by the client and
339 The command is invoked by using the user's login shell with the -c option.
340 This applies to shell, command, or subsystem execution.
341 It is most useful inside a
344 The command originally supplied by the client is available in the
345 .Ev SSH_ORIGINAL_COMMAND
346 environment variable.
347 Specifying a command of
349 will force the use of an in-process sftp server that requires no support
351 .Cm ChrootDirectory .
353 Specifies whether remote hosts are allowed to connect to ports
354 forwarded for the client.
357 binds remote port forwardings to the loopback address.
358 This prevents other remote hosts from connecting to forwarded ports.
360 can be used to specify that sshd
361 should allow remote port forwardings to bind to non-loopback addresses, thus
362 allowing other hosts to connect.
365 to force remote port forwardings to be available to the local host only,
367 to force remote port forwardings to bind to the wildcard address, or
369 to allow the client to select the address to which the forwarding is bound.
372 .It Cm GSSAPIAuthentication
373 Specifies whether user authentication based on GSSAPI is allowed.
376 Note that this option applies to protocol version 2 only.
377 .It Cm GSSAPICleanupCredentials
378 Specifies whether to automatically destroy the user's credentials cache
382 Note that this option applies to protocol version 2 only.
383 .It Cm HostbasedAuthentication
384 Specifies whether rhosts or /etc/hosts.equiv authentication together
385 with successful public key client host authentication is allowed
386 (host-based authentication).
387 This option is similar to
388 .Cm RhostsRSAAuthentication
389 and applies to protocol version 2 only.
392 .It Cm HostbasedUsesNameFromPacketOnly
393 Specifies whether or not the server will attempt to perform a reverse
394 name lookup when matching the name in the
400 .Cm HostbasedAuthentication .
405 uses the name supplied by the client rather than
406 attempting to resolve the name from the TCP connection itself.
410 Specifies a file containing a private host key
413 .Pa /etc/ssh/ssh_host_key
414 for protocol version 1, and
415 .Pa /etc/ssh/ssh_host_rsa_key
417 .Pa /etc/ssh/ssh_host_dsa_key
418 for protocol version 2.
421 will refuse to use a file if it is group/world-accessible.
422 It is possible to have multiple host key files.
424 keys are used for version 1 and
428 are used for version 2 of the SSH protocol.
434 files will not be used in
435 .Cm RhostsRSAAuthentication
437 .Cm HostbasedAuthentication .
441 .Pa /etc/ssh/shosts.equiv
445 .It Cm IgnoreUserKnownHosts
448 should ignore the user's
449 .Pa ~/.ssh/known_hosts
451 .Cm RhostsRSAAuthentication
453 .Cm HostbasedAuthentication .
456 .It Cm KerberosAuthentication
457 Specifies whether the password provided by the user for
458 .Cm PasswordAuthentication
459 will be validated through the Kerberos KDC.
460 To use this option, the server needs a
461 Kerberos servtab which allows the verification of the KDC's identity.
464 .It Cm KerberosGetAFSToken
465 If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
466 an AFS token before accessing the user's home directory.
469 .It Cm KerberosOrLocalPasswd
470 If password authentication through Kerberos fails then
471 the password will be validated via any additional local mechanism
476 .It Cm KerberosTicketCleanup
477 Specifies whether to automatically destroy the user's ticket cache
481 .It Cm KeyRegenerationInterval
482 In protocol version 1, the ephemeral server key is automatically regenerated
483 after this many seconds (if it has been used).
484 The purpose of regeneration is to prevent
485 decrypting captured sessions by later breaking into the machine and
487 The key is never stored anywhere.
488 If the value is 0, the key is never regenerated.
489 The default is 3600 (seconds).
491 Specifies the local addresses
494 The following forms may be used:
496 .Bl -item -offset indent -compact
500 .Ar host No | Ar IPv4_addr No | Ar IPv6_addr
505 .Ar host No | Ar IPv4_addr No : Ar port
511 .Ar host No | Ar IPv6_addr Oc : Ar port
518 sshd will listen on the address and all prior
521 The default is to listen on all local addresses.
524 options are permitted.
527 options must precede this option for non-port qualified addresses.
528 .It Cm LoginGraceTime
529 The server disconnects after this time if the user has not
530 successfully logged in.
531 If the value is 0, there is no time limit.
532 The default is 120 seconds.
534 Gives the verbosity level that is used when logging messages from
536 The possible values are:
537 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
539 DEBUG and DEBUG1 are equivalent.
540 DEBUG2 and DEBUG3 each specify higher levels of debugging output.
541 Logging with a DEBUG level violates the privacy of users and is not recommended.
543 Specifies the available MAC (message authentication code) algorithms.
544 The MAC algorithm is used in protocol version 2
545 for data integrity protection.
546 Multiple algorithms must be comma-separated.
548 .Bd -literal -offset indent
549 hmac-md5,hmac-sha1,umac-64@openssh.com,
550 hmac-ripemd160,hmac-sha1-96,hmac-md5-96
553 Introduces a conditional block.
554 If all of the criteria on the
556 line are satisfied, the keywords on the following lines override those
557 set in the global section of the config file, until either another
559 line or the end of the file.
563 are one or more criteria-pattern pairs.
564 The available criteria are
570 The match patterns may consist of single entries or comma-separated
571 lists and may use the wildcard and negation operators described in the
578 criteria may additionally contain addresses to match in CIDR
579 address/masklen format, e.g.\&
583 Note that the mask length provided must be consistent with the address -
584 it is an error to specify a mask length that is too long for the address
585 or one with bits set in this host portion of the address.
592 Only a subset of keywords may be used on the lines following a
595 Available keywords are
596 .Cm AllowAgentForwarding ,
597 .Cm AllowTcpForwarding ,
599 .Cm ChrootDirectory ,
602 .Cm GSSAPIAuthentication ,
603 .Cm HostbasedAuthentication ,
604 .Cm KbdInteractiveAuthentication ,
605 .Cm KerberosAuthentication ,
608 .Cm PasswordAuthentication ,
609 .Cm PermitEmptyPasswords ,
611 .Cm PermitRootLogin ,
612 .Cm RhostsRSAAuthentication ,
613 .Cm RSAAuthentication ,
614 .Cm X11DisplayOffset ,
617 .Cm X11UseLocalHost .
619 Specifies the maximum number of authentication attempts permitted per
621 Once the number of failures reaches half this value,
622 additional failures are logged.
625 Specifies the maximum number of open sessions permitted per network connection.
628 Specifies the maximum number of concurrent unauthenticated connections to the
630 Additional connections will be dropped until authentication succeeds or the
632 expires for a connection.
635 Alternatively, random early drop can be enabled by specifying
636 the three colon separated values
640 will refuse connection attempts with a probability of
643 if there are currently
646 unauthenticated connections.
647 The probability increases linearly and all connection attempts
648 are refused if the number of unauthenticated connections reaches
651 .It Cm PasswordAuthentication
652 Specifies whether password authentication is allowed.
657 .It Cm PermitEmptyPasswords
658 When password authentication is allowed, it specifies whether the
659 server allows login to accounts with empty password strings.
663 Specifies the destinations to which TCP port forwarding is permitted.
664 The forwarding specification must be one of the following forms:
666 .Bl -item -offset indent -compact
680 .Ar \&[ IPv6_addr \&] : port
684 Multiple forwards may be specified by separating them with whitespace.
687 can be used to remove all restrictions and permit any forwarding requests.
688 By default all port forwarding requests are permitted.
689 .It Cm PermitRootLogin
690 Specifies whether root can log in using
694 .Dq without-password ,
695 .Dq forced-commands-only ,
701 .Cm ChallengeResponseAuthentication
704 the root user may be allowed in with its password even if
705 .Cm PermitRootLogin is set to
706 .Dq without-password .
708 If this option is set to
709 .Dq without-password ,
710 password authentication is disabled for root.
712 If this option is set to
713 .Dq forced-commands-only ,
714 root login with public key authentication will be allowed,
717 option has been specified
718 (which may be useful for taking remote backups even if root login is
719 normally not allowed).
720 All other authentication methods are disabled for root.
722 If this option is set to
724 root is not allowed to log in.
728 device forwarding is allowed.
744 .It Cm PermitUserEnvironment
746 .Pa ~/.ssh/environment
750 .Pa ~/.ssh/authorized_keys
755 Enabling environment processing may enable users to bypass access
756 restrictions in some configurations using mechanisms such as
759 Specifies the file that contains the process ID of the
762 .Pa /var/run/sshd.pid .
764 Specifies the port number that
768 Multiple options of this type are permitted.
774 should print the date and time of the last user login when a user logs
783 when a user logs in interactively.
784 (On some systems it is also printed by the shell,
790 Specifies the protocol versions
793 The possible values are
797 Multiple versions must be comma-separated.
800 Note that the order of the protocol list does not indicate preference,
801 because the client selects among multiple protocol versions offered
807 .It Cm PubkeyAuthentication
808 Specifies whether public key authentication is allowed.
811 Note that this option applies to protocol version 2 only.
812 .It Cm RhostsRSAAuthentication
813 Specifies whether rhosts or
815 authentication together
816 with successful RSA host authentication is allowed.
819 This option applies to protocol version 1 only.
820 .It Cm RSAAuthentication
821 Specifies whether pure RSA authentication is allowed.
824 This option applies to protocol version 1 only.
826 Defines the number of bits in the ephemeral protocol version 1 server key.
827 The minimum value is 512, and the default is 1024.
831 should check file modes and ownership of the
832 user's files and home directory before accepting login.
833 This is normally desirable because novices sometimes accidentally leave their
834 directory or files world-writable.
838 Configures an external subsystem (e.g. file transfer daemon).
839 Arguments should be a subsystem name and a command (with optional arguments)
840 to execute upon subsystem request.
846 file transfer subsystem.
850 implements an in-process
853 This may simplify configurations using
855 to force a different filesystem root on clients.
857 By default no subsystems are defined.
858 Note that this option applies to protocol version 2 only.
859 .It Cm SyslogFacility
860 Gives the facility code that is used when logging messages from
862 The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
863 LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
866 Specifies whether the system should send TCP keepalive messages to the
868 If they are sent, death of the connection or crash of one
869 of the machines will be properly noticed.
870 However, this means that
871 connections will die if the route is down temporarily, and some people
873 On the other hand, if TCP keepalives are not sent,
874 sessions may hang indefinitely on the server, leaving
876 users and consuming server resources.
880 (to send TCP keepalive messages), and the server will notice
881 if the network goes down or the client host crashes.
882 This avoids infinitely hanging sessions.
884 To disable TCP keepalive messages, the value should be set to
889 should look up the remote host name and check that
890 the resolved host name for the remote IP address maps back to the
891 very same IP address.
897 is used for interactive login sessions.
902 is never used for remote command execution.
903 Note also, that if this is enabled,
905 will be disabled because
907 does not know how to handle
911 .Cm UsePrivilegeSeparation
912 is specified, it will be disabled after authentication.
914 Enables the Pluggable Authentication Module interface.
917 this will enable PAM authentication using
918 .Cm ChallengeResponseAuthentication
920 .Cm PasswordAuthentication
921 in addition to PAM account and session module processing for all
922 authentication types.
924 Because PAM challenge-response authentication usually serves an equivalent
925 role to password authentication, you should disable either
926 .Cm PasswordAuthentication
928 .Cm ChallengeResponseAuthentication.
932 is enabled, you will not be able to run
937 .It Cm UsePrivilegeSeparation
940 separates privileges by creating an unprivileged child process
941 to deal with incoming network traffic.
942 After successful authentication, another process will be created that has
943 the privilege of the authenticated user.
944 The goal of privilege separation is to prevent privilege
945 escalation by containing any corruption within the unprivileged processes.
948 .It Cm VersionAddendum
949 Specifies a string to append to the regular version string to identify
950 OS- or site-specific modifications.
952 .Dq FreeBSD-20090522 .
953 .It Cm X11DisplayOffset
954 Specifies the first display number available for
957 This prevents sshd from interfering with real X11 servers.
960 Specifies whether X11 forwarding is permitted.
968 When X11 forwarding is enabled, there may be additional exposure to
969 the server and to client displays if the
971 proxy display is configured to listen on the wildcard address (see
973 below), though this is not the default.
974 Additionally, the authentication spoofing and authentication data
975 verification and substitution occur on the client side.
976 The security risk of using X11 forwarding is that the client's X11
977 display server may be exposed to attack when the SSH client requests
978 forwarding (see the warnings for
982 A system administrator may have a stance in which they want to
983 protect clients that may expose themselves to attack by unwittingly
984 requesting X11 forwarding, which can warrant a
988 Note that disabling X11 forwarding does not prevent users from
989 forwarding X11 traffic, as users can always install their own forwarders.
990 X11 forwarding is automatically disabled if
993 .It Cm X11UseLocalhost
996 should bind the X11 forwarding server to the loopback address or to
997 the wildcard address.
999 sshd binds the forwarding server to the loopback address and sets the
1000 hostname part of the
1002 environment variable to
1004 This prevents remote hosts from connecting to the proxy display.
1005 However, some older X11 clients may not function with this
1010 to specify that the forwarding server should be bound to the wildcard
1012 The argument must be
1018 .It Cm XAuthLocation
1019 Specifies the full pathname of the
1023 .Pa /usr/local/bin/xauth .
1027 command-line arguments and configuration file options that specify time
1028 may be expressed using a sequence of the form:
1030 .Ar time Op Ar qualifier ,
1034 is a positive integer value and
1036 is one of the following:
1038 .Bl -tag -width Ds -compact -offset indent
1053 Each member of the sequence is added together to calculate
1054 the total time value.
1056 Time format examples:
1058 .Bl -tag -width Ds -compact -offset indent
1060 600 seconds (10 minutes)
1064 1 hour 30 minutes (90 minutes)
1068 .It Pa /etc/ssh/sshd_config
1069 Contains configuration data for
1071 This file should be writable by root only, but it is recommended
1072 (though not necessary) that it be world-readable.
1077 OpenSSH is a derivative of the original and free
1078 ssh 1.2.12 release by Tatu Ylonen.
1079 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1080 Theo de Raadt and Dug Song
1081 removed many bugs, re-added newer features and
1083 Markus Friedl contributed the support for SSH
1084 protocol versions 1.5 and 2.0.
1085 Niels Provos and Markus Friedl contributed support
1086 for privilege separation.