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