xref: /freebsd/crypto/openssh/sshd_config.5 (revision 1a61beb0549e05b33df31380e427d90f6e46ff7e)
1.\"
2.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
3.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4.\"                    All rights reserved
5.\"
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".
11.\"
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.
15.\"
16.\" Redistribution and use in source and binary forms, with or without
17.\" modification, are permitted provided that the following conditions
18.\" are met:
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.
24.\"
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.
35.\"
36.\" $OpenBSD: sshd_config.5,v 1.170 2013/12/08 09:53:27 dtucker Exp $
37.\" $FreeBSD$
38.Dd December 8, 2013
39.Dt SSHD_CONFIG 5
40.Os
41.Sh NAME
42.Nm sshd_config
43.Nd OpenSSH SSH daemon configuration file
44.Sh SYNOPSIS
45.Nm /etc/ssh/sshd_config
46.Sh DESCRIPTION
47.Xr sshd 8
48reads configuration data from
49.Pa /etc/ssh/sshd_config
50(or the file specified with
51.Fl f
52on the command line).
53The file contains keyword-argument pairs, one per line.
54Lines starting with
55.Ql #
56and empty lines are interpreted as comments.
57Arguments may optionally be enclosed in double quotes
58.Pq \&"
59in order to represent arguments containing spaces.
60.Pp
61The possible
62keywords and their meanings are as follows (note that
63keywords are case-insensitive and arguments are case-sensitive):
64.Bl -tag -width Ds
65.It Cm AcceptEnv
66Specifies what environment variables sent by the client will be copied into
67the session's
68.Xr environ 7 .
69See
70.Cm SendEnv
71in
72.Xr ssh_config 5
73for how to configure the client.
74Note that environment passing is only supported for protocol 2.
75Variables are specified by name, which may contain the wildcard characters
76.Ql *
77and
78.Ql \&? .
79Multiple environment variables may be separated by whitespace or spread
80across multiple
81.Cm AcceptEnv
82directives.
83Be warned that some environment variables could be used to bypass restricted
84user environments.
85For this reason, care should be taken in the use of this directive.
86The default is not to accept any environment variables.
87.It Cm AddressFamily
88Specifies which address family should be used by
89.Xr sshd 8 .
90Valid arguments are
91.Dq any ,
92.Dq inet
93(use IPv4 only), or
94.Dq inet6
95(use IPv6 only).
96The default is
97.Dq any .
98.It Cm AllowAgentForwarding
99Specifies whether
100.Xr ssh-agent 1
101forwarding is permitted.
102The default is
103.Dq yes .
104Note that disabling agent forwarding does not improve security
105unless users are also denied shell access, as they can always install
106their own forwarders.
107.It Cm AllowGroups
108This keyword can be followed by a list of group name patterns, separated
109by spaces.
110If specified, login is allowed only for users whose primary
111group or supplementary group list matches one of the patterns.
112Only group names are valid; a numerical group ID is not recognized.
113By default, login is allowed for all groups.
114The allow/deny directives are processed in the following order:
115.Cm DenyUsers ,
116.Cm AllowUsers ,
117.Cm DenyGroups ,
118and finally
119.Cm AllowGroups .
120.Pp
121See PATTERNS in
122.Xr ssh_config 5
123for more information on patterns.
124.It Cm AllowTcpForwarding
125Specifies whether TCP forwarding is permitted.
126The available options are
127.Dq yes
128or
129.Dq all
130to allow TCP forwarding,
131.Dq no
132to prevent all TCP forwarding,
133.Dq local
134to allow local (from the perspective of
135.Xr ssh 1 )
136forwarding only or
137.Dq remote
138to allow remote forwarding only.
139The default is
140.Dq yes .
141Note that disabling TCP forwarding does not improve security unless
142users are also denied shell access, as they can always install their
143own forwarders.
144.It Cm AllowUsers
145This keyword can be followed by a list of user name patterns, separated
146by spaces.
147If specified, login is allowed only for user names that
148match one of the patterns.
149Only user names are valid; a numerical user ID is not recognized.
150By default, login is allowed for all users.
151If the pattern takes the form USER@HOST then USER and HOST
152are separately checked, restricting logins to particular
153users from particular hosts.
154The allow/deny directives are processed in the following order:
155.Cm DenyUsers ,
156.Cm AllowUsers ,
157.Cm DenyGroups ,
158and finally
159.Cm AllowGroups .
160.Pp
161See PATTERNS in
162.Xr ssh_config 5
163for more information on patterns.
164.It Cm AuthenticationMethods
165Specifies the authentication methods that must be successfully completed
166for a user to be granted access.
167This option must be followed by one or more comma-separated lists of
168authentication method names.
169Successful authentication requires completion of every method in at least
170one of these lists.
171.Pp
172For example, an argument of
173.Dq publickey,password publickey,keyboard-interactive
174would require the user to complete public key authentication, followed by
175either password or keyboard interactive authentication.
176Only methods that are next in one or more lists are offered at each stage,
177so for this example, it would not be possible to attempt password or
178keyboard-interactive authentication before public key.
179.Pp
180For keyboard interactive authentication it is also possible to
181restrict authentication to a specific device by appending a
182colon followed by the device identifier
183.Dq bsdauth ,
184.Dq pam ,
185or
186.Dq skey ,
187depending on the server configuration.
188For example,
189.Dq keyboard-interactive:bsdauth
190would restrict keyboard interactive authentication to the
191.Dq bsdauth
192device.
193.Pp
194This option is only available for SSH protocol 2 and will yield a fatal
195error if enabled if protocol 1 is also enabled.
196Note that each authentication method listed should also be explicitly enabled
197in the configuration.
198The default is not to require multiple authentication; successful completion
199of a single authentication method is sufficient.
200.It Cm AuthorizedKeysCommand
201Specifies a program to be used to look up the user's public keys.
202The program must be owned by root and not writable by group or others.
203It will be invoked with a single argument of the username
204being authenticated, and should produce on standard output zero or
205more lines of authorized_keys output (see AUTHORIZED_KEYS in
206.Xr sshd 8 ) .
207If a key supplied by AuthorizedKeysCommand does not successfully authenticate
208and authorize the user then public key authentication continues using the usual
209.Cm AuthorizedKeysFile
210files.
211By default, no AuthorizedKeysCommand is run.
212.It Cm AuthorizedKeysCommandUser
213Specifies the user under whose account the AuthorizedKeysCommand is run.
214It is recommended to use a dedicated user that has no other role on the host
215than running authorized keys commands.
216.It Cm AuthorizedKeysFile
217Specifies the file that contains the public keys that can be used
218for user authentication.
219The format is described in the
220AUTHORIZED_KEYS FILE FORMAT
221section of
222.Xr sshd 8 .
223.Cm AuthorizedKeysFile
224may contain tokens of the form %T which are substituted during connection
225setup.
226The following tokens are defined: %% is replaced by a literal '%',
227%h is replaced by the home directory of the user being authenticated, and
228%u is replaced by the username of that user.
229After expansion,
230.Cm AuthorizedKeysFile
231is taken to be an absolute path or one relative to the user's home
232directory.
233Multiple files may be listed, separated by whitespace.
234The default is
235.Dq .ssh/authorized_keys .ssh/authorized_keys2 .
236.It Cm AuthorizedPrincipalsFile
237Specifies a file that lists principal names that are accepted for
238certificate authentication.
239When using certificates signed by a key listed in
240.Cm TrustedUserCAKeys ,
241this file lists names, one of which must appear in the certificate for it
242to be accepted for authentication.
243Names are listed one per line preceded by key options (as described
244in AUTHORIZED_KEYS FILE FORMAT in
245.Xr sshd 8 ) .
246Empty lines and comments starting with
247.Ql #
248are ignored.
249.Pp
250.Cm AuthorizedPrincipalsFile
251may contain tokens of the form %T which are substituted during connection
252setup.
253The following tokens are defined: %% is replaced by a literal '%',
254%h is replaced by the home directory of the user being authenticated, and
255%u is replaced by the username of that user.
256After expansion,
257.Cm AuthorizedPrincipalsFile
258is taken to be an absolute path or one relative to the user's home
259directory.
260.Pp
261The default is
262.Dq none ,
263i.e. not to use a principals file \(en in this case, the username
264of the user must appear in a certificate's principals list for it to be
265accepted.
266Note that
267.Cm AuthorizedPrincipalsFile
268is only used when authentication proceeds using a CA listed in
269.Cm TrustedUserCAKeys
270and is not consulted for certification authorities trusted via
271.Pa ~/.ssh/authorized_keys ,
272though the
273.Cm principals=
274key option offers a similar facility (see
275.Xr sshd 8
276for details).
277.It Cm Banner
278The contents of the specified file are sent to the remote user before
279authentication is allowed.
280If the argument is
281.Dq none
282then no banner is displayed.
283This option is only available for protocol version 2.
284By default, no banner is displayed.
285.It Cm ChallengeResponseAuthentication
286Specifies whether challenge-response authentication is allowed (e.g. via
287PAM or though authentication styles supported in
288.Xr login.conf 5 )
289The default is
290.Dq yes .
291.It Cm ChrootDirectory
292Specifies the pathname of a directory to
293.Xr chroot 2
294to after authentication.
295All components of the pathname must be root-owned directories that are
296not writable by any other user or group.
297After the chroot,
298.Xr sshd 8
299changes the working directory to the user's home directory.
300.Pp
301The pathname may contain the following tokens that are expanded at runtime once
302the connecting user has been authenticated: %% is replaced by a literal '%',
303%h is replaced by the home directory of the user being authenticated, and
304%u is replaced by the username of that user.
305.Pp
306The
307.Cm ChrootDirectory
308must contain the necessary files and directories to support the
309user's session.
310For an interactive session this requires at least a shell, typically
311.Xr sh 1 ,
312and basic
313.Pa /dev
314nodes such as
315.Xr null 4 ,
316.Xr zero 4 ,
317.Xr stdin 4 ,
318.Xr stdout 4 ,
319.Xr stderr 4 ,
320.Xr arandom 4
321and
322.Xr tty 4
323devices.
324For file transfer sessions using
325.Dq sftp ,
326no additional configuration of the environment is necessary if the
327in-process sftp server is used,
328though sessions which use logging do require
329.Pa /dev/log
330inside the chroot directory (see
331.Xr sftp-server 8
332for details).
333.Pp
334The default is not to
335.Xr chroot 2 .
336.It Cm Ciphers
337Specifies the ciphers allowed for protocol version 2.
338Multiple ciphers must be comma-separated.
339The supported ciphers are:
340.Pp
341.Dq 3des-cbc ,
342.Dq aes128-cbc ,
343.Dq aes192-cbc ,
344.Dq aes256-cbc ,
345.Dq aes128-ctr ,
346.Dq aes192-ctr ,
347.Dq aes256-ctr ,
348.Dq aes128-gcm@openssh.com ,
349.Dq aes256-gcm@openssh.com ,
350.Dq arcfour128 ,
351.Dq arcfour256 ,
352.Dq arcfour ,
353.Dq blowfish-cbc ,
354.Dq cast128-cbc ,
355and
356.Dq chacha20-poly1305@openssh.com .
357.Pp
358The default is:
359.Bd -literal -offset 3n
360aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
361aes128-gcm@openssh.com,aes256-gcm@openssh.com,
362chacha20-poly1305@openssh.com,
363aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
364aes256-cbc,arcfour
365.Ed
366.Pp
367The list of available ciphers may also be obtained using the
368.Fl Q
369option of
370.Xr ssh 1 .
371.It Cm ClientAliveCountMax
372Sets the number of client alive messages (see below) which may be
373sent without
374.Xr sshd 8
375receiving any messages back from the client.
376If this threshold is reached while client alive messages are being sent,
377sshd will disconnect the client, terminating the session.
378It is important to note that the use of client alive messages is very
379different from
380.Cm TCPKeepAlive
381(below).
382The client alive messages are sent through the encrypted channel
383and therefore will not be spoofable.
384The TCP keepalive option enabled by
385.Cm TCPKeepAlive
386is spoofable.
387The client alive mechanism is valuable when the client or
388server depend on knowing when a connection has become inactive.
389.Pp
390The default value is 3.
391If
392.Cm ClientAliveInterval
393(see below) is set to 15, and
394.Cm ClientAliveCountMax
395is left at the default, unresponsive SSH clients
396will be disconnected after approximately 45 seconds.
397This option applies to protocol version 2 only.
398.It Cm ClientAliveInterval
399Sets a timeout interval in seconds after which if no data has been received
400from the client,
401.Xr sshd 8
402will send a message through the encrypted
403channel to request a response from the client.
404The default
405is 0, indicating that these messages will not be sent to the client.
406This option applies to protocol version 2 only.
407.It Cm Compression
408Specifies whether compression is allowed, or delayed until
409the user has authenticated successfully.
410The argument must be
411.Dq yes ,
412.Dq delayed ,
413or
414.Dq no .
415The default is
416.Dq delayed .
417.It Cm DenyGroups
418This keyword can be followed by a list of group name patterns, separated
419by spaces.
420Login is disallowed for users whose primary group or supplementary
421group list matches one of the patterns.
422Only group names are valid; a numerical group ID is not recognized.
423By default, login is allowed for all groups.
424The allow/deny directives are processed in the following order:
425.Cm DenyUsers ,
426.Cm AllowUsers ,
427.Cm DenyGroups ,
428and finally
429.Cm AllowGroups .
430.Pp
431See PATTERNS in
432.Xr ssh_config 5
433for more information on patterns.
434.It Cm DenyUsers
435This keyword can be followed by a list of user name patterns, separated
436by spaces.
437Login is disallowed for user names that match one of the patterns.
438Only user names are valid; a numerical user ID is not recognized.
439By default, login is allowed for all users.
440If the pattern takes the form USER@HOST then USER and HOST
441are separately checked, restricting logins to particular
442users from particular hosts.
443The allow/deny directives are processed in the following order:
444.Cm DenyUsers ,
445.Cm AllowUsers ,
446.Cm DenyGroups ,
447and finally
448.Cm AllowGroups .
449.Pp
450See PATTERNS in
451.Xr ssh_config 5
452for more information on patterns.
453.It Cm ForceCommand
454Forces the execution of the command specified by
455.Cm ForceCommand ,
456ignoring any command supplied by the client and
457.Pa ~/.ssh/rc
458if present.
459The command is invoked by using the user's login shell with the -c option.
460This applies to shell, command, or subsystem execution.
461It is most useful inside a
462.Cm Match
463block.
464The command originally supplied by the client is available in the
465.Ev SSH_ORIGINAL_COMMAND
466environment variable.
467Specifying a command of
468.Dq internal-sftp
469will force the use of an in-process sftp server that requires no support
470files when used with
471.Cm ChrootDirectory .
472.It Cm GatewayPorts
473Specifies whether remote hosts are allowed to connect to ports
474forwarded for the client.
475By default,
476.Xr sshd 8
477binds remote port forwardings to the loopback address.
478This prevents other remote hosts from connecting to forwarded ports.
479.Cm GatewayPorts
480can be used to specify that sshd
481should allow remote port forwardings to bind to non-loopback addresses, thus
482allowing other hosts to connect.
483The argument may be
484.Dq no
485to force remote port forwardings to be available to the local host only,
486.Dq yes
487to force remote port forwardings to bind to the wildcard address, or
488.Dq clientspecified
489to allow the client to select the address to which the forwarding is bound.
490The default is
491.Dq no .
492.It Cm GSSAPIAuthentication
493Specifies whether user authentication based on GSSAPI is allowed.
494The default is
495.Dq no .
496Note that this option applies to protocol version 2 only.
497.It Cm GSSAPICleanupCredentials
498Specifies whether to automatically destroy the user's credentials cache
499on logout.
500The default is
501.Dq yes .
502Note that this option applies to protocol version 2 only.
503.It Cm HostbasedAuthentication
504Specifies whether rhosts or /etc/hosts.equiv authentication together
505with successful public key client host authentication is allowed
506(host-based authentication).
507This option is similar to
508.Cm RhostsRSAAuthentication
509and applies to protocol version 2 only.
510The default is
511.Dq no .
512.It Cm HostbasedUsesNameFromPacketOnly
513Specifies whether or not the server will attempt to perform a reverse
514name lookup when matching the name in the
515.Pa ~/.shosts ,
516.Pa ~/.rhosts ,
517and
518.Pa /etc/hosts.equiv
519files during
520.Cm HostbasedAuthentication .
521A setting of
522.Dq yes
523means that
524.Xr sshd 8
525uses the name supplied by the client rather than
526attempting to resolve the name from the TCP connection itself.
527The default is
528.Dq no .
529.It Cm HostCertificate
530Specifies a file containing a public host certificate.
531The certificate's public key must match a private host key already specified
532by
533.Cm HostKey .
534The default behaviour of
535.Xr sshd 8
536is not to load any certificates.
537.It Cm HostKey
538Specifies a file containing a private host key
539used by SSH.
540The default is
541.Pa /etc/ssh/ssh_host_key
542for protocol version 1, and
543.Pa /etc/ssh/ssh_host_dsa_key ,
544.Pa /etc/ssh/ssh_host_ecdsa_key ,
545.Pa /etc/ssh/ssh_host_ed25519_key
546and
547.Pa /etc/ssh/ssh_host_rsa_key
548for protocol version 2.
549Note that
550.Xr sshd 8
551will refuse to use a file if it is group/world-accessible.
552It is possible to have multiple host key files.
553.Dq rsa1
554keys are used for version 1 and
555.Dq dsa ,
556.Dq ecdsa ,
557.Dq ed25519
558or
559.Dq rsa
560are used for version 2 of the SSH protocol.
561It is also possible to specify public host key files instead.
562In this case operations on the private key will be delegated
563to an
564.Xr ssh-agent 1 .
565.It Cm HostKeyAgent
566Identifies the UNIX-domain socket used to communicate
567with an agent that has access to the private host keys.
568If
569.Dq SSH_AUTH_SOCK
570is specified, the location of the socket will be read from the
571.Ev SSH_AUTH_SOCK
572environment variable.
573.It Cm IgnoreRhosts
574Specifies that
575.Pa .rhosts
576and
577.Pa .shosts
578files will not be used in
579.Cm RhostsRSAAuthentication
580or
581.Cm HostbasedAuthentication .
582.Pp
583.Pa /etc/hosts.equiv
584and
585.Pa /etc/ssh/shosts.equiv
586are still used.
587The default is
588.Dq yes .
589.It Cm IgnoreUserKnownHosts
590Specifies whether
591.Xr sshd 8
592should ignore the user's
593.Pa ~/.ssh/known_hosts
594during
595.Cm RhostsRSAAuthentication
596or
597.Cm HostbasedAuthentication .
598The default is
599.Dq no .
600.It Cm IPQoS
601Specifies the IPv4 type-of-service or DSCP class for the connection.
602Accepted values are
603.Dq af11 ,
604.Dq af12 ,
605.Dq af13 ,
606.Dq af21 ,
607.Dq af22 ,
608.Dq af23 ,
609.Dq af31 ,
610.Dq af32 ,
611.Dq af33 ,
612.Dq af41 ,
613.Dq af42 ,
614.Dq af43 ,
615.Dq cs0 ,
616.Dq cs1 ,
617.Dq cs2 ,
618.Dq cs3 ,
619.Dq cs4 ,
620.Dq cs5 ,
621.Dq cs6 ,
622.Dq cs7 ,
623.Dq ef ,
624.Dq lowdelay ,
625.Dq throughput ,
626.Dq reliability ,
627or a numeric value.
628This option may take one or two arguments, separated by whitespace.
629If one argument is specified, it is used as the packet class unconditionally.
630If two values are specified, the first is automatically selected for
631interactive sessions and the second for non-interactive sessions.
632The default is
633.Dq lowdelay
634for interactive sessions and
635.Dq throughput
636for non-interactive sessions.
637.It Cm KerberosAuthentication
638Specifies whether the password provided by the user for
639.Cm PasswordAuthentication
640will be validated through the Kerberos KDC.
641To use this option, the server needs a
642Kerberos servtab which allows the verification of the KDC's identity.
643The default is
644.Dq no .
645.It Cm KerberosGetAFSToken
646If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
647an AFS token before accessing the user's home directory.
648The default is
649.Dq no .
650.It Cm KerberosOrLocalPasswd
651If password authentication through Kerberos fails then
652the password will be validated via any additional local mechanism
653such as
654.Pa /etc/passwd .
655The default is
656.Dq yes .
657.It Cm KerberosTicketCleanup
658Specifies whether to automatically destroy the user's ticket cache
659file on logout.
660The default is
661.Dq yes .
662.It Cm KexAlgorithms
663Specifies the available KEX (Key Exchange) algorithms.
664Multiple algorithms must be comma-separated.
665The default is
666.Bd -literal -offset indent
667curve25519-sha256@libssh.org,
668ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
669diffie-hellman-group-exchange-sha256,
670diffie-hellman-group-exchange-sha1,
671diffie-hellman-group14-sha1,
672diffie-hellman-group1-sha1
673.Ed
674.It Cm KeyRegenerationInterval
675In protocol version 1, the ephemeral server key is automatically regenerated
676after this many seconds (if it has been used).
677The purpose of regeneration is to prevent
678decrypting captured sessions by later breaking into the machine and
679stealing the keys.
680The key is never stored anywhere.
681If the value is 0, the key is never regenerated.
682The default is 3600 (seconds).
683.It Cm ListenAddress
684Specifies the local addresses
685.Xr sshd 8
686should listen on.
687The following forms may be used:
688.Pp
689.Bl -item -offset indent -compact
690.It
691.Cm ListenAddress
692.Sm off
693.Ar host No | Ar IPv4_addr No | Ar IPv6_addr
694.Sm on
695.It
696.Cm ListenAddress
697.Sm off
698.Ar host No | Ar IPv4_addr No : Ar port
699.Sm on
700.It
701.Cm ListenAddress
702.Sm off
703.Oo
704.Ar host No | Ar IPv6_addr Oc : Ar port
705.Sm on
706.El
707.Pp
708If
709.Ar port
710is not specified,
711sshd will listen on the address and all prior
712.Cm Port
713options specified.
714The default is to listen on all local addresses.
715Multiple
716.Cm ListenAddress
717options are permitted.
718Additionally, any
719.Cm Port
720options must precede this option for non-port qualified addresses.
721.It Cm LoginGraceTime
722The server disconnects after this time if the user has not
723successfully logged in.
724If the value is 0, there is no time limit.
725The default is 120 seconds.
726.It Cm LogLevel
727Gives the verbosity level that is used when logging messages from
728.Xr sshd 8 .
729The possible values are:
730QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
731The default is INFO.
732DEBUG and DEBUG1 are equivalent.
733DEBUG2 and DEBUG3 each specify higher levels of debugging output.
734Logging with a DEBUG level violates the privacy of users and is not recommended.
735.It Cm MACs
736Specifies the available MAC (message authentication code) algorithms.
737The MAC algorithm is used in protocol version 2
738for data integrity protection.
739Multiple algorithms must be comma-separated.
740The algorithms that contain
741.Dq -etm
742calculate the MAC after encryption (encrypt-then-mac).
743These are considered safer and their use recommended.
744The default is:
745.Bd -literal -offset indent
746hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,
747umac-64-etm@openssh.com,umac-128-etm@openssh.com,
748hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
749hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,
750hmac-md5-96-etm@openssh.com,
751hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,
752hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,
753hmac-sha1-96,hmac-md5-96
754.Ed
755.It Cm Match
756Introduces a conditional block.
757If all of the criteria on the
758.Cm Match
759line are satisfied, the keywords on the following lines override those
760set in the global section of the config file, until either another
761.Cm Match
762line or the end of the file.
763.Pp
764The arguments to
765.Cm Match
766are one or more criteria-pattern pairs or the single token
767.Cm All
768which matches all criteria.
769The available criteria are
770.Cm User ,
771.Cm Group ,
772.Cm Host ,
773.Cm LocalAddress ,
774.Cm LocalPort ,
775and
776.Cm Address .
777The match patterns may consist of single entries or comma-separated
778lists and may use the wildcard and negation operators described in the
779PATTERNS section of
780.Xr ssh_config 5 .
781.Pp
782The patterns in an
783.Cm Address
784criteria may additionally contain addresses to match in CIDR
785address/masklen format, e.g.\&
786.Dq 192.0.2.0/24
787or
788.Dq 3ffe:ffff::/32 .
789Note that the mask length provided must be consistent with the address -
790it is an error to specify a mask length that is too long for the address
791or one with bits set in this host portion of the address.
792For example,
793.Dq 192.0.2.0/33
794and
795.Dq 192.0.2.0/8
796respectively.
797.Pp
798Only a subset of keywords may be used on the lines following a
799.Cm Match
800keyword.
801Available keywords are
802.Cm AcceptEnv ,
803.Cm AllowAgentForwarding ,
804.Cm AllowGroups ,
805.Cm AllowTcpForwarding ,
806.Cm AllowUsers ,
807.Cm AuthenticationMethods ,
808.Cm AuthorizedKeysCommand ,
809.Cm AuthorizedKeysCommandUser ,
810.Cm AuthorizedKeysFile ,
811.Cm AuthorizedPrincipalsFile ,
812.Cm Banner ,
813.Cm ChrootDirectory ,
814.Cm DenyGroups ,
815.Cm DenyUsers ,
816.Cm ForceCommand ,
817.Cm GatewayPorts ,
818.Cm GSSAPIAuthentication ,
819.Cm HostbasedAuthentication ,
820.Cm HostbasedUsesNameFromPacketOnly ,
821.Cm KbdInteractiveAuthentication ,
822.Cm KerberosAuthentication ,
823.Cm MaxAuthTries ,
824.Cm MaxSessions ,
825.Cm PasswordAuthentication ,
826.Cm PermitEmptyPasswords ,
827.Cm PermitOpen ,
828.Cm PermitRootLogin ,
829.Cm PermitTTY ,
830.Cm PermitTunnel ,
831.Cm PubkeyAuthentication ,
832.Cm RekeyLimit ,
833.Cm RhostsRSAAuthentication ,
834.Cm RSAAuthentication ,
835.Cm X11DisplayOffset ,
836.Cm X11Forwarding
837and
838.Cm X11UseLocalHost .
839.It Cm MaxAuthTries
840Specifies the maximum number of authentication attempts permitted per
841connection.
842Once the number of failures reaches half this value,
843additional failures are logged.
844The default is 6.
845.It Cm MaxSessions
846Specifies the maximum number of open sessions permitted per network connection.
847The default is 10.
848.It Cm MaxStartups
849Specifies the maximum number of concurrent unauthenticated connections to the
850SSH daemon.
851Additional connections will be dropped until authentication succeeds or the
852.Cm LoginGraceTime
853expires for a connection.
854The default is 10:30:100.
855.Pp
856Alternatively, random early drop can be enabled by specifying
857the three colon separated values
858.Dq start:rate:full
859(e.g. "10:30:60").
860.Xr sshd 8
861will refuse connection attempts with a probability of
862.Dq rate/100
863(30%)
864if there are currently
865.Dq start
866(10)
867unauthenticated connections.
868The probability increases linearly and all connection attempts
869are refused if the number of unauthenticated connections reaches
870.Dq full
871(60).
872.It Cm PasswordAuthentication
873Specifies whether password authentication is allowed.
874See also
875.Cm UsePAM .
876The default is
877.Dq no .
878.It Cm PermitEmptyPasswords
879When password authentication is allowed, it specifies whether the
880server allows login to accounts with empty password strings.
881The default is
882.Dq no .
883.It Cm PermitOpen
884Specifies the destinations to which TCP port forwarding is permitted.
885The forwarding specification must be one of the following forms:
886.Pp
887.Bl -item -offset indent -compact
888.It
889.Cm PermitOpen
890.Sm off
891.Ar host : port
892.Sm on
893.It
894.Cm PermitOpen
895.Sm off
896.Ar IPv4_addr : port
897.Sm on
898.It
899.Cm PermitOpen
900.Sm off
901.Ar \&[ IPv6_addr \&] : port
902.Sm on
903.El
904.Pp
905Multiple forwards may be specified by separating them with whitespace.
906An argument of
907.Dq any
908can be used to remove all restrictions and permit any forwarding requests.
909An argument of
910.Dq none
911can be used to prohibit all forwarding requests.
912By default all port forwarding requests are permitted.
913.It Cm PermitRootLogin
914Specifies whether root can log in using
915.Xr ssh 1 .
916The argument must be
917.Dq yes ,
918.Dq without-password ,
919.Dq forced-commands-only ,
920or
921.Dq no .
922The default is
923.Dq no .
924Note that if
925.Cm ChallengeResponseAuthentication
926is
927.Dq yes ,
928the root user may be allowed in with its password even if
929.Cm PermitRootLogin is set to
930.Dq without-password .
931.Pp
932If this option is set to
933.Dq without-password ,
934password authentication is disabled for root.
935.Pp
936If this option is set to
937.Dq forced-commands-only ,
938root login with public key authentication will be allowed,
939but only if the
940.Ar command
941option has been specified
942(which may be useful for taking remote backups even if root login is
943normally not allowed).
944All other authentication methods are disabled for root.
945.Pp
946If this option is set to
947.Dq no ,
948root is not allowed to log in.
949.It Cm PermitTunnel
950Specifies whether
951.Xr tun 4
952device forwarding is allowed.
953The argument must be
954.Dq yes ,
955.Dq point-to-point
956(layer 3),
957.Dq ethernet
958(layer 2), or
959.Dq no .
960Specifying
961.Dq yes
962permits both
963.Dq point-to-point
964and
965.Dq ethernet .
966The default is
967.Dq no .
968.It Cm PermitTTY
969Specifies whether
970.Xr pty 4
971allocation is permitted.
972The default is
973.Dq yes .
974.It Cm PermitUserEnvironment
975Specifies whether
976.Pa ~/.ssh/environment
977and
978.Cm environment=
979options in
980.Pa ~/.ssh/authorized_keys
981are processed by
982.Xr sshd 8 .
983The default is
984.Dq no .
985Enabling environment processing may enable users to bypass access
986restrictions in some configurations using mechanisms such as
987.Ev LD_PRELOAD .
988.It Cm PidFile
989Specifies the file that contains the process ID of the
990SSH daemon.
991The default is
992.Pa /var/run/sshd.pid .
993.It Cm Port
994Specifies the port number that
995.Xr sshd 8
996listens on.
997The default is 22.
998Multiple options of this type are permitted.
999See also
1000.Cm ListenAddress .
1001.It Cm PrintLastLog
1002Specifies whether
1003.Xr sshd 8
1004should print the date and time of the last user login when a user logs
1005in interactively.
1006The default is
1007.Dq yes .
1008.It Cm PrintMotd
1009Specifies whether
1010.Xr sshd 8
1011should print
1012.Pa /etc/motd
1013when a user logs in interactively.
1014(On some systems it is also printed by the shell,
1015.Pa /etc/profile ,
1016or equivalent.)
1017The default is
1018.Dq yes .
1019.It Cm Protocol
1020Specifies the protocol versions
1021.Xr sshd 8
1022supports.
1023The possible values are
1024.Sq 1
1025and
1026.Sq 2 .
1027Multiple versions must be comma-separated.
1028The default is
1029.Sq 2 .
1030Note that the order of the protocol list does not indicate preference,
1031because the client selects among multiple protocol versions offered
1032by the server.
1033Specifying
1034.Dq 2,1
1035is identical to
1036.Dq 1,2 .
1037.It Cm PubkeyAuthentication
1038Specifies whether public key authentication is allowed.
1039The default is
1040.Dq yes .
1041Note that this option applies to protocol version 2 only.
1042.It Cm RekeyLimit
1043Specifies the maximum amount of data that may be transmitted before the
1044session key is renegotiated, optionally followed a maximum amount of
1045time that may pass before the session key is renegotiated.
1046The first argument is specified in bytes and may have a suffix of
1047.Sq K ,
1048.Sq M ,
1049or
1050.Sq G
1051to indicate Kilobytes, Megabytes, or Gigabytes, respectively.
1052The default is between
1053.Sq 1G
1054and
1055.Sq 4G ,
1056depending on the cipher.
1057The optional second value is specified in seconds and may use any of the
1058units documented in the
1059.Sx TIME FORMATS
1060section.
1061The default value for
1062.Cm RekeyLimit
1063is
1064.Dq default none ,
1065which means that rekeying is performed after the cipher's default amount
1066of data has been sent or received and no time based rekeying is done.
1067This option applies to protocol version 2 only.
1068.It Cm RevokedKeys
1069Specifies revoked public keys.
1070Keys listed in this file will be refused for public key authentication.
1071Note that if this file is not readable, then public key authentication will
1072be refused for all users.
1073Keys may be specified as a text file, listing one public key per line, or as
1074an OpenSSH Key Revocation List (KRL) as generated by
1075.Xr ssh-keygen 1 .
1076For more information on KRLs, see the KEY REVOCATION LISTS section in
1077.Xr ssh-keygen 1 .
1078.It Cm RhostsRSAAuthentication
1079Specifies whether rhosts or
1080.Pa /etc/hosts.equiv
1081authentication together
1082with successful RSA host authentication is allowed.
1083The default is
1084.Dq no .
1085This option applies to protocol version 1 only.
1086.It Cm RSAAuthentication
1087Specifies whether pure RSA authentication is allowed.
1088The default is
1089.Dq yes .
1090This option applies to protocol version 1 only.
1091.It Cm ServerKeyBits
1092Defines the number of bits in the ephemeral protocol version 1 server key.
1093The minimum value is 512, and the default is 1024.
1094.It Cm StrictModes
1095Specifies whether
1096.Xr sshd 8
1097should check file modes and ownership of the
1098user's files and home directory before accepting login.
1099This is normally desirable because novices sometimes accidentally leave their
1100directory or files world-writable.
1101The default is
1102.Dq yes .
1103Note that this does not apply to
1104.Cm ChrootDirectory ,
1105whose permissions and ownership are checked unconditionally.
1106.It Cm Subsystem
1107Configures an external subsystem (e.g. file transfer daemon).
1108Arguments should be a subsystem name and a command (with optional arguments)
1109to execute upon subsystem request.
1110.Pp
1111The command
1112.Xr sftp-server 8
1113implements the
1114.Dq sftp
1115file transfer subsystem.
1116.Pp
1117Alternately the name
1118.Dq internal-sftp
1119implements an in-process
1120.Dq sftp
1121server.
1122This may simplify configurations using
1123.Cm ChrootDirectory
1124to force a different filesystem root on clients.
1125.Pp
1126By default no subsystems are defined.
1127Note that this option applies to protocol version 2 only.
1128.It Cm SyslogFacility
1129Gives the facility code that is used when logging messages from
1130.Xr sshd 8 .
1131The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1132LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1133The default is AUTH.
1134.It Cm TCPKeepAlive
1135Specifies whether the system should send TCP keepalive messages to the
1136other side.
1137If they are sent, death of the connection or crash of one
1138of the machines will be properly noticed.
1139However, this means that
1140connections will die if the route is down temporarily, and some people
1141find it annoying.
1142On the other hand, if TCP keepalives are not sent,
1143sessions may hang indefinitely on the server, leaving
1144.Dq ghost
1145users and consuming server resources.
1146.Pp
1147The default is
1148.Dq yes
1149(to send TCP keepalive messages), and the server will notice
1150if the network goes down or the client host crashes.
1151This avoids infinitely hanging sessions.
1152.Pp
1153To disable TCP keepalive messages, the value should be set to
1154.Dq no .
1155.It Cm TrustedUserCAKeys
1156Specifies a file containing public keys of certificate authorities that are
1157trusted to sign user certificates for authentication.
1158Keys are listed one per line; empty lines and comments starting with
1159.Ql #
1160are allowed.
1161If a certificate is presented for authentication and has its signing CA key
1162listed in this file, then it may be used for authentication for any user
1163listed in the certificate's principals list.
1164Note that certificates that lack a list of principals will not be permitted
1165for authentication using
1166.Cm TrustedUserCAKeys .
1167For more details on certificates, see the CERTIFICATES section in
1168.Xr ssh-keygen 1 .
1169.It Cm UseDNS
1170Specifies whether
1171.Xr sshd 8
1172should look up the remote host name and check that
1173the resolved host name for the remote IP address maps back to the
1174very same IP address.
1175The default is
1176.Dq yes .
1177.It Cm UseLogin
1178Specifies whether
1179.Xr login 1
1180is used for interactive login sessions.
1181The default is
1182.Dq no .
1183Note that
1184.Xr login 1
1185is never used for remote command execution.
1186Note also, that if this is enabled,
1187.Cm X11Forwarding
1188will be disabled because
1189.Xr login 1
1190does not know how to handle
1191.Xr xauth 1
1192cookies.
1193If
1194.Cm UsePrivilegeSeparation
1195is specified, it will be disabled after authentication.
1196.It Cm UsePAM
1197Enables the Pluggable Authentication Module interface.
1198If set to
1199.Dq yes
1200this will enable PAM authentication using
1201.Cm ChallengeResponseAuthentication
1202and
1203.Cm PasswordAuthentication
1204in addition to PAM account and session module processing for all
1205authentication types.
1206.Pp
1207Because PAM challenge-response authentication usually serves an equivalent
1208role to password authentication, you should disable either
1209.Cm PasswordAuthentication
1210or
1211.Cm ChallengeResponseAuthentication.
1212.Pp
1213If
1214.Cm UsePAM
1215is enabled, you will not be able to run
1216.Xr sshd 8
1217as a non-root user.
1218The default is
1219.Dq yes .
1220.It Cm UsePrivilegeSeparation
1221Specifies whether
1222.Xr sshd 8
1223separates privileges by creating an unprivileged child process
1224to deal with incoming network traffic.
1225After successful authentication, another process will be created that has
1226the privilege of the authenticated user.
1227The goal of privilege separation is to prevent privilege
1228escalation by containing any corruption within the unprivileged processes.
1229The default is
1230.Dq sandbox .
1231If
1232.Cm UsePrivilegeSeparation
1233is set to
1234.Dq sandbox
1235then the pre-authentication unprivileged process is subject to additional
1236restrictions.
1237.It Cm VersionAddendum
1238Optionally specifies additional text to append to the SSH protocol banner
1239sent by the server upon connection.
1240The default is
1241.Dq FreeBSD-20140130 .
1242.It Cm X11DisplayOffset
1243Specifies the first display number available for
1244.Xr sshd 8 Ns 's
1245X11 forwarding.
1246This prevents sshd from interfering with real X11 servers.
1247The default is 10.
1248.It Cm X11Forwarding
1249Specifies whether X11 forwarding is permitted.
1250The argument must be
1251.Dq yes
1252or
1253.Dq no .
1254The default is
1255.Dq yes .
1256.Pp
1257When X11 forwarding is enabled, there may be additional exposure to
1258the server and to client displays if the
1259.Xr sshd 8
1260proxy display is configured to listen on the wildcard address (see
1261.Cm X11UseLocalhost
1262below), though this is not the default.
1263Additionally, the authentication spoofing and authentication data
1264verification and substitution occur on the client side.
1265The security risk of using X11 forwarding is that the client's X11
1266display server may be exposed to attack when the SSH client requests
1267forwarding (see the warnings for
1268.Cm ForwardX11
1269in
1270.Xr ssh_config 5 ) .
1271A system administrator may have a stance in which they want to
1272protect clients that may expose themselves to attack by unwittingly
1273requesting X11 forwarding, which can warrant a
1274.Dq no
1275setting.
1276.Pp
1277Note that disabling X11 forwarding does not prevent users from
1278forwarding X11 traffic, as users can always install their own forwarders.
1279X11 forwarding is automatically disabled if
1280.Cm UseLogin
1281is enabled.
1282.It Cm X11UseLocalhost
1283Specifies whether
1284.Xr sshd 8
1285should bind the X11 forwarding server to the loopback address or to
1286the wildcard address.
1287By default,
1288sshd binds the forwarding server to the loopback address and sets the
1289hostname part of the
1290.Ev DISPLAY
1291environment variable to
1292.Dq localhost .
1293This prevents remote hosts from connecting to the proxy display.
1294However, some older X11 clients may not function with this
1295configuration.
1296.Cm X11UseLocalhost
1297may be set to
1298.Dq no
1299to specify that the forwarding server should be bound to the wildcard
1300address.
1301The argument must be
1302.Dq yes
1303or
1304.Dq no .
1305The default is
1306.Dq yes .
1307.It Cm XAuthLocation
1308Specifies the full pathname of the
1309.Xr xauth 1
1310program.
1311The default is
1312.Pa /usr/local/bin/xauth .
1313.El
1314.Sh TIME FORMATS
1315.Xr sshd 8
1316command-line arguments and configuration file options that specify time
1317may be expressed using a sequence of the form:
1318.Sm off
1319.Ar time Op Ar qualifier ,
1320.Sm on
1321where
1322.Ar time
1323is a positive integer value and
1324.Ar qualifier
1325is one of the following:
1326.Pp
1327.Bl -tag -width Ds -compact -offset indent
1328.It Aq Cm none
1329seconds
1330.It Cm s | Cm S
1331seconds
1332.It Cm m | Cm M
1333minutes
1334.It Cm h | Cm H
1335hours
1336.It Cm d | Cm D
1337days
1338.It Cm w | Cm W
1339weeks
1340.El
1341.Pp
1342Each member of the sequence is added together to calculate
1343the total time value.
1344.Pp
1345Time format examples:
1346.Pp
1347.Bl -tag -width Ds -compact -offset indent
1348.It 600
1349600 seconds (10 minutes)
1350.It 10m
135110 minutes
1352.It 1h30m
13531 hour 30 minutes (90 minutes)
1354.El
1355.Sh FILES
1356.Bl -tag -width Ds
1357.It Pa /etc/ssh/sshd_config
1358Contains configuration data for
1359.Xr sshd 8 .
1360This file should be writable by root only, but it is recommended
1361(though not necessary) that it be world-readable.
1362.El
1363.Sh SEE ALSO
1364.Xr sshd 8
1365.Sh AUTHORS
1366OpenSSH is a derivative of the original and free
1367ssh 1.2.12 release by Tatu Ylonen.
1368Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1369Theo de Raadt and Dug Song
1370removed many bugs, re-added newer features and
1371created OpenSSH.
1372Markus Friedl contributed the support for SSH
1373protocol versions 1.5 and 2.0.
1374Niels Provos and Markus Friedl contributed support
1375for privilege separation.
1376