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