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