xref: /freebsd/crypto/openssh/sshd_config.5 (revision 9a41df2a0e6408e9b329bbd8b9e37c2b44461a1b)
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.\" $FreeBSD$
38.Dd June 29 2012
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
48reads configuration data from
49.Pa /etc/ssh/sshd_config
50(or the file specified with
51.Fl f
52on the command line).
53The file contains keyword-argument pairs, one per line.
54Lines starting with
55.Ql #
56and empty lines are interpreted as comments.
57Arguments may optionally be enclosed in double quotes
58.Pq \&"
59in order to represent arguments containing spaces.
60.Pp
61The possible
62keywords and their meanings are as follows (note that
63keywords are case-insensitive and arguments are case-sensitive):
64.Bl -tag -width Ds
65.It Cm AcceptEnv
66Specifies what environment variables sent by the client will be copied into
67the session's
68.Xr environ 7 .
69See
70.Cm SendEnv
71in
72.Xr ssh_config 5
73for how to configure the client.
74Note that environment passing is only supported for protocol 2.
75Variables are specified by name, which may contain the wildcard characters
76.Ql *
77and
78.Ql \&? .
79Multiple environment variables may be separated by whitespace or spread
80across multiple
81.Cm AcceptEnv
82directives.
83Be warned that some environment variables could be used to bypass restricted
84user environments.
85For this reason, care should be taken in the use of this directive.
86The default is not to accept any environment variables.
87.It Cm AddressFamily
88Specifies which address family should be used by
89.Xr sshd 8 .
90Valid arguments are
91.Dq any ,
92.Dq inet
93(use IPv4 only), or
94.Dq inet6
95(use IPv6 only).
96The default is
97.Dq any .
98.It Cm AllowAgentForwarding
99Specifies whether
100.Xr ssh-agent 1
101forwarding is permitted.
102The default is
103.Dq yes .
104Note that disabling agent forwarding does not improve security
105unless users are also denied shell access, as they can always install
106their own forwarders.
107.It Cm AllowGroups
108This keyword can be followed by a list of group name patterns, separated
109by spaces.
110If specified, login is allowed only for users whose primary
111group or supplementary group list matches one of the patterns.
112Only group names are valid; a numerical group ID is not recognized.
113By default, login is allowed for all groups.
114The allow/deny directives are processed in the following order:
115.Cm DenyUsers ,
116.Cm AllowUsers ,
117.Cm DenyGroups ,
118and finally
119.Cm AllowGroups .
120.Pp
121See
122.Sx PATTERNS
123in
124.Xr ssh_config 5
125for more information on patterns.
126.It Cm AllowTcpForwarding
127Specifies whether TCP forwarding is permitted.
128The default is
129.Dq yes .
130Note that disabling TCP forwarding does not improve security unless
131users are also denied shell access, as they can always install their
132own forwarders.
133.It Cm AllowUsers
134This keyword can be followed by a list of user name patterns, separated
135by spaces.
136If specified, login is allowed only for user names that
137match one of the patterns.
138Only user names are valid; a numerical user ID is not recognized.
139By default, login is allowed for all users.
140If the pattern takes the form USER@HOST then USER and HOST
141are separately checked, restricting logins to particular
142users from particular hosts.
143The allow/deny directives are processed in the following order:
144.Cm DenyUsers ,
145.Cm AllowUsers ,
146.Cm DenyGroups ,
147and finally
148.Cm AllowGroups .
149.Pp
150See
151.Sx PATTERNS
152in
153.Xr ssh_config 5
154for more information on patterns.
155.It Cm AuthorizedKeysFile
156Specifies the file that contains the public keys that can be used
157for user authentication.
158The format is described in the
159.Sx AUTHORIZED_KEYS FILE FORMAT
160section of
161.Xr sshd 8 .
162.Cm AuthorizedKeysFile
163may contain tokens of the form %T which are substituted during connection
164setup.
165The following tokens are defined: %% is replaced by a literal '%',
166%h is replaced by the home directory of the user being authenticated, and
167%u is replaced by the username of that user.
168After expansion,
169.Cm AuthorizedKeysFile
170is taken to be an absolute path or one relative to the user's home
171directory.
172Multiple files may be listed, separated by whitespace.
173The default is
174.Dq .ssh/authorized_keys .ssh/authorized_keys2 .
175.It Cm AuthorizedPrincipalsFile
176Specifies a file that lists principal names that are accepted for
177certificate authentication.
178When using certificates signed by a key listed in
179.Cm TrustedUserCAKeys ,
180this file lists names, one of which must appear in the certificate for it
181to be accepted for authentication.
182Names are listed one per line preceded by key options (as described
183in
184.Sx AUTHORIZED_KEYS FILE FORMAT
185in
186.Xr sshd 8 ) .
187Empty lines and comments starting with
188.Ql #
189are ignored.
190.Pp
191.Cm AuthorizedPrincipalsFile
192may contain tokens of the form %T which are substituted during connection
193setup.
194The following tokens are defined: %% is replaced by a literal '%',
195%h is replaced by the home directory of the user being authenticated, and
196%u is replaced by the username of that user.
197After expansion,
198.Cm AuthorizedPrincipalsFile
199is taken to be an absolute path or one relative to the user's home
200directory.
201.Pp
202The default is
203.Dq none ,
204i.e. not to use a principals file \(en in this case, the username
205of the user must appear in a certificate's principals list for it to be
206accepted.
207Note that
208.Cm AuthorizedPrincipalsFile
209is only used when authentication proceeds using a CA listed in
210.Cm TrustedUserCAKeys
211and is not consulted for certification authorities trusted via
212.Pa ~/.ssh/authorized_keys ,
213though the
214.Cm principals=
215key option offers a similar facility (see
216.Xr sshd 8
217for details).
218.It Cm Banner
219The contents of the specified file are sent to the remote user before
220authentication is allowed.
221If the argument is
222.Dq none
223then no banner is displayed.
224This option is only available for protocol version 2.
225By default, no banner is displayed.
226.It Cm ChallengeResponseAuthentication
227Specifies whether challenge-response authentication is allowed (e.g. via
228PAM or though authentication styles supported in
229.Xr login.conf 5 )
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/ssh/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.
777See also
778.Cm UsePAM .
779The default is
780.Dq no .
781.It Cm PermitEmptyPasswords
782When password authentication is allowed, it specifies whether the
783server allows login to accounts with empty password strings.
784The default is
785.Dq no .
786.It Cm PermitOpen
787Specifies the destinations to which TCP port forwarding is permitted.
788The forwarding specification must be one of the following forms:
789.Pp
790.Bl -item -offset indent -compact
791.It
792.Cm PermitOpen
793.Sm off
794.Ar host : port
795.Sm on
796.It
797.Cm PermitOpen
798.Sm off
799.Ar IPv4_addr : port
800.Sm on
801.It
802.Cm PermitOpen
803.Sm off
804.Ar \&[ IPv6_addr \&] : port
805.Sm on
806.El
807.Pp
808Multiple forwards may be specified by separating them with whitespace.
809An argument of
810.Dq any
811can be used to remove all restrictions and permit any forwarding requests.
812An argument of
813.Dq none
814can be used to prohibit all forwarding requests.
815By default all port forwarding requests are permitted.
816.It Cm PermitRootLogin
817Specifies whether root can log in using
818.Xr ssh 1 .
819The argument must be
820.Dq yes ,
821.Dq without-password ,
822.Dq forced-commands-only ,
823or
824.Dq no .
825The default is
826.Dq no .
827Note that if
828.Cm ChallengeResponseAuthentication
829is
830.Dq yes ,
831the root user may be allowed in with its password even if
832.Cm PermitRootLogin is set to
833.Dq without-password .
834.Pp
835If this option is set to
836.Dq without-password ,
837password authentication is disabled for root.
838.Pp
839If this option is set to
840.Dq forced-commands-only ,
841root login with public key authentication will be allowed,
842but only if the
843.Ar command
844option has been specified
845(which may be useful for taking remote backups even if root login is
846normally not allowed).
847All other authentication methods are disabled for root.
848.Pp
849If this option is set to
850.Dq no ,
851root is not allowed to log in.
852.It Cm PermitTunnel
853Specifies whether
854.Xr tun 4
855device forwarding is allowed.
856The argument must be
857.Dq yes ,
858.Dq point-to-point
859(layer 3),
860.Dq ethernet
861(layer 2), or
862.Dq no .
863Specifying
864.Dq yes
865permits both
866.Dq point-to-point
867and
868.Dq ethernet .
869The default is
870.Dq no .
871.It Cm PermitUserEnvironment
872Specifies whether
873.Pa ~/.ssh/environment
874and
875.Cm environment=
876options in
877.Pa ~/.ssh/authorized_keys
878are processed by
879.Xr sshd 8 .
880The default is
881.Dq no .
882Enabling environment processing may enable users to bypass access
883restrictions in some configurations using mechanisms such as
884.Ev LD_PRELOAD .
885.It Cm PidFile
886Specifies the file that contains the process ID of the
887SSH daemon.
888The default is
889.Pa /var/run/sshd.pid .
890.It Cm Port
891Specifies the port number that
892.Xr sshd 8
893listens on.
894The default is 22.
895Multiple options of this type are permitted.
896See also
897.Cm ListenAddress .
898.It Cm PrintLastLog
899Specifies whether
900.Xr sshd 8
901should print the date and time of the last user login when a user logs
902in interactively.
903The default is
904.Dq yes .
905.It Cm PrintMotd
906Specifies whether
907.Xr sshd 8
908should print
909.Pa /etc/motd
910when a user logs in interactively.
911(On some systems it is also printed by the shell,
912.Pa /etc/profile ,
913or equivalent.)
914The default is
915.Dq yes .
916.It Cm Protocol
917Specifies the protocol versions
918.Xr sshd 8
919supports.
920The possible values are
921.Sq 1
922and
923.Sq 2 .
924Multiple versions must be comma-separated.
925The default is
926.Sq 2 .
927Note that the order of the protocol list does not indicate preference,
928because the client selects among multiple protocol versions offered
929by the server.
930Specifying
931.Dq 2,1
932is identical to
933.Dq 1,2 .
934.It Cm PubkeyAuthentication
935Specifies whether public key authentication is allowed.
936The default is
937.Dq yes .
938Note that this option applies to protocol version 2 only.
939.It Cm RevokedKeys
940Specifies a list of revoked public keys.
941Keys listed in this file will be refused for public key authentication.
942Note that if this file is not readable, then public key authentication will
943be refused for all users.
944.It Cm RhostsRSAAuthentication
945Specifies whether rhosts or
946.Pa /etc/hosts.equiv
947authentication together
948with successful RSA host authentication is allowed.
949The default is
950.Dq no .
951This option applies to protocol version 1 only.
952.It Cm RSAAuthentication
953Specifies whether pure RSA authentication is allowed.
954The default is
955.Dq yes .
956This option applies to protocol version 1 only.
957.It Cm ServerKeyBits
958Defines the number of bits in the ephemeral protocol version 1 server key.
959The minimum value is 512, and the default is 1024.
960.It Cm StrictModes
961Specifies whether
962.Xr sshd 8
963should check file modes and ownership of the
964user's files and home directory before accepting login.
965This is normally desirable because novices sometimes accidentally leave their
966directory or files world-writable.
967The default is
968.Dq yes .
969Note that this does not apply to
970.Cm ChrootDirectory ,
971whose permissions and ownership are checked unconditionally.
972.It Cm Subsystem
973Configures an external subsystem (e.g. file transfer daemon).
974Arguments should be a subsystem name and a command (with optional arguments)
975to execute upon subsystem request.
976.Pp
977The command
978.Xr sftp-server 8
979implements the
980.Dq sftp
981file transfer subsystem.
982.Pp
983Alternately the name
984.Dq internal-sftp
985implements an in-process
986.Dq sftp
987server.
988This may simplify configurations using
989.Cm ChrootDirectory
990to force a different filesystem root on clients.
991.Pp
992By default no subsystems are defined.
993Note that this option applies to protocol version 2 only.
994.It Cm SyslogFacility
995Gives the facility code that is used when logging messages from
996.Xr sshd 8 .
997The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
998LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
999The default is AUTH.
1000.It Cm TCPKeepAlive
1001Specifies whether the system should send TCP keepalive messages to the
1002other side.
1003If they are sent, death of the connection or crash of one
1004of the machines will be properly noticed.
1005However, this means that
1006connections will die if the route is down temporarily, and some people
1007find it annoying.
1008On the other hand, if TCP keepalives are not sent,
1009sessions may hang indefinitely on the server, leaving
1010.Dq ghost
1011users and consuming server resources.
1012.Pp
1013The default is
1014.Dq yes
1015(to send TCP keepalive messages), and the server will notice
1016if the network goes down or the client host crashes.
1017This avoids infinitely hanging sessions.
1018.Pp
1019To disable TCP keepalive messages, the value should be set to
1020.Dq no .
1021.It Cm TrustedUserCAKeys
1022Specifies a file containing public keys of certificate authorities that are
1023trusted to sign user certificates for authentication.
1024Keys are listed one per line; empty lines and comments starting with
1025.Ql #
1026are allowed.
1027If a certificate is presented for authentication and has its signing CA key
1028listed in this file, then it may be used for authentication for any user
1029listed in the certificate's principals list.
1030Note that certificates that lack a list of principals will not be permitted
1031for authentication using
1032.Cm TrustedUserCAKeys .
1033For more details on certificates, see the
1034.Sx CERTIFICATES
1035section in
1036.Xr ssh-keygen 1 .
1037.It Cm UseDNS
1038Specifies whether
1039.Xr sshd 8
1040should look up the remote host name and check that
1041the resolved host name for the remote IP address maps back to the
1042very same IP address.
1043The default is
1044.Dq yes .
1045.It Cm UseLogin
1046Specifies whether
1047.Xr login 1
1048is used for interactive login sessions.
1049The default is
1050.Dq no .
1051Note that
1052.Xr login 1
1053is never used for remote command execution.
1054Note also, that if this is enabled,
1055.Cm X11Forwarding
1056will be disabled because
1057.Xr login 1
1058does not know how to handle
1059.Xr xauth 1
1060cookies.
1061If
1062.Cm UsePrivilegeSeparation
1063is specified, it will be disabled after authentication.
1064.It Cm UsePAM
1065Enables the Pluggable Authentication Module interface.
1066If set to
1067.Dq yes
1068this will enable PAM authentication using
1069.Cm ChallengeResponseAuthentication
1070and
1071.Cm PasswordAuthentication
1072in addition to PAM account and session module processing for all
1073authentication types.
1074.Pp
1075Because PAM challenge-response authentication usually serves an equivalent
1076role to password authentication, you should disable either
1077.Cm PasswordAuthentication
1078or
1079.Cm ChallengeResponseAuthentication.
1080.Pp
1081If
1082.Cm UsePAM
1083is enabled, you will not be able to run
1084.Xr sshd 8
1085as a non-root user.
1086The default is
1087.Dq yes .
1088.It Cm UsePrivilegeSeparation
1089Specifies whether
1090.Xr sshd 8
1091separates privileges by creating an unprivileged child process
1092to deal with incoming network traffic.
1093After successful authentication, another process will be created that has
1094the privilege of the authenticated user.
1095The goal of privilege separation is to prevent privilege
1096escalation by containing any corruption within the unprivileged processes.
1097The default is
1098.Dq sandbox .
1099If
1100.Cm UsePrivilegeSeparation
1101is set to
1102.Dq sandbox
1103then the pre-authentication unprivileged process is subject to additional
1104restrictions.
1105.It Cm VersionAddendum
1106Optionally specifies additional text to append to the SSH protocol banner
1107sent by the server upon connection.
1108The default is
1109.Dq FreeBSD-20120901 .
1110.It Cm X11DisplayOffset
1111Specifies the first display number available for
1112.Xr sshd 8 Ns 's
1113X11 forwarding.
1114This prevents sshd from interfering with real X11 servers.
1115The default is 10.
1116.It Cm X11Forwarding
1117Specifies whether X11 forwarding is permitted.
1118The argument must be
1119.Dq yes
1120or
1121.Dq no .
1122The default is
1123.Dq yes .
1124.Pp
1125When X11 forwarding is enabled, there may be additional exposure to
1126the server and to client displays if the
1127.Xr sshd 8
1128proxy display is configured to listen on the wildcard address (see
1129.Cm X11UseLocalhost
1130below), though this is not the default.
1131Additionally, the authentication spoofing and authentication data
1132verification and substitution occur on the client side.
1133The security risk of using X11 forwarding is that the client's X11
1134display server may be exposed to attack when the SSH client requests
1135forwarding (see the warnings for
1136.Cm ForwardX11
1137in
1138.Xr ssh_config 5 ) .
1139A system administrator may have a stance in which they want to
1140protect clients that may expose themselves to attack by unwittingly
1141requesting X11 forwarding, which can warrant a
1142.Dq no
1143setting.
1144.Pp
1145Note that disabling X11 forwarding does not prevent users from
1146forwarding X11 traffic, as users can always install their own forwarders.
1147X11 forwarding is automatically disabled if
1148.Cm UseLogin
1149is enabled.
1150.It Cm X11UseLocalhost
1151Specifies whether
1152.Xr sshd 8
1153should bind the X11 forwarding server to the loopback address or to
1154the wildcard address.
1155By default,
1156sshd binds the forwarding server to the loopback address and sets the
1157hostname part of the
1158.Ev DISPLAY
1159environment variable to
1160.Dq localhost .
1161This prevents remote hosts from connecting to the proxy display.
1162However, some older X11 clients may not function with this
1163configuration.
1164.Cm X11UseLocalhost
1165may be set to
1166.Dq no
1167to specify that the forwarding server should be bound to the wildcard
1168address.
1169The argument must be
1170.Dq yes
1171or
1172.Dq no .
1173The default is
1174.Dq yes .
1175.It Cm XAuthLocation
1176Specifies the full pathname of the
1177.Xr xauth 1
1178program.
1179The default is
1180.Pa /usr/local/bin/xauth .
1181.El
1182.Sh TIME FORMATS
1183.Xr sshd 8
1184command-line arguments and configuration file options that specify time
1185may be expressed using a sequence of the form:
1186.Sm off
1187.Ar time Op Ar qualifier ,
1188.Sm on
1189where
1190.Ar time
1191is a positive integer value and
1192.Ar qualifier
1193is one of the following:
1194.Pp
1195.Bl -tag -width Ds -compact -offset indent
1196.It Aq Cm none
1197seconds
1198.It Cm s | Cm S
1199seconds
1200.It Cm m | Cm M
1201minutes
1202.It Cm h | Cm H
1203hours
1204.It Cm d | Cm D
1205days
1206.It Cm w | Cm W
1207weeks
1208.El
1209.Pp
1210Each member of the sequence is added together to calculate
1211the total time value.
1212.Pp
1213Time format examples:
1214.Pp
1215.Bl -tag -width Ds -compact -offset indent
1216.It 600
1217600 seconds (10 minutes)
1218.It 10m
121910 minutes
1220.It 1h30m
12211 hour 30 minutes (90 minutes)
1222.El
1223.Sh FILES
1224.Bl -tag -width Ds
1225.It Pa /etc/ssh/sshd_config
1226Contains configuration data for
1227.Xr sshd 8 .
1228This file should be writable by root only, but it is recommended
1229(though not necessary) that it be world-readable.
1230.El
1231.Sh SEE ALSO
1232.Xr sshd 8
1233.Sh AUTHORS
1234OpenSSH is a derivative of the original and free
1235ssh 1.2.12 release by Tatu Ylonen.
1236Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1237Theo de Raadt and Dug Song
1238removed many bugs, re-added newer features and
1239created OpenSSH.
1240Markus Friedl contributed the support for SSH
1241protocol versions 1.5 and 2.0.
1242Niels Provos and Markus Friedl contributed support
1243for privilege separation.
1244