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