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