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