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