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