blob: a6c37879239c3a30394c544df3a7f34ed84feec7 [file] [log] [blame]
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001.\"
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.135 2011/08/02 01:22:11 djm Exp $
37.Dd $Mdocdate: August 2 2011 $
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 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/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,
659hmac-sha2-256,hmac-sha256-96,hmac-sha2-512,
660hmac-sha2-512-96
661.Ed
662.It Cm Match
663Introduces a conditional block.
664If all of the criteria on the
665.Cm Match
666line are satisfied, the keywords on the following lines override those
667set in the global section of the config file, until either another
668.Cm Match
669line or the end of the file.
670.Pp
671The arguments to
672.Cm Match
673are one or more criteria-pattern pairs.
674The available criteria are
675.Cm User ,
676.Cm Group ,
677.Cm Host ,
678and
679.Cm Address .
680The match patterns may consist of single entries or comma-separated
681lists and may use the wildcard and negation operators described in the
682.Sx PATTERNS
683section of
684.Xr ssh_config 5 .
685.Pp
686The patterns in an
687.Cm Address
688criteria may additionally contain addresses to match in CIDR
689address/masklen format, e.g.\&
690.Dq 192.0.2.0/24
691or
692.Dq 3ffe:ffff::/32 .
693Note that the mask length provided must be consistent with the address -
694it is an error to specify a mask length that is too long for the address
695or one with bits set in this host portion of the address.
696For example,
697.Dq 192.0.2.0/33
698and
699.Dq 192.0.2.0/8
700respectively.
701.Pp
702Only a subset of keywords may be used on the lines following a
703.Cm Match
704keyword.
705Available keywords are
706.Cm AllowAgentForwarding ,
707.Cm AllowTcpForwarding ,
708.Cm AuthorizedKeysFile ,
709.Cm AuthorizedPrincipalsFile ,
710.Cm Banner ,
711.Cm ChrootDirectory ,
712.Cm ForceCommand ,
713.Cm GatewayPorts ,
714.Cm GSSAPIAuthentication ,
715.Cm HostbasedAuthentication ,
716.Cm HostbasedUsesNameFromPacketOnly ,
717.Cm KbdInteractiveAuthentication ,
718.Cm KerberosAuthentication ,
719.Cm MaxAuthTries ,
720.Cm MaxSessions ,
721.Cm PasswordAuthentication ,
722.Cm PermitEmptyPasswords ,
723.Cm PermitOpen ,
724.Cm PermitRootLogin ,
725.Cm PermitTunnel ,
726.Cm PubkeyAuthentication ,
727.Cm RhostsRSAAuthentication ,
728.Cm RSAAuthentication ,
729.Cm X11DisplayOffset ,
730.Cm X11Forwarding
731and
732.Cm X11UseLocalHost .
733.It Cm MaxAuthTries
734Specifies the maximum number of authentication attempts permitted per
735connection.
736Once the number of failures reaches half this value,
737additional failures are logged.
738The default is 6.
739.It Cm MaxSessions
740Specifies the maximum number of open sessions permitted per network connection.
741The default is 10.
742.It Cm MaxStartups
743Specifies the maximum number of concurrent unauthenticated connections to the
744SSH daemon.
745Additional connections will be dropped until authentication succeeds or the
746.Cm LoginGraceTime
747expires for a connection.
748The default is 10.
749.Pp
750Alternatively, random early drop can be enabled by specifying
751the three colon separated values
752.Dq start:rate:full
753(e.g. "10:30:60").
754.Xr sshd 8
755will refuse connection attempts with a probability of
756.Dq rate/100
757(30%)
758if there are currently
759.Dq start
760(10)
761unauthenticated connections.
762The probability increases linearly and all connection attempts
763are refused if the number of unauthenticated connections reaches
764.Dq full
765(60).
766.It Cm PasswordAuthentication
767Specifies whether password authentication is allowed.
768The default is
769.Dq yes .
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 yes .
813.Pp
814If this option is set to
815.Dq without-password ,
816password authentication is disabled for root.
817.Pp
818If this option is set to
819.Dq forced-commands-only ,
820root login with public key authentication will be allowed,
821but only if the
822.Ar command
823option has been specified
824(which may be useful for taking remote backups even if root login is
825normally not allowed).
826All other authentication methods are disabled for root.
827.Pp
828If this option is set to
829.Dq no ,
830root is not allowed to log in.
831.It Cm PermitTunnel
832Specifies whether
833.Xr tun 4
834device forwarding is allowed.
835The argument must be
836.Dq yes ,
837.Dq point-to-point
838(layer 3),
839.Dq ethernet
840(layer 2), or
841.Dq no .
842Specifying
843.Dq yes
844permits both
845.Dq point-to-point
846and
847.Dq ethernet .
848The default is
849.Dq no .
850.It Cm PermitUserEnvironment
851Specifies whether
852.Pa ~/.ssh/environment
853and
854.Cm environment=
855options in
856.Pa ~/.ssh/authorized_keys
857are processed by
858.Xr sshd 8 .
859The default is
860.Dq no .
861Enabling environment processing may enable users to bypass access
862restrictions in some configurations using mechanisms such as
863.Ev LD_PRELOAD .
864.It Cm PidFile
865Specifies the file that contains the process ID of the
866SSH daemon.
867The default is
868.Pa /var/run/sshd.pid .
869.It Cm Port
870Specifies the port number that
871.Xr sshd 8
872listens on.
873The default is 22.
874Multiple options of this type are permitted.
875See also
876.Cm ListenAddress .
877.It Cm PrintLastLog
878Specifies whether
879.Xr sshd 8
880should print the date and time of the last user login when a user logs
881in interactively.
882The default is
883.Dq yes .
884.It Cm PrintMotd
885Specifies whether
886.Xr sshd 8
887should print
888.Pa /etc/motd
889when a user logs in interactively.
890(On some systems it is also printed by the shell,
891.Pa /etc/profile ,
892or equivalent.)
893The default is
894.Dq yes .
895.It Cm Protocol
896Specifies the protocol versions
897.Xr sshd 8
898supports.
899The possible values are
900.Sq 1
901and
902.Sq 2 .
903Multiple versions must be comma-separated.
904The default is
905.Sq 2 .
906Note that the order of the protocol list does not indicate preference,
907because the client selects among multiple protocol versions offered
908by the server.
909Specifying
910.Dq 2,1
911is identical to
912.Dq 1,2 .
913.It Cm PubkeyAuthentication
914Specifies whether public key authentication is allowed.
915The default is
916.Dq yes .
917Note that this option applies to protocol version 2 only.
918.It Cm RevokedKeys
919Specifies a list of revoked public keys.
920Keys listed in this file will be refused for public key authentication.
921Note that if this file is not readable, then public key authentication will
922be refused for all users.
923.It Cm RhostsRSAAuthentication
924Specifies whether rhosts or /etc/hosts.equiv authentication together
925with successful RSA host authentication is allowed.
926The default is
927.Dq no .
928This option applies to protocol version 1 only.
929.It Cm RSAAuthentication
930Specifies whether pure RSA authentication is allowed.
931The default is
932.Dq yes .
933This option applies to protocol version 1 only.
934.It Cm ServerKeyBits
935Defines the number of bits in the ephemeral protocol version 1 server key.
936The minimum value is 512, and the default is 1024.
937.It Cm StrictModes
938Specifies whether
939.Xr sshd 8
940should check file modes and ownership of the
941user's files and home directory before accepting login.
942This is normally desirable because novices sometimes accidentally leave their
943directory or files world-writable.
944The default is
945.Dq yes .
946Note that this does not apply to
947.Cm ChrootDirectory ,
948whose permissions and ownership are checked unconditionally.
949.It Cm Subsystem
950Configures an external subsystem (e.g. file transfer daemon).
951Arguments should be a subsystem name and a command (with optional arguments)
952to execute upon subsystem request.
953.Pp
954The command
955.Xr sftp-server 8
956implements the
957.Dq sftp
958file transfer subsystem.
959.Pp
960Alternately the name
961.Dq internal-sftp
962implements an in-process
963.Dq sftp
964server.
965This may simplify configurations using
966.Cm ChrootDirectory
967to force a different filesystem root on clients.
968.Pp
969By default no subsystems are defined.
970Note that this option applies to protocol version 2 only.
971.It Cm SyslogFacility
972Gives the facility code that is used when logging messages from
973.Xr sshd 8 .
974The possible values are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2,
975LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
976The default is AUTH.
977.It Cm TCPKeepAlive
978Specifies whether the system should send TCP keepalive messages to the
979other side.
980If they are sent, death of the connection or crash of one
981of the machines will be properly noticed.
982However, this means that
983connections will die if the route is down temporarily, and some people
984find it annoying.
985On the other hand, if TCP keepalives are not sent,
986sessions may hang indefinitely on the server, leaving
987.Dq ghost
988users and consuming server resources.
989.Pp
990The default is
991.Dq yes
992(to send TCP keepalive messages), and the server will notice
993if the network goes down or the client host crashes.
994This avoids infinitely hanging sessions.
995.Pp
996To disable TCP keepalive messages, the value should be set to
997.Dq no .
998.It Cm TrustedUserCAKeys
999Specifies a file containing public keys of certificate authorities that are
1000trusted to sign user certificates for authentication.
1001Keys are listed one per line; empty lines and comments starting with
1002.Ql #
1003are allowed.
1004If a certificate is presented for authentication and has its signing CA key
1005listed in this file, then it may be used for authentication for any user
1006listed in the certificate's principals list.
1007Note that certificates that lack a list of principals will not be permitted
1008for authentication using
1009.Cm TrustedUserCAKeys .
1010For more details on certificates, see the
1011.Sx CERTIFICATES
1012section in
1013.Xr ssh-keygen 1 .
1014.It Cm UseDNS
1015Specifies whether
1016.Xr sshd 8
1017should look up the remote host name and check that
1018the resolved host name for the remote IP address maps back to the
1019very same IP address.
1020The default is
1021.Dq yes .
1022.It Cm UseLogin
1023Specifies whether
1024.Xr login 1
1025is used for interactive login sessions.
1026The default is
1027.Dq no .
1028Note that
1029.Xr login 1
1030is never used for remote command execution.
1031Note also, that if this is enabled,
1032.Cm X11Forwarding
1033will be disabled because
1034.Xr login 1
1035does not know how to handle
1036.Xr xauth 1
1037cookies.
1038If
1039.Cm UsePrivilegeSeparation
1040is specified, it will be disabled after authentication.
1041.It Cm UsePAM
1042Enables the Pluggable Authentication Module interface.
1043If set to
1044.Dq yes
1045this will enable PAM authentication using
1046.Cm ChallengeResponseAuthentication
1047and
1048.Cm PasswordAuthentication
1049in addition to PAM account and session module processing for all
1050authentication types.
1051.Pp
1052Because PAM challenge-response authentication usually serves an equivalent
1053role to password authentication, you should disable either
1054.Cm PasswordAuthentication
1055or
1056.Cm ChallengeResponseAuthentication.
1057.Pp
1058If
1059.Cm UsePAM
1060is enabled, you will not be able to run
1061.Xr sshd 8
1062as a non-root user.
1063The default is
1064.Dq no .
1065.It Cm UsePrivilegeSeparation
1066Specifies whether
1067.Xr sshd 8
1068separates privileges by creating an unprivileged child process
1069to deal with incoming network traffic.
1070After successful authentication, another process will be created that has
1071the privilege of the authenticated user.
1072The goal of privilege separation is to prevent privilege
1073escalation by containing any corruption within the unprivileged processes.
1074The default is
1075.Dq yes .
1076If
1077.Cm UsePrivilegeSeparation
1078is set to
1079.Dq sandbox
1080then the pre-authentication unprivileged process is subject to additional
1081restrictions.
1082.It Cm X11DisplayOffset
1083Specifies the first display number available for
1084.Xr sshd 8 Ns 's
1085X11 forwarding.
1086This prevents sshd from interfering with real X11 servers.
1087The default is 10.
1088.It Cm X11Forwarding
1089Specifies whether X11 forwarding is permitted.
1090The argument must be
1091.Dq yes
1092or
1093.Dq no .
1094The default is
1095.Dq no .
1096.Pp
1097When X11 forwarding is enabled, there may be additional exposure to
1098the server and to client displays if the
1099.Xr sshd 8
1100proxy display is configured to listen on the wildcard address (see
1101.Cm X11UseLocalhost
1102below), though this is not the default.
1103Additionally, the authentication spoofing and authentication data
1104verification and substitution occur on the client side.
1105The security risk of using X11 forwarding is that the client's X11
1106display server may be exposed to attack when the SSH client requests
1107forwarding (see the warnings for
1108.Cm ForwardX11
1109in
1110.Xr ssh_config 5 ) .
1111A system administrator may have a stance in which they want to
1112protect clients that may expose themselves to attack by unwittingly
1113requesting X11 forwarding, which can warrant a
1114.Dq no
1115setting.
1116.Pp
1117Note that disabling X11 forwarding does not prevent users from
1118forwarding X11 traffic, as users can always install their own forwarders.
1119X11 forwarding is automatically disabled if
1120.Cm UseLogin
1121is enabled.
1122.It Cm X11UseLocalhost
1123Specifies whether
1124.Xr sshd 8
1125should bind the X11 forwarding server to the loopback address or to
1126the wildcard address.
1127By default,
1128sshd binds the forwarding server to the loopback address and sets the
1129hostname part of the
1130.Ev DISPLAY
1131environment variable to
1132.Dq localhost .
1133This prevents remote hosts from connecting to the proxy display.
1134However, some older X11 clients may not function with this
1135configuration.
1136.Cm X11UseLocalhost
1137may be set to
1138.Dq no
1139to specify that the forwarding server should be bound to the wildcard
1140address.
1141The argument must be
1142.Dq yes
1143or
1144.Dq no .
1145The default is
1146.Dq yes .
1147.It Cm XAuthLocation
1148Specifies the full pathname of the
1149.Xr xauth 1
1150program.
1151The default is
1152.Pa /usr/X11R6/bin/xauth .
1153.El
1154.Sh TIME FORMATS
1155.Xr sshd 8
1156command-line arguments and configuration file options that specify time
1157may be expressed using a sequence of the form:
1158.Sm off
1159.Ar time Op Ar qualifier ,
1160.Sm on
1161where
1162.Ar time
1163is a positive integer value and
1164.Ar qualifier
1165is one of the following:
1166.Pp
1167.Bl -tag -width Ds -compact -offset indent
1168.It Aq Cm none
1169seconds
1170.It Cm s | Cm S
1171seconds
1172.It Cm m | Cm M
1173minutes
1174.It Cm h | Cm H
1175hours
1176.It Cm d | Cm D
1177days
1178.It Cm w | Cm W
1179weeks
1180.El
1181.Pp
1182Each member of the sequence is added together to calculate
1183the total time value.
1184.Pp
1185Time format examples:
1186.Pp
1187.Bl -tag -width Ds -compact -offset indent
1188.It 600
1189600 seconds (10 minutes)
1190.It 10m
119110 minutes
1192.It 1h30m
11931 hour 30 minutes (90 minutes)
1194.El
1195.Sh FILES
1196.Bl -tag -width Ds
1197.It Pa /etc/ssh/sshd_config
1198Contains configuration data for
1199.Xr sshd 8 .
1200This file should be writable by root only, but it is recommended
1201(though not necessary) that it be world-readable.
1202.El
1203.Sh SEE ALSO
1204.Xr sshd 8
1205.Sh AUTHORS
1206OpenSSH is a derivative of the original and free
1207ssh 1.2.12 release by Tatu Ylonen.
1208Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
1209Theo de Raadt and Dug Song
1210removed many bugs, re-added newer features and
1211created OpenSSH.
1212Markus Friedl contributed the support for SSH
1213protocol versions 1.5 and 2.0.
1214Niels Provos and Markus Friedl contributed support
1215for privilege separation.