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