call gssapi_set_username() for keyex method too
[openssh.git] / 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 GSSAPIKeyExchange
427 Specifies whether key exchange based on GSSAPI is allowed. GSSAPI key exchange
428 doesn't rely on ssh keys to verify host identity.
429 The default is
430 .Dq no .
431 Note that this option applies to protocol version 2 only.
432 .It Cm GSSAPICleanupCredentials
433 Specifies whether to automatically destroy the user's credentials cache
434 on logout.
435 The default is
436 .Dq yes .
437 Note that this option applies to protocol version 2 only.
438 .It Cm GSSAPIStrictAcceptorCheck
439 Determines whether to be strict about the identity of the GSSAPI acceptor 
440 a client authenticates against. If
441 .Dq yes
442 then the client must authenticate against the
443 .Pa host
444 service on the current hostname. If 
445 .Dq no
446 then the client may authenticate against any service key stored in the 
447 machine's default store. This facility is provided to assist with operation 
448 on multi homed machines. 
449 The default is
450 .Dq yes .
451 Note that this option applies only to protocol version 2 GSSAPI connections,
452 and setting it to 
453 .Dq no
454 may only work with recent Kerberos GSSAPI libraries.
455 .It Cm GSSAPIStoreCredentialsOnRekey
456 Controls whether the user's GSSAPI credentials should be updated following a 
457 successful connection rekeying. This option can be used to accepted renewed 
458 or updated credentials from a compatible client. The default is
459 .Dq no .
460 .It Cm HostbasedAuthentication
461 Specifies whether rhosts or /etc/hosts.equiv authentication together
462 with successful public key client host authentication is allowed
463 (host-based authentication).
464 This option is similar to
465 .Cm RhostsRSAAuthentication
466 and applies to protocol version 2 only.
467 The default is
468 .Dq no .
469 .It Cm HostbasedUsesNameFromPacketOnly
470 Specifies whether or not the server will attempt to perform a reverse
471 name lookup when matching the name in the
472 .Pa ~/.shosts ,
473 .Pa ~/.rhosts ,
474 and
475 .Pa /etc/hosts.equiv
476 files during
477 .Cm HostbasedAuthentication .
478 A setting of
479 .Dq yes
480 means that
481 .Xr sshd 8
482 uses the name supplied by the client rather than
483 attempting to resolve the name from the TCP connection itself.
484 The default is
485 .Dq no .
486 .It Cm HostCertificate
487 Specifies a file containing a public host certificate.
488 The certificate's public key must match a private host key already specified
489 by
490 .Cm HostKey .
491 The default behaviour of
492 .Xr sshd 8
493 is not to load any certificates.
494 .It Cm HostKey
495 Specifies a file containing a private host key
496 used by SSH.
497 The default is
498 .Pa /etc/ssh/ssh_host_key
499 for protocol version 1, and
500 .Pa /etc/ssh/ssh_host_dsa_key ,
501 .Pa /etc/ssh/ssh_host_ecdsa_key
502 and
503 .Pa /etc/ssh/ssh_host_rsa_key
504 for protocol version 2.
505 Note that
506 .Xr sshd 8
507 will refuse to use a file if it is group/world-accessible.
508 It is possible to have multiple host key files.
509 .Dq rsa1
510 keys are used for version 1 and
511 .Dq dsa ,
512 .Dq ecdsa
513 or
514 .Dq rsa
515 are used for version 2 of the SSH protocol.
516 .It Cm IgnoreRhosts
517 Specifies that
518 .Pa .rhosts
519 and
520 .Pa .shosts
521 files will not be used in
522 .Cm RhostsRSAAuthentication
523 or
524 .Cm HostbasedAuthentication .
525 .Pp
526 .Pa /etc/hosts.equiv
527 and
528 .Pa /etc/shosts.equiv
529 are still used.
530 The default is
531 .Dq yes .
532 .It Cm IgnoreUserKnownHosts
533 Specifies whether
534 .Xr sshd 8
535 should ignore the user's
536 .Pa ~/.ssh/known_hosts
537 during
538 .Cm RhostsRSAAuthentication
539 or
540 .Cm HostbasedAuthentication .
541 The default is
542 .Dq no .
543 .It Cm IPQoS
544 Specifies the IPv4 type-of-service or DSCP class for the connection.
545 Accepted values are
546 .Dq af11 ,
547 .Dq af12 ,
548 .Dq af13 ,
549 .Dq af14 ,
550 .Dq af22 ,
551 .Dq af23 ,
552 .Dq af31 ,
553 .Dq af32 ,
554 .Dq af33 ,
555 .Dq af41 ,
556 .Dq af42 ,
557 .Dq af43 ,
558 .Dq cs0 ,
559 .Dq cs1 ,
560 .Dq cs2 ,
561 .Dq cs3 ,
562 .Dq cs4 ,
563 .Dq cs5 ,
564 .Dq cs6 ,
565 .Dq cs7 ,
566 .Dq ef ,
567 .Dq lowdelay ,
568 .Dq throughput ,
569 .Dq reliability ,
570 or a numeric value.
571 This option may take one or two arguments, separated by whitespace.
572 If one argument is specified, it is used as the packet class unconditionally.
573 If two values are specified, the first is automatically selected for
574 interactive sessions and the second for non-interactive sessions.
575 The default is
576 .Dq lowdelay
577 for interactive sessions and
578 .Dq throughput
579 for non-interactive sessions.
580 .It Cm KerberosAuthentication
581 Specifies whether the password provided by the user for
582 .Cm PasswordAuthentication
583 will be validated through the Kerberos KDC.
584 To use this option, the server needs a
585 Kerberos servtab which allows the verification of the KDC's identity.
586 The default is
587 .Dq no .
588 .It Cm KerberosGetAFSToken
589 If AFS is active and the user has a Kerberos 5 TGT, attempt to acquire
590 an AFS token before accessing the user's home directory.
591 The default is
592 .Dq no .
593 .It Cm KerberosOrLocalPasswd
594 If password authentication through Kerberos fails then
595 the password will be validated via any additional local mechanism
596 such as
597 .Pa /etc/passwd .
598 The default is
599 .Dq yes .
600 .It Cm KerberosTicketCleanup
601 Specifies whether to automatically destroy the user's ticket cache
602 file on logout.
603 The default is
604 .Dq yes .
605 .It Cm KexAlgorithms
606 Specifies the available KEX (Key Exchange) algorithms.
607 Multiple algorithms must be comma-separated.
608 The default is
609 .Dq ecdh-sha2-nistp256 ,
610 .Dq ecdh-sha2-nistp384 ,
611 .Dq ecdh-sha2-nistp521 ,
612 .Dq diffie-hellman-group-exchange-sha256 ,
613 .Dq diffie-hellman-group-exchange-sha1 ,
614 .Dq diffie-hellman-group14-sha1 ,
615 .Dq diffie-hellman-group1-sha1 .
616 .It Cm KeyRegenerationInterval
617 In protocol version 1, the ephemeral server key is automatically regenerated
618 after this many seconds (if it has been used).
619 The purpose of regeneration is to prevent
620 decrypting captured sessions by later breaking into the machine and
621 stealing the keys.
622 The key is never stored anywhere.
623 If the value is 0, the key is never regenerated.
624 The default is 3600 (seconds).
625 .It Cm ListenAddress
626 Specifies the local addresses
627 .Xr sshd 8
628 should listen on.
629 The following forms may be used:
630 .Pp
631 .Bl -item -offset indent -compact
632 .It
633 .Cm ListenAddress
634 .Sm off
635 .Ar host No | Ar IPv4_addr No | Ar IPv6_addr
636 .Sm on
637 .It
638 .Cm ListenAddress
639 .Sm off
640 .Ar host No | Ar IPv4_addr No : Ar port
641 .Sm on
642 .It
643 .Cm ListenAddress
644 .Sm off
645 .Oo
646 .Ar host No | Ar IPv6_addr Oc : Ar port
647 .Sm on
648 .El
649 .Pp
650 If
651 .Ar port
652 is not specified,
653 sshd will listen on the address and all prior
654 .Cm Port
655 options specified.
656 The default is to listen on all local addresses.
657 Multiple
658 .Cm ListenAddress
659 options are permitted.
660 Additionally, any
661 .Cm Port
662 options must precede this option for non-port qualified addresses.
663 .It Cm LoginGraceTime
664 The server disconnects after this time if the user has not
665 successfully logged in.
666 If the value is 0, there is no time limit.
667 The default is 120 seconds.
668 .It Cm LogLevel
669 Gives the verbosity level that is used when logging messages from
670 .Xr sshd 8 .
671 The possible values are:
672 QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
673 The default is INFO.
674 DEBUG and DEBUG1 are equivalent.
675 DEBUG2 and DEBUG3 each specify higher levels of debugging output.
676 Logging with a DEBUG level violates the privacy of users and is not recommended.
677 .It Cm MACs
678 Specifies the available MAC (message authentication code) algorithms.
679 The MAC algorithm is used in protocol version 2
680 for data integrity protection.
681 Multiple algorithms must be comma-separated.
682 The default is:
683 .Bd -literal -offset indent
684 hmac-md5,hmac-sha1,umac-64@openssh.com,
685 hmac-ripemd160,hmac-sha1-96,hmac-md5-96
686 .Ed
687 .It Cm Match
688 Introduces a conditional block.
689 If all of the criteria on the
690 .Cm Match
691 line are satisfied, the keywords on the following lines override those
692 set in the global section of the config file, until either another
693 .Cm Match
694 line or the end of the file.
695 .Pp
696 The arguments to
697 .Cm Match
698 are one or more criteria-pattern pairs.
699 The available criteria are
700 .Cm User ,
701 .Cm Group ,
702 .Cm Host ,
703 and
704 .Cm Address .
705 The match patterns may consist of single entries or comma-separated
706 lists and may use the wildcard and negation operators described in the
707 .Sx PATTERNS
708 section of
709 .Xr ssh_config 5 .
710 .Pp
711 The patterns in an
712 .Cm Address
713 criteria may additionally contain addresses to match in CIDR
714 address/masklen format, e.g.\&
715 .Dq 192.0.2.0/24
716 or
717 .Dq 3ffe:ffff::/32 .
718 Note that the mask length provided must be consistent with the address -
719 it is an error to specify a mask length that is too long for the address
720 or one with bits set in this host portion of the address.
721 For example,
722 .Dq 192.0.2.0/33
723 and
724 .Dq 192.0.2.0/8
725 respectively.
726 .Pp
727 Only a subset of keywords may be used on the lines following a
728 .Cm Match
729 keyword.
730 Available keywords are
731 .Cm AllowAgentForwarding ,
732 .Cm AllowTcpForwarding ,
733 .Cm AuthorizedKeysFile ,
734 .Cm AuthorizedPrincipalsFile ,
735 .Cm Banner ,
736 .Cm ChrootDirectory ,
737 .Cm ForceCommand ,
738 .Cm GatewayPorts ,
739 .Cm GSSAPIAuthentication ,
740 .Cm HostbasedAuthentication ,
741 .Cm HostbasedUsesNameFromPacketOnly ,
742 .Cm KbdInteractiveAuthentication ,
743 .Cm KerberosAuthentication ,
744 .Cm MaxAuthTries ,
745 .Cm MaxSessions ,
746 .Cm PasswordAuthentication ,
747 .Cm PermitEmptyPasswords ,
748 .Cm PermitOpen ,
749 .Cm PermitRootLogin ,
750 .Cm PermitTunnel ,
751 .Cm PubkeyAuthentication ,
752 .Cm RhostsRSAAuthentication ,
753 .Cm RSAAuthentication ,
754 .Cm X11DisplayOffset ,
755 .Cm X11Forwarding
756 and
757 .Cm X11UseLocalHost .
758 .It Cm MaxAuthTries
759 Specifies the maximum number of authentication attempts permitted per
760 connection.
761 Once the number of failures reaches half this value,
762 additional failures are logged.
763 The default is 6.
764 .It Cm MaxSessions
765 Specifies the maximum number of open sessions permitted per network connection.
766 The default is 10.
767 .It Cm MaxStartups
768 Specifies the maximum number of concurrent unauthenticated connections to the
769 SSH daemon.
770 Additional connections will be dropped until authentication succeeds or the
771 .Cm LoginGraceTime
772 expires for a connection.
773 The default is 10.
774 .Pp
775 Alternatively, random early drop can be enabled by specifying
776 the three colon separated values
777 .Dq start:rate:full
778 (e.g. "10:30:60").
779 .Xr sshd 8
780 will refuse connection attempts with a probability of
781 .Dq rate/100
782 (30%)
783 if there are currently
784 .Dq start
785 (10)
786 unauthenticated connections.
787 The probability increases linearly and all connection attempts
788 are refused if the number of unauthenticated connections reaches
789 .Dq full
790 (60).
791 .It Cm PasswordAuthentication
792 Specifies whether password authentication is allowed.
793 The default is
794 .Dq yes .
795 .It Cm PermitEmptyPasswords
796 When password authentication is allowed, it specifies whether the
797 server allows login to accounts with empty password strings.
798 The default is
799 .Dq no .
800 .It Cm PermitOpen
801 Specifies the destinations to which TCP port forwarding is permitted.
802 The forwarding specification must be one of the following forms:
803 .Pp
804 .Bl -item -offset indent -compact
805 .It
806 .Cm PermitOpen
807 .Sm off
808 .Ar host : port
809 .Sm on
810 .It
811 .Cm PermitOpen
812 .Sm off
813 .Ar IPv4_addr : port
814 .Sm on
815 .It
816 .Cm PermitOpen
817 .Sm off
818 .Ar \&[ IPv6_addr \&] : port
819 .Sm on
820 .El
821 .Pp
822 Multiple forwards may be specified by separating them with whitespace.
823 An argument of
824 .Dq any
825 can be used to remove all restrictions and permit any forwarding requests.
826 By default all port forwarding requests are permitted.
827 .It Cm PermitRootLogin
828 Specifies whether root can log in using
829 .Xr ssh 1 .
830 The argument must be
831 .Dq yes ,
832 .Dq without-password ,
833 .Dq forced-commands-only ,
834 or
835 .Dq no .
836 The default is
837 .Dq yes .
838 .Pp
839 If this option is set to
840 .Dq without-password ,
841 password authentication is disabled for root.
842 .Pp
843 If this option is set to
844 .Dq forced-commands-only ,
845 root login with public key authentication will be allowed,
846 but only if the
847 .Ar command
848 option has been specified
849 (which may be useful for taking remote backups even if root login is
850 normally not allowed).
851 All other authentication methods are disabled for root.
852 .Pp
853 If this option is set to
854 .Dq no ,
855 root is not allowed to log in.
856 .It Cm PermitTunnel
857 Specifies whether
858 .Xr tun 4
859 device forwarding is allowed.
860 The argument must be
861 .Dq yes ,
862 .Dq point-to-point
863 (layer 3),
864 .Dq ethernet
865 (layer 2), or
866 .Dq no .
867 Specifying
868 .Dq yes
869 permits both
870 .Dq point-to-point
871 and
872 .Dq ethernet .
873 The default is
874 .Dq no .
875 .It Cm PermitUserEnvironment
876 Specifies whether
877 .Pa ~/.ssh/environment
878 and
879 .Cm environment=
880 options in
881 .Pa ~/.ssh/authorized_keys
882 are processed by
883 .Xr sshd 8 .
884 The default is
885 .Dq no .
886 Enabling environment processing may enable users to bypass access
887 restrictions in some configurations using mechanisms such as
888 .Ev LD_PRELOAD .
889 .It Cm PidFile
890 Specifies the file that contains the process ID of the
891 SSH daemon.
892 The default is
893 .Pa /var/run/sshd.pid .
894 .It Cm Port
895 Specifies the port number that
896 .Xr sshd 8
897 listens on.
898 The default is 22.
899 Multiple options of this type are permitted.
900 See also
901 .Cm ListenAddress .
902 .It Cm PrintLastLog
903 Specifies whether
904 .Xr sshd 8
905 should print the date and time of the last user login when a user logs
906 in interactively.
907 The default is
908 .Dq yes .
909 .It Cm PrintMotd
910 Specifies whether
911 .Xr sshd 8
912 should print
913 .Pa /etc/motd
914 when a user logs in interactively.
915 (On some systems it is also printed by the shell,
916 .Pa /etc/profile ,
917 or equivalent.)
918 The default is
919 .Dq yes .
920 .It Cm Protocol
921 Specifies the protocol versions
922 .Xr sshd 8
923 supports.
924 The possible values are
925 .Sq 1
926 and
927 .Sq 2 .
928 Multiple versions must be comma-separated.
929 The default is
930 .Sq 2 .
931 Note that the order of the protocol list does not indicate preference,
932 because the client selects among multiple protocol versions offered
933 by the server.
934 Specifying
935 .Dq 2,1
936 is identical to
937 .Dq 1,2 .
938 .It Cm PubkeyAuthentication
939 Specifies whether public key authentication is allowed.
940 The default is
941 .Dq yes .
942 Note that this option applies to protocol version 2 only.
943 .It Cm RevokedKeys
944 Specifies a list of revoked public keys.
945 Keys listed in this file will be refused for public key authentication.
946 Note that if this file is not readable, then public key authentication will
947 be refused for all users.
948 .It Cm RhostsRSAAuthentication
949 Specifies whether rhosts or /etc/hosts.equiv authentication together
950 with successful RSA host authentication is allowed.
951 The default is
952 .Dq no .
953 This option applies to protocol version 1 only.
954 .It Cm RSAAuthentication
955 Specifies whether pure RSA authentication is allowed.
956 The default is
957 .Dq yes .
958 This option applies to protocol version 1 only.
959 .It Cm ServerKeyBits
960 Defines the number of bits in the ephemeral protocol version 1 server key.
961 The minimum value is 512, and the default is 1024.
962 .It Cm StrictModes
963 Specifies whether
964 .Xr sshd 8
965 should check file modes and ownership of the
966 user's files and home directory before accepting login.
967 This is normally desirable because novices sometimes accidentally leave their
968 directory or files world-writable.
969 The default is
970 .Dq yes .
971 Note that this does not apply to
972 .Cm ChrootDirectory ,
973 whose permissions and ownership are checked unconditionally.
974 .It Cm Subsystem
975 Configures an external subsystem (e.g. file transfer daemon).
976 Arguments should be a subsystem name and a command (with optional arguments)
977 to execute upon subsystem request.
978 .Pp
979 The command
980 .Xr sftp-server 8
981 implements the
982 .Dq sftp
983 file transfer subsystem.
984 .Pp
985 Alternately the name
986 .Dq internal-sftp
987 implements an in-process
988 .Dq sftp
989 server.
990 This may simplify configurations using
991 .Cm ChrootDirectory
992 to force a different filesystem root on clients.
993 .Pp
994 By default no subsystems are defined.
995 Note that this option applies to protocol version 2 only.
996 .It Cm SyslogFacility
997 Gives the facility code that is used when logging messages from
998 .Xr sshd 8 .
999 The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
1000 LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
1001 The default is AUTH.
1002 .It Cm TCPKeepAlive
1003 Specifies whether the system should send TCP keepalive messages to the
1004 other side.
1005 If they are sent, death of the connection or crash of one
1006 of the machines will be properly noticed.
1007 However, this means that
1008 connections will die if the route is down temporarily, and some people
1009 find it annoying.
1010 On the other hand, if TCP keepalives are not sent,
1011 sessions may hang indefinitely on the server, leaving
1012 .Dq ghost
1013 users and consuming server resources.
1014 .Pp
1015 The default is
1016 .Dq yes
1017 (to send TCP keepalive messages), and the server will notice
1018 if the network goes down or the client host crashes.
1019 This avoids infinitely hanging sessions.
1020 .Pp
1021 To disable TCP keepalive messages, the value should be set to
1022 .Dq no .
1023 .It Cm TrustedUserCAKeys
1024 Specifies a file containing public keys of certificate authorities that are
1025 trusted to sign user certificates for authentication.
1026 Keys are listed one per line; empty lines and comments starting with
1027 .Ql #
1028 are allowed.
1029 If a certificate is presented for authentication and has its signing CA key
1030 listed in this file, then it may be used for authentication for any user
1031 listed in the certificate's principals list.
1032 Note that certificates that lack a list of principals will not be permitted
1033 for authentication using
1034 .Cm TrustedUserCAKeys .
1035 For more details on certificates, see the
1036 .Sx CERTIFICATES
1037 section in
1038 .Xr ssh-keygen 1 .
1039 .It Cm UseDNS
1040 Specifies whether
1041 .Xr sshd 8
1042 should look up the remote host name and check that
1043 the resolved host name for the remote IP address maps back to the
1044 very same IP address.
1045 The default is
1046 .Dq yes .
1047 .It Cm UseLogin
1048 Specifies whether
1049 .Xr login 1
1050 is used for interactive login sessions.
1051 The default is
1052 .Dq no .
1053 Note that
1054 .Xr login 1
1055 is never used for remote command execution.
1056 Note also, that if this is enabled,
1057 .Cm X11Forwarding
1058 will be disabled because
1059 .Xr login 1
1060 does not know how to handle
1061 .Xr xauth 1
1062 cookies.
1063 If
1064 .Cm UsePrivilegeSeparation
1065 is specified, it will be disabled after authentication.
1066 .It Cm UsePAM
1067 Enables the Pluggable Authentication Module interface.
1068 If set to
1069 .Dq yes
1070 this will enable PAM authentication using
1071 .Cm ChallengeResponseAuthentication
1072 and
1073 .Cm PasswordAuthentication
1074 in addition to PAM account and session module processing for all
1075 authentication types.
1076 .Pp
1077 Because PAM challenge-response authentication usually serves an equivalent
1078 role to password authentication, you should disable either
1079 .Cm PasswordAuthentication
1080 or
1081 .Cm ChallengeResponseAuthentication.
1082 .Pp
1083 If
1084 .Cm UsePAM
1085 is enabled, you will not be able to run
1086 .Xr sshd 8
1087 as a non-root user.
1088 The default is
1089 .Dq no .
1090 .It Cm UsePrivilegeSeparation
1091 Specifies whether
1092 .Xr sshd 8
1093 separates privileges by creating an unprivileged child process
1094 to deal with incoming network traffic.
1095 After successful authentication, another process will be created that has
1096 the privilege of the authenticated user.
1097 The goal of privilege separation is to prevent privilege
1098 escalation by containing any corruption within the unprivileged processes.
1099 The default is
1100 .Dq yes .
1101 .It Cm X11DisplayOffset
1102 Specifies the first display number available for
1103 .Xr sshd 8 Ns 's
1104 X11 forwarding.
1105 This prevents sshd from interfering with real X11 servers.
1106 The default is 10.
1107 .It Cm X11Forwarding
1108 Specifies whether X11 forwarding is permitted.
1109 The argument must be
1110 .Dq yes
1111 or
1112 .Dq no .
1113 The default is
1114 .Dq no .
1115 .Pp
1116 When X11 forwarding is enabled, there may be additional exposure to
1117 the server and to client displays if the
1118 .Xr sshd 8
1119 proxy display is configured to listen on the wildcard address (see
1120 .Cm X11UseLocalhost
1121 below), though this is not the default.
1122 Additionally, the authentication spoofing and authentication data
1123 verification and substitution occur on the client side.
1124 The security risk of using X11 forwarding is that the client's X11
1125 display server may be exposed to attack when the SSH client requests
1126 forwarding (see the warnings for
1127 .Cm ForwardX11
1128 in
1129 .Xr ssh_config 5 ) .
1130 A system administrator may have a stance in which they want to
1131 protect clients that may expose themselves to attack by unwittingly
1132 requesting X11 forwarding, which can warrant a
1133 .Dq no
1134 setting.
1135 .Pp
1136 Note that disabling X11 forwarding does not prevent users from
1137 forwarding X11 traffic, as users can always install their own forwarders.
1138 X11 forwarding is automatically disabled if
1139 .Cm UseLogin
1140 is enabled.
1141 .It Cm X11UseLocalhost
1142 Specifies whether
1143 .Xr sshd 8
1144 should bind the X11 forwarding server to the loopback address or to
1145 the wildcard address.
1146 By default,
1147 sshd binds the forwarding server to the loopback address and sets the
1148 hostname part of the
1149 .Ev DISPLAY
1150 environment variable to
1151 .Dq localhost .
1152 This prevents remote hosts from connecting to the proxy display.
1153 However, some older X11 clients may not function with this
1154 configuration.
1155 .Cm X11UseLocalhost
1156 may be set to
1157 .Dq no
1158 to specify that the forwarding server should be bound to the wildcard
1159 address.
1160 The argument must be
1161 .Dq yes
1162 or
1163 .Dq no .
1164 The default is
1165 .Dq yes .
1166 .It Cm XAuthLocation
1167 Specifies the full pathname of the
1168 .Xr xauth 1
1169 program.
1170 The default is
1171 .Pa /usr/X11R6/bin/xauth .
1172 .El
1173 .Sh TIME FORMATS
1174 .Xr sshd 8
1175 command-line arguments and configuration file options that specify time
1176 may be expressed using a sequence of the form:
1177 .Sm off
1178 .Ar time Op Ar qualifier ,
1179 .Sm on
1180 where
1181 .Ar time
1182 is a positive integer value and
1183 .Ar qualifier
1184 is one of the following:
1185 .Pp
1186 .Bl -tag -width Ds -compact -offset indent
1187 .It Aq Cm none
1188 seconds
1189 .It Cm s | Cm S
1190 seconds
1191 .It Cm m | Cm M
1192 minutes
1193 .It Cm h | Cm H
1194 hours
1195 .It Cm d | Cm D
1196 days
1197 .It Cm w | Cm W
1198 weeks
1199 .El
1200 .Pp
1201 Each member of the sequence is added together to calculate
1202 the total time value.
1203 .Pp
1204 Time format examples:
1205 .Pp
1206 .Bl -tag -width Ds -compact -offset indent
1207 .It 600
1208 600 seconds (10 minutes)
1209 .It 10m
1210 10 minutes
1211 .It 1h30m
1212 1 hour 30 minutes (90 minutes)
1213 .El
1214 .Sh FILES
1215 .Bl -tag -width Ds
1216 .It Pa /etc/ssh/sshd_config
1217 Contains configuration data for
1218 .Xr sshd 8 .
1219 This file should be writable by root only, but it is recommended
1220 (though not necessary) that it be world-readable.
1221 .El
1222 .Sh SEE ALSO
1223 .Xr sshd 8
1224 .Sh AUTHORS
1225 OpenSSH is a derivative of the original and free
1226 ssh 1.2.12 release by Tatu Ylonen.
1227 Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1228 Theo de Raadt and Dug Song
1229 removed many bugs, re-added newer features and
1230 created OpenSSH.
1231 Markus Friedl contributed the support for SSH
1232 protocol versions 1.5 and 2.0.
1233 Niels Provos and Markus Friedl contributed support
1234 for privilege separation.