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