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