1SSHD_CONFIG(5) BSD File Formats Manual SSHD_CONFIG(5)
2
4 sshd_config — OpenSSH daemon configuration file
5
7 sshd(8) reads configuration data from /etc/ssh/sshd_config (or the file
8 specified with -f on the command line). The file contains keyword-argu‐
9 ment pairs, one per line. For each keyword, the first obtained value
10 will be used. Lines starting with ‘#’ and empty lines are interpreted as
11 comments. Arguments may optionally be enclosed in double quotes (") in
12 order to represent arguments containing spaces.
13
14 The possible keywords and their meanings are as follows (note that key‐
15 words are case-insensitive and arguments are case-sensitive):
16
17 AcceptEnv
18 Specifies what environment variables sent by the client will be
19 copied into the session's environ(7). See SendEnv and SetEnv in
20 ssh_config(5) for how to configure the client. The TERM environ‐
21 ment variable is always accepted whenever the client requests a
22 pseudo-terminal as it is required by the protocol. Variables are
23 specified by name, which may contain the wildcard characters ‘*’
24 and ‘?’. Multiple environment variables may be separated by
25 whitespace or spread across multiple AcceptEnv directives. Be
26 warned that some environment variables could be used to bypass
27 restricted user environments. For this reason, care should be
28 taken in the use of this directive. The default is not to accept
29 any environment variables.
30
31 AddressFamily
32 Specifies which address family should be used by sshd(8). Valid
33 arguments are any (the default), inet (use IPv4 only), or inet6
34 (use IPv6 only).
35
36 AllowAgentForwarding
37 Specifies whether ssh-agent(1) forwarding is permitted. The
38 default is yes. Note that disabling agent forwarding does not
39 improve security unless users are also denied shell access, as
40 they can always install their own forwarders.
41
42 AllowGroups
43 This keyword can be followed by a list of group name patterns,
44 separated by spaces. If specified, login is allowed only for
45 users whose primary group or supplementary group list matches one
46 of the patterns. Only group names are valid; a numerical group
47 ID is not recognized. By default, login is allowed for all
48 groups. The allow/deny groups directives are processed in the
49 following order: DenyGroups, AllowGroups.
50
51 See PATTERNS in ssh_config(5) for more information on patterns.
52
53 AllowStreamLocalForwarding
54 Specifies whether StreamLocal (Unix-domain socket) forwarding is
55 permitted. The available options are yes (the default) or all to
56 allow StreamLocal forwarding, no to prevent all StreamLocal for‐
57 warding, local to allow local (from the perspective of ssh(1))
58 forwarding only or remote to allow remote forwarding only. Note
59 that disabling StreamLocal forwarding does not improve security
60 unless users are also denied shell access, as they can always
61 install their own forwarders.
62
63 AllowTcpForwarding
64 Specifies whether TCP forwarding is permitted. The available
65 options are yes (the default) or all to allow TCP forwarding, no
66 to prevent all TCP forwarding, local to allow local (from the
67 perspective of ssh(1)) forwarding only or remote to allow remote
68 forwarding only. Note that disabling TCP forwarding does not
69 improve security unless users are also denied shell access, as
70 they can always install their own forwarders.
71
72 AllowUsers
73 This keyword can be followed by a list of user name patterns,
74 separated by spaces. If specified, login is allowed only for
75 user names that match one of the patterns. Only user names are
76 valid; a numerical user ID is not recognized. By default, login
77 is allowed for all users. If the pattern takes the form
78 USER@HOST then USER and HOST are separately checked, restricting
79 logins to particular users from particular hosts. HOST criteria
80 may additionally contain addresses to match in CIDR
81 address/masklen format. The allow/deny users directives are pro‐
82 cessed in the following order: DenyUsers, AllowUsers.
83
84 See PATTERNS in ssh_config(5) for more information on patterns.
85
86 AuthenticationMethods
87 Specifies the authentication methods that must be successfully
88 completed for a user to be granted access. This option must be
89 followed by one or more lists of comma-separated authentication
90 method names, or by the single string any to indicate the default
91 behaviour of accepting any single authentication method. If the
92 default is overridden, then successful authentication requires
93 completion of every method in at least one of these lists.
94
95 For example, "publickey,password publickey,keyboard-interactive"
96 would require the user to complete public key authentication,
97 followed by either password or keyboard interactive authentica‐
98 tion. Only methods that are next in one or more lists are
99 offered at each stage, so for this example it would not be possi‐
100 ble to attempt password or keyboard-interactive authentication
101 before public key.
102
103 For keyboard interactive authentication it is also possible to
104 restrict authentication to a specific device by appending a colon
105 followed by the device identifier bsdauth or pam. depending on
106 the server configuration. For example,
107 "keyboard-interactive:bsdauth" would restrict keyboard interac‐
108 tive authentication to the bsdauth device.
109
110 If the publickey method is listed more than once, sshd(8) veri‐
111 fies that keys that have been used successfully are not reused
112 for subsequent authentications. For example,
113 "publickey,publickey" requires successful authentication using
114 two different public keys.
115
116 Note that each authentication method listed should also be
117 explicitly enabled in the configuration.
118
119 The available authentication methods are: "gssapi-with-mic",
120 "hostbased", "keyboard-interactive", "none" (used for access to
121 password-less accounts when PermitEmptyPasswords is enabled),
122 "password" and "publickey".
123
124 AuthorizedKeysCommand
125 Specifies a program to be used to look up the user's public keys.
126 The program must be owned by root, not writable by group or oth‐
127 ers and specified by an absolute path. Arguments to
128 AuthorizedKeysCommand accept the tokens described in the TOKENS
129 section. If no arguments are specified then the username of the
130 target user is used.
131
132 The program should produce on standard output zero or more lines
133 of authorized_keys output (see AUTHORIZED_KEYS in sshd(8)). If a
134 key supplied by AuthorizedKeysCommand does not successfully
135 authenticate and authorize the user then public key authentica‐
136 tion continues using the usual AuthorizedKeysFile files. By
137 default, no AuthorizedKeysCommand is run.
138
139 AuthorizedKeysCommandUser
140 Specifies the user under whose account the AuthorizedKeysCommand
141 is run. It is recommended to use a dedicated user that has no
142 other role on the host than running authorized keys commands. If
143 AuthorizedKeysCommand is specified but AuthorizedKeysCommandUser
144 is not, then sshd(8) will refuse to start.
145
146 AuthorizedKeysFile
147 Specifies the file that contains the public keys used for user
148 authentication. The format is described in the AUTHORIZED_KEYS
149 FILE FORMAT section of sshd(8). Arguments to AuthorizedKeysFile
150 accept the tokens described in the TOKENS section. After expan‐
151 sion, AuthorizedKeysFile is taken to be an absolute path or one
152 relative to the user's home directory. Multiple files may be
153 listed, separated by whitespace. Alternately this option may be
154 set to none to skip checking for user keys in files. The default
155 is ".ssh/authorized_keys .ssh/authorized_keys2".
156
157 AuthorizedPrincipalsCommand
158 Specifies a program to be used to generate the list of allowed
159 certificate principals as per AuthorizedPrincipalsFile. The pro‐
160 gram must be owned by root, not writable by group or others and
161 specified by an absolute path. Arguments to
162 AuthorizedPrincipalsCommand accept the tokens described in the
163 TOKENS section. If no arguments are specified then the username
164 of the target user is used.
165
166 The program should produce on standard output zero or more lines
167 of AuthorizedPrincipalsFile output. If either
168 AuthorizedPrincipalsCommand or AuthorizedPrincipalsFile is speci‐
169 fied, then certificates offered by the client for authentication
170 must contain a principal that is listed. By default, no
171 AuthorizedPrincipalsCommand is run.
172
173 AuthorizedPrincipalsCommandUser
174 Specifies the user under whose account the
175 AuthorizedPrincipalsCommand is run. It is recommended to use a
176 dedicated user that has no other role on the host than running
177 authorized principals commands. If AuthorizedPrincipalsCommand
178 is specified but AuthorizedPrincipalsCommandUser is not, then
179 sshd(8) will refuse to start.
180
181 AuthorizedPrincipalsFile
182 Specifies a file that lists principal names that are accepted for
183 certificate authentication. When using certificates signed by a
184 key listed in TrustedUserCAKeys, this file lists names, one of
185 which must appear in the certificate for it to be accepted for
186 authentication. Names are listed one per line preceded by key
187 options (as described in AUTHORIZED_KEYS FILE FORMAT in sshd(8)).
188 Empty lines and comments starting with ‘#’ are ignored.
189
190 Arguments to AuthorizedPrincipalsFile accept the tokens described
191 in the TOKENS section. After expansion, AuthorizedPrincipalsFile
192 is taken to be an absolute path or one relative to the user's
193 home directory. The default is none, i.e. not to use a princi‐
194 pals file – in this case, the username of the user must appear in
195 a certificate's principals list for it to be accepted.
196
197 Note that AuthorizedPrincipalsFile is only used when authentica‐
198 tion proceeds using a CA listed in TrustedUserCAKeys and is not
199 consulted for certification authorities trusted via
200 ~/.ssh/authorized_keys, though the principals= key option offers
201 a similar facility (see sshd(8) for details).
202
203 Banner The contents of the specified file are sent to the remote user
204 before authentication is allowed. If the argument is none then
205 no banner is displayed. By default, no banner is displayed.
206
207 CASignatureAlgorithms
208 The default is handled system-wide by crypto-policies(7). To see
209 the defaults and how to modify this default, see manual page
210 update-crypto-policies(8).
211
212 Specifies which algorithms are allowed for signing of certifi‐
213 cates by certificate authorities (CAs). Certificates signed
214 using other algorithms will not be accepted for public key or
215 host-based authentication.
216
217 ChallengeResponseAuthentication
218 Specifies whether challenge-response authentication is allowed
219 (e.g. via PAM or through authentication styles supported in
220 login.conf(5)) The default is yes.
221
222 ChrootDirectory
223 Specifies the pathname of a directory to chroot(2) to after
224 authentication. At session startup sshd(8) checks that all com‐
225 ponents of the pathname are root-owned directories which are not
226 writable by any other user or group. After the chroot, sshd(8)
227 changes the working directory to the user's home directory.
228 Arguments to ChrootDirectory accept the tokens described in the
229 TOKENS section.
230
231 The ChrootDirectory must contain the necessary files and directo‐
232 ries to support the user's session. For an interactive session
233 this requires at least a shell, typically sh(1), and basic /dev
234 nodes such as null(4), zero(4), stdin(4), stdout(4), stderr(4),
235 and tty(4) devices. For file transfer sessions using SFTP no
236 additional configuration of the environment is necessary if the
237 in-process sftp-server is used, though sessions which use logging
238 may require /dev/log inside the chroot directory on some operat‐
239 ing systems (see sftp-server(8) for details).
240
241 For safety, it is very important that the directory hierarchy be
242 prevented from modification by other processes on the system
243 (especially those outside the jail). Misconfiguration can lead
244 to unsafe environments which sshd(8) cannot detect.
245
246 The default is none, indicating not to chroot(2).
247
248 Ciphers
249 The default is handled system-wide by crypto-policies(7). To see
250 the defaults and how to modify this default, see manual page
251 update-crypto-policies(8).
252
253 Specifies the ciphers allowed. Multiple ciphers must be comma-
254 separated. If the specified list begins with a ‘+’ character,
255 then the specified ciphers will be appended to the built-in
256 default set instead of replacing them. If the specified list
257 begins with a ‘-’ character, then the specified ciphers (includ‐
258 ing wildcards) will be removed from the built-in default set
259 instead of replacing them. If the specified list begins with a
260 ‘^’ character, then the specified ciphers will be placed at the
261 head of the built-in default set.
262
263 The supported ciphers are:
264
265 3des-cbc
266 aes128-cbc
267 aes192-cbc
268 aes256-cbc
269 aes128-ctr
270 aes192-ctr
271 aes256-ctr
272 aes128-gcm@openssh.com
273 aes256-gcm@openssh.com
274 chacha20-poly1305@openssh.com
275
276 The list of available ciphers may also be obtained using "ssh -Q
277 cipher".
278
279 ClientAliveCountMax
280 Sets the number of client alive messages which may be sent with‐
281 out sshd(8) receiving any messages back from the client. If this
282 threshold is reached while client alive messages are being sent,
283 sshd will disconnect the client, terminating the session. It is
284 important to note that the use of client alive messages is very
285 different from TCPKeepAlive. The client alive messages are sent
286 through the encrypted channel and therefore will not be spoofa‐
287 ble. The TCP keepalive option enabled by TCPKeepAlive is spoofa‐
288 ble. The client alive mechanism is valuable when the client or
289 server depend on knowing when a connection has become unrespon‐
290 sive.
291
292 The default value is 3. If ClientAliveInterval is set to 15, and
293 ClientAliveCountMax is left at the default, unresponsive SSH
294 clients will be disconnected after approximately 45 seconds.
295 Setting a zero ClientAliveCountMax disables connection termina‐
296 tion.
297
298 ClientAliveInterval
299 Sets a timeout interval in seconds after which if no data has
300 been received from the client, sshd(8) will send a message
301 through the encrypted channel to request a response from the
302 client. The default is 0, indicating that these messages will
303 not be sent to the client.
304
305 Compression
306 Specifies whether compression is enabled after the user has
307 authenticated successfully. The argument must be yes, delayed (a
308 legacy synonym for yes) or no. The default is yes.
309
310 DenyGroups
311 This keyword can be followed by a list of group name patterns,
312 separated by spaces. Login is disallowed for users whose primary
313 group or supplementary group list matches one of the patterns.
314 Only group names are valid; a numerical group ID is not recog‐
315 nized. By default, login is allowed for all groups. The
316 allow/deny groups directives are processed in the following
317 order: DenyGroups, AllowGroups.
318
319 See PATTERNS in ssh_config(5) for more information on patterns.
320
321 DenyUsers
322 This keyword can be followed by a list of user name patterns,
323 separated by spaces. Login is disallowed for user names that
324 match one of the patterns. Only user names are valid; a numeri‐
325 cal user ID is not recognized. By default, login is allowed for
326 all users. If the pattern takes the form USER@HOST then USER and
327 HOST are separately checked, restricting logins to particular
328 users from particular hosts. HOST criteria may additionally con‐
329 tain addresses to match in CIDR address/masklen format. The
330 allow/deny users directives are processed in the following order:
331 DenyUsers, AllowUsers.
332
333 See PATTERNS in ssh_config(5) for more information on patterns.
334
335 DisableForwarding
336 Disables all forwarding features, including X11, ssh-agent(1),
337 TCP and StreamLocal. This option overrides all other forwarding-
338 related options and may simplify restricted configurations.
339
340 ExposeAuthInfo
341 Writes a temporary file containing a list of authentication meth‐
342 ods and public credentials (e.g. keys) used to authenticate the
343 user. The location of the file is exposed to the user session
344 through the SSH_USER_AUTH environment variable. The default is
345 no.
346
347 FingerprintHash
348 Specifies the hash algorithm used when logging key fingerprints.
349 Valid options are: md5 and sha256. The default is sha256.
350
351 ForceCommand
352 Forces the execution of the command specified by ForceCommand,
353 ignoring any command supplied by the client and ~/.ssh/rc if
354 present. The command is invoked by using the user's login shell
355 with the -c option. This applies to shell, command, or subsystem
356 execution. It is most useful inside a Match block. The command
357 originally supplied by the client is available in the
358 SSH_ORIGINAL_COMMAND environment variable. Specifying a command
359 of internal-sftp will force the use of an in-process SFTP server
360 that requires no support files when used with ChrootDirectory.
361 The default is none.
362
363 GatewayPorts
364 Specifies whether remote hosts are allowed to connect to ports
365 forwarded for the client. By default, sshd(8) binds remote port
366 forwardings to the loopback address. This prevents other remote
367 hosts from connecting to forwarded ports. GatewayPorts can be
368 used to specify that sshd should allow remote port forwardings to
369 bind to non-loopback addresses, thus allowing other hosts to con‐
370 nect. The argument may be no to force remote port forwardings to
371 be available to the local host only, yes to force remote port
372 forwardings to bind to the wildcard address, or clientspecified
373 to allow the client to select the address to which the forwarding
374 is bound. The default is no.
375
376 GSSAPIAuthentication
377 Specifies whether user authentication based on GSSAPI is allowed.
378 The default is no.
379
380 GSSAPICleanupCredentials
381 Specifies whether to automatically destroy the user's credentials
382 cache on logout. The default is yes.
383
384 GSSAPIEnablek5users
385 Specifies whether to look at .k5users file for GSSAPI authentica‐
386 tion access control. Further details are described in ksu(1).
387 The default is no.
388
389 GSSAPIKeyExchange
390 Specifies whether key exchange based on GSSAPI is allowed. GSSAPI
391 key exchange doesn't rely on ssh keys to verify host identity.
392 The default is no.
393
394 GSSAPIStrictAcceptorCheck
395 Determines whether to be strict about the identity of the GSSAPI
396 acceptor a client authenticates against. If set to yes then the
397 client must authenticate against the host service on the current
398 hostname. If set to no then the client may authenticate against
399 any service key stored in the machine's default store. This
400 facility is provided to assist with operation on multi homed
401 machines. The default is yes.
402
403 GSSAPIStoreCredentialsOnRekey
404 Controls whether the user's GSSAPI credentials should be updated
405 following a successful connection rekeying. This option can be
406 used to accepted renewed or updated credentials from a compatible
407 client. The default is “no”.
408
409 For this to work GSSAPIKeyExchange needs to be enabled in the
410 server and also used by the client.
411
412 GSSAPIKexAlgorithms
413 The default is handled system-wide by crypto-policies(7). To see
414 the defaults and how to modify this default, see manual page
415 update-crypto-policies(8).
416
417 The list of key exchange algorithms that are accepted by GSSAPI
418 key exchange. Possible values are
419
420 gss-gex-sha1-
421 gss-group1-sha1-
422 gss-group14-sha1-
423 gss-group14-sha256-
424 gss-group16-sha512-
425 gss-nistp256-sha256-
426 gss-curve25519-sha256-
427 This option only applies to connections using GSSAPI.
428
429 HostbasedAcceptedKeyTypes
430 Specifies the key types that will be accepted for hostbased
431 authentication as a list of comma-separated patterns. Alter‐
432 nately if the specified list begins with a ‘+’ character, then
433 the specified key types will be appended to the default set
434 instead of replacing them. If the specified list begins with a
435 ‘-’ character, then the specified key types (including wildcards)
436 will be removed from the default set instead of replacing them.
437 If the specified list begins with a ‘^’ character, then the spec‐
438 ified key types will be placed at the head of the default set.
439 The default for this option is:
440
441 ecdsa-sha2-nistp256-cert-v01@openssh.com,
442 ecdsa-sha2-nistp384-cert-v01@openssh.com,
443 ecdsa-sha2-nistp521-cert-v01@openssh.com,
444 sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
445 ssh-ed25519-cert-v01@openssh.com,
446 sk-ssh-ed25519-cert-v01@openssh.com,
447 rsa-sha2-512-cert-v01@openssh.com,
448 rsa-sha2-256-cert-v01@openssh.com,
449 ssh-rsa-cert-v01@openssh.com,
450 ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
451 sk-ecdsa-sha2-nistp256@openssh.com,
452 ssh-ed25519,sk-ssh-ed25519@openssh.com,
453 rsa-sha2-512,rsa-sha2-256,ssh-rsa
454
455 The list of available key types may also be obtained using "ssh
456 -Q HostbasedAcceptedKeyTypes".
457
458 HostbasedAuthentication
459 Specifies whether rhosts or /etc/hosts.equiv authentication
460 together with successful public key client host authentication is
461 allowed (host-based authentication). The default is no.
462
463 HostbasedUsesNameFromPacketOnly
464 Specifies whether or not the server will attempt to perform a
465 reverse name lookup when matching the name in the ~/.shosts,
466 ~/.rhosts, and /etc/hosts.equiv files during
467 HostbasedAuthentication. A setting of yes means that sshd(8)
468 uses the name supplied by the client rather than attempting to
469 resolve the name from the TCP connection itself. The default is
470 no.
471
472 HostCertificate
473 Specifies a file containing a public host certificate. The cer‐
474 tificate's public key must match a private host key already spec‐
475 ified by HostKey. The default behaviour of sshd(8) is not to
476 load any certificates.
477
478 HostKey
479 Specifies a file containing a private host key used by SSH. The
480 defaults are /etc/ssh/ssh_host_ecdsa_key,
481 /etc/ssh/ssh_host_ed25519_key and /etc/ssh/ssh_host_rsa_key.
482
483 Note that sshd(8) will refuse to use a file if it is group/world-
484 accessible and that the HostKeyAlgorithms option restricts which
485 of the keys are actually used by sshd(8).
486
487 It is possible to have multiple host key files. It is also pos‐
488 sible to specify public host key files instead. In this case
489 operations on the private key will be delegated to an
490 ssh-agent(1).
491
492 HostKeyAgent
493 Identifies the UNIX-domain socket used to communicate with an
494 agent that has access to the private host keys. If the string
495 "SSH_AUTH_SOCK" is specified, the location of the socket will be
496 read from the SSH_AUTH_SOCK environment variable.
497
498 HostKeyAlgorithms
499 The default is handled system-wide by crypto-policies(7). To see
500 the defaults and how to modify this default, see manual page
501 update-crypto-policies(8).
502
503 Specifies the host key algorithms that the server offers. The
504 list of available key types may also be obtained using "ssh -Q
505 HostKeyAlgorithms".
506
507 IgnoreRhosts
508 Specifies that .rhosts and .shosts files will not be used in
509 HostbasedAuthentication.
510
511 /etc/hosts.equiv and /etc/ssh/shosts.equiv are still used. The
512 default is yes.
513
514 IgnoreUserKnownHosts
515 Specifies whether sshd(8) should ignore the user's
516 ~/.ssh/known_hosts during HostbasedAuthentication and use only
517 the system-wide known hosts file /etc/ssh/known_hosts. The
518 default is “no”.
519
520 Include
521 Include the specified configuration file(s). Multiple pathnames
522 may be specified and each pathname may contain glob(7) wildcards.
523 Files without absolute paths are assumed to be in /etc/ssh. An
524 Include directive may appear inside a Match block to perform con‐
525 ditional inclusion.
526
527 IPQoS Specifies the IPv4 type-of-service or DSCP class for the connec‐
528 tion. Accepted values are af11, af12, af13, af21, af22, af23,
529 af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5,
530 cs6, cs7, ef, le, lowdelay, throughput, reliability, a numeric
531 value, or none to use the operating system default. This option
532 may take one or two arguments, separated by whitespace. If one
533 argument is specified, it is used as the packet class uncondi‐
534 tionally. If two values are specified, the first is automati‐
535 cally selected for interactive sessions and the second for non-
536 interactive sessions. The default is af21 (Low-Latency Data) for
537 interactive sessions and cs1 (Lower Effort) for non-interactive
538 sessions.
539
540 KbdInteractiveAuthentication
541 Specifies whether to allow keyboard-interactive authentication.
542 The argument to this keyword must be yes or no. The default is
543 to use whatever value ChallengeResponseAuthentication is set to
544 (by default yes).
545
546 KerberosAuthentication
547 Specifies whether the password provided by the user for
548 PasswordAuthentication will be validated through the Kerberos
549 KDC. To use this option, the server needs a Kerberos servtab
550 which allows the verification of the KDC's identity. The default
551 is no.
552
553 KerberosGetAFSToken
554 If AFS is active and the user has a Kerberos 5 TGT, attempt to
555 acquire an AFS token before accessing the user's home directory.
556 The default is no.
557
558 KerberosOrLocalPasswd
559 If password authentication through Kerberos fails then the pass‐
560 word will be validated via any additional local mechanism such as
561 /etc/passwd. The default is yes.
562
563 KerberosTicketCleanup
564 Specifies whether to automatically destroy the user's ticket
565 cache file on logout. The default is yes.
566
567 KerberosUniqueCCache
568 Specifies whether to store the acquired tickets in the per-ses‐
569 sion credential cache under /tmp/ or whether to use per-user cre‐
570 dential cache as configured in /etc/krb5.conf. The default value
571 no can lead to overwriting previous tickets by subseqent connec‐
572 tions to the same user account.
573
574 KerberosUseKuserok
575 Specifies whether to look at .k5login file for user's aliases.
576 The default is yes.
577
578 KexAlgorithms
579 The default is handled system-wide by crypto-policies(7). To see
580 the defaults and how to modify this default, see manual page
581 update-crypto-policies(8).
582
583 Specifies the available KEX (Key Exchange) algorithms. Multiple
584 algorithms must be comma-separated. Alternately if the specified
585 list begins with a ‘+’ character, then the specified methods will
586 be appended to the built-in default set instead of replacing
587 them. If the specified list begins with a ‘-’ character, then
588 the specified methods (including wildcards) will be removed from
589 the built-in default set instead of replacing them. If the spec‐
590 ified list begins with a ‘^’ character, then the specified meth‐
591 ods will be placed at the head of the built-in default set. The
592 supported algorithms are:
593
594 curve25519-sha256
595 curve25519-sha256@libssh.org
596 diffie-hellman-group1-sha1
597 diffie-hellman-group14-sha1
598 diffie-hellman-group14-sha256
599 diffie-hellman-group16-sha512
600 diffie-hellman-group18-sha512
601 diffie-hellman-group-exchange-sha1
602 diffie-hellman-group-exchange-sha256
603 ecdh-sha2-nistp256
604 ecdh-sha2-nistp384
605 ecdh-sha2-nistp521
606 sntrup4591761x25519-sha512@tinyssh.org
607
608 The list of available key exchange algorithms may also be
609 obtained using "ssh -Q KexAlgorithms".
610
611 ListenAddress
612 Specifies the local addresses sshd(8) should listen on. The fol‐
613 lowing forms may be used:
614
615 ListenAddress hostname|address [rdomain domain]
616 ListenAddress hostname:port [rdomain domain]
617 ListenAddress IPv4_address:port [rdomain domain]
618 ListenAddress [hostname|address]:port [rdomain domain]
619
620 The optional rdomain qualifier requests sshd(8) listen in an
621 explicit routing domain. If port is not specified, sshd will
622 listen on the address and all Port options specified. The
623 default is to listen on all local addresses on the current
624 default routing domain. Multiple ListenAddress options are per‐
625 mitted. For more information on routing domains, see rdomain(4).
626
627 LoginGraceTime
628 The server disconnects after this time if the user has not suc‐
629 cessfully logged in. If the value is 0, there is no time limit.
630 The default is 120 seconds.
631
632 LogLevel
633 Gives the verbosity level that is used when logging messages from
634 sshd(8). The possible values are: QUIET, FATAL, ERROR, INFO,
635 VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
636 DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify
637 higher levels of debugging output. Logging with a DEBUG level
638 violates the privacy of users and is not recommended.
639
640 MACs The default is handled system-wide by crypto-policies(7). To see
641 the defaults and how to modify this default, see manual page
642 update-crypto-policies(8).
643
644 Specifies the available MAC (message authentication code) algo‐
645 rithms. The MAC algorithm is used for data integrity protection.
646 Multiple algorithms must be comma-separated. If the specified
647 list begins with a ‘+’ character, then the specified algorithms
648 will be appended to the built-in default set instead of replacing
649 them. If the specified list begins with a ‘-’ character, then
650 the specified algorithms (including wildcards) will be removed
651 from the built-in default set instead of replacing them. If the
652 specified list begins with a ‘^’ character, then the specified
653 algorithms will be placed at the head of the built-in default
654 set.
655
656 The algorithms that contain "-etm" calculate the MAC after
657 encryption (encrypt-then-mac). These are considered safer and
658 their use recommended. The supported MACs are:
659
660 hmac-md5
661 hmac-md5-96
662 hmac-sha1
663 hmac-sha1-96
664 hmac-sha2-256
665 hmac-sha2-512
666 umac-64@openssh.com
667 umac-128@openssh.com
668 hmac-md5-etm@openssh.com
669 hmac-md5-96-etm@openssh.com
670 hmac-sha1-etm@openssh.com
671 hmac-sha1-96-etm@openssh.com
672 hmac-sha2-256-etm@openssh.com
673 hmac-sha2-512-etm@openssh.com
674 umac-64-etm@openssh.com
675 umac-128-etm@openssh.com
676
677 The list of available MAC algorithms may also be obtained using
678 "ssh -Q mac".
679
680 Match Introduces a conditional block. If all of the criteria on the
681 Match line are satisfied, the keywords on the following lines
682 override those set in the global section of the config file,
683 until either another Match line or the end of the file. If a
684 keyword appears in multiple Match blocks that are satisfied, only
685 the first instance of the keyword is applied.
686
687 The arguments to Match are one or more criteria-pattern pairs or
688 the single token All which matches all criteria. The available
689 criteria are User, Group, Host, LocalAddress, LocalPort, RDomain,
690 and Address (with RDomain representing the rdomain(4) on which
691 the connection was received).
692
693 The match patterns may consist of single entries or comma-sepa‐
694 rated lists and may use the wildcard and negation operators
695 described in the PATTERNS section of ssh_config(5).
696
697 The patterns in an Address criteria may additionally contain
698 addresses to match in CIDR address/masklen format, such as
699 192.0.2.0/24 or 2001:db8::/32. Note that the mask length pro‐
700 vided must be consistent with the address - it is an error to
701 specify a mask length that is too long for the address or one
702 with bits set in this host portion of the address. For example,
703 192.0.2.0/33 and 192.0.2.0/8, respectively.
704
705 Only a subset of keywords may be used on the lines following a
706 Match keyword. Available keywords are AcceptEnv,
707 AllowAgentForwarding, AllowGroups, AllowStreamLocalForwarding,
708 AllowTcpForwarding, AllowUsers, AuthenticationMethods,
709 AuthorizedKeysCommand, AuthorizedKeysCommandUser,
710 AuthorizedKeysFile, AuthorizedPrincipalsCommand,
711 AuthorizedPrincipalsCommandUser, AuthorizedPrincipalsFile,
712 Banner, ChrootDirectory, ClientAliveCountMax,
713 ClientAliveInterval, DenyGroups, DenyUsers, ForceCommand,
714 GatewayPorts, GSSAPIAuthentication, HostbasedAcceptedKeyTypes,
715 HostbasedAuthentication, HostbasedUsesNameFromPacketOnly,
716 Include, IPQoS, KbdInteractiveAuthentication,
717 KerberosAuthentication, KerberosUseKuserok, LogLevel,
718 MaxAuthTries, MaxSessions, PasswordAuthentication,
719 PermitEmptyPasswords, PermitListen, PermitOpen, PermitRootLogin,
720 PermitTTY, PermitTunnel, PermitUserRC, PubkeyAcceptedKeyTypes,
721 PubkeyAuthentication, RekeyLimit, RevokedKeys, RDomain, SetEnv,
722 StreamLocalBindMask, StreamLocalBindUnlink, TrustedUserCAKeys,
723 X11DisplayOffset, X11MaxDisplays, X11Forwarding and
724 X11UseLocalhost.
725
726 MaxAuthTries
727 Specifies the maximum number of authentication attempts permitted
728 per connection. Once the number of failures reaches half this
729 value, additional failures are logged. The default is 6.
730
731 MaxSessions
732 Specifies the maximum number of open shell, login or subsystem
733 (e.g. sftp) sessions permitted per network connection. Multiple
734 sessions may be established by clients that support connection
735 multiplexing. Setting MaxSessions to 1 will effectively disable
736 session multiplexing, whereas setting it to 0 will prevent all
737 shell, login and subsystem sessions while still permitting for‐
738 warding. The default is 10.
739
740 MaxStartups
741 Specifies the maximum number of concurrent unauthenticated con‐
742 nections to the SSH daemon. Additional connections will be
743 dropped until authentication succeeds or the LoginGraceTime
744 expires for a connection. The default is 10:30:100.
745
746 Alternatively, random early drop can be enabled by specifying the
747 three colon separated values start:rate:full (e.g. "10:30:60").
748 sshd(8) will refuse connection attempts with a probability of
749 rate/100 (30%) if there are currently start (10) unauthenticated
750 connections. The probability increases linearly and all connec‐
751 tion attempts are refused if the number of unauthenticated con‐
752 nections reaches full (60).
753
754 PasswordAuthentication
755 Specifies whether password authentication is allowed. The
756 default is yes.
757
758 PermitEmptyPasswords
759 When password authentication is allowed, it specifies whether the
760 server allows login to accounts with empty password strings. The
761 default is no.
762
763 PermitListen
764 Specifies the addresses/ports on which a remote TCP port forward‐
765 ing may listen. The listen specification must be one of the fol‐
766 lowing forms:
767
768 PermitListen port
769 PermitListen host:port
770
771 Multiple permissions may be specified by separating them with
772 whitespace. An argument of any can be used to remove all
773 restrictions and permit any listen requests. An argument of none
774 can be used to prohibit all listen requests. The host name may
775 contain wildcards as described in the PATTERNS section in
776 ssh_config(5). The wildcard ‘*’ can also be used in place of a
777 port number to allow all ports. By default all port forwarding
778 listen requests are permitted. Note that the GatewayPorts option
779 may further restrict which addresses may be listened on. Note
780 also that ssh(1) will request a listen host of “localhost” if no
781 listen host was specifically requested, and this name is treated
782 differently to explicit localhost addresses of “127.0.0.1” and
783 “::1”.
784
785 PermitOpen
786 Specifies the destinations to which TCP port forwarding is per‐
787 mitted. The forwarding specification must be one of the follow‐
788 ing forms:
789
790 PermitOpen host:port
791 PermitOpen IPv4_addr:port
792 PermitOpen [IPv6_addr]:port
793
794 Multiple forwards may be specified by separating them with white‐
795 space. An argument of any can be used to remove all restrictions
796 and permit any forwarding requests. An argument of none can be
797 used to prohibit all forwarding requests. The wildcard ‘*’ can
798 be used for host or port to allow all hosts or ports respec‐
799 tively. Otherwise, no pattern matching or address lookups are
800 performed on supplied names. By default all port forwarding
801 requests are permitted.
802
803 PermitRootLogin
804 Specifies whether root can log in using ssh(1). The argument
805 must be yes, prohibit-password, forced-commands-only, or no. The
806 default is prohibit-password.
807
808 If this option is set to prohibit-password (or its deprecated
809 alias, without-password), password and keyboard-interactive
810 authentication are disabled for root.
811
812 If this option is set to forced-commands-only, root login with
813 public key authentication will be allowed, but only if the
814 command option has been specified (which may be useful for taking
815 remote backups even if root login is normally not allowed). All
816 other authentication methods are disabled for root.
817
818 If this option is set to no, root is not allowed to log in.
819
820 PermitTTY
821 Specifies whether pty(4) allocation is permitted. The default is
822 yes.
823
824 PermitTunnel
825 Specifies whether tun(4) device forwarding is allowed. The argu‐
826 ment must be yes, point-to-point (layer 3), ethernet (layer 2),
827 or no. Specifying yes permits both point-to-point and ethernet.
828 The default is no.
829
830 Independent of this setting, the permissions of the selected
831 tun(4) device must allow access to the user.
832
833 PermitUserEnvironment
834 Specifies whether ~/.ssh/environment and environment= options in
835 ~/.ssh/authorized_keys are processed by sshd(8). Valid options
836 are yes, no or a pattern-list specifying which environment vari‐
837 able names to accept (for example "LANG,LC_*"). The default is
838 no. Enabling environment processing may enable users to bypass
839 access restrictions in some configurations using mechanisms such
840 as LD_PRELOAD.
841
842 PermitUserRC
843 Specifies whether any ~/.ssh/rc file is executed. The default is
844 yes.
845
846 PidFile
847 Specifies the file that contains the process ID of the SSH dae‐
848 mon, or none to not write one. The default is /var/run/sshd.pid.
849
850 Port Specifies the port number that sshd(8) listens on. The default
851 is 22. Multiple options of this type are permitted. See also
852 ListenAddress.
853
854 PrintLastLog
855 Specifies whether sshd(8) should print the date and time of the
856 last user login when a user logs in interactively. The default
857 is yes.
858
859 PrintMotd
860 Specifies whether sshd(8) should print /etc/motd when a user logs
861 in interactively. (On some systems it is also printed by the
862 shell, /etc/profile, or equivalent.) The default is yes.
863
864 PubkeyAcceptedKeyTypes
865 The default is handled system-wide by crypto-policies(7). To see
866 the defaults and how to modify this default, see manual page
867 update-crypto-policies(8).
868
869 Specifies the key types that will be accepted for public key
870 authentication as a list of comma-separated patterns. Alter‐
871 nately if the specified list begins with a ‘+’ character, then
872 the specified key types will be appended to the built-in default
873 set instead of replacing them. If the specified list begins with
874 a ‘-’ character, then the specified key types (including wild‐
875 cards) will be removed from the built-in default set instead of
876 replacing them. If the specified list begins with a ‘^’ charac‐
877 ter, then the specified key types will be placed at the head of
878 the built-in default set.
879
880 The list of available key types may also be obtained using "ssh
881 -Q PubkeyAcceptedKeyTypes".
882
883 PubkeyAuthOptions
884 Sets one or more public key authentication options. Two option
885 keywords are currently supported: none (the default; indicating
886 no additional options are enabled) and touch-required.
887
888 The touch-required option causes public key authentication using
889 a FIDO authenticator algorithm (i.e. ecdsa-sk or ed25519-sk) to
890 always require the signature to attest that a physically present
891 user explicitly confirmed the authentication (usually by touching
892 the authenticator). By default, sshd(8) requires user presence
893 unless overridden with an authorized_keys option. The
894 touch-required flag disables this override. This option has no
895 effect for other, non-authenticator public key types.
896
897 PubkeyAuthentication
898 Specifies whether public key authentication is allowed. The
899 default is yes.
900
901 RekeyLimit
902 Specifies the maximum amount of data that may be transmitted
903 before the session key is renegotiated, optionally followed a
904 maximum amount of time that may pass before the session key is
905 renegotiated. The first argument is specified in bytes and may
906 have a suffix of ‘K’, ‘M’, or ‘G’ to indicate Kilobytes,
907 Megabytes, or Gigabytes, respectively. The default is between
908 ‘1G’ and ‘4G’, depending on the cipher. The optional second
909 value is specified in seconds and may use any of the units docu‐
910 mented in the TIME FORMATS section. The default value for
911 RekeyLimit is default none, which means that rekeying is per‐
912 formed after the cipher's default amount of data has been sent or
913 received and no time based rekeying is done.
914
915 RevokedKeys
916 Specifies revoked public keys file, or none to not use one. Keys
917 listed in this file will be refused for public key authentica‐
918 tion. Note that if this file is not readable, then public key
919 authentication will be refused for all users. Keys may be speci‐
920 fied as a text file, listing one public key per line, or as an
921 OpenSSH Key Revocation List (KRL) as generated by ssh-keygen(1).
922 For more information on KRLs, see the KEY REVOCATION LISTS sec‐
923 tion in ssh-keygen(1).
924
925 RDomain
926 Specifies an explicit routing domain that is applied after
927 authentication has completed. The user session, as well and any
928 forwarded or listening IP sockets, will be bound to this
929 rdomain(4). If the routing domain is set to %D, then the domain
930 in which the incoming connection was received will be applied.
931
932 SecurityKeyProvider
933 Specifies a path to a library that will be used when loading FIDO
934 authenticator-hosted keys, overriding the default of using the
935 built-in USB HID support.
936
937 SetEnv Specifies one or more environment variables to set in child ses‐
938 sions started by sshd(8) as “NAME=VALUE”. The environment value
939 may be quoted (e.g. if it contains whitespace characters). Envi‐
940 ronment variables set by SetEnv override the default environment
941 and any variables specified by the user via AcceptEnv or
942 PermitUserEnvironment.
943
944 StreamLocalBindMask
945 Sets the octal file creation mode mask (umask) used when creating
946 a Unix-domain socket file for local or remote port forwarding.
947 This option is only used for port forwarding to a Unix-domain
948 socket file.
949
950 The default value is 0177, which creates a Unix-domain socket
951 file that is readable and writable only by the owner. Note that
952 not all operating systems honor the file mode on Unix-domain
953 socket files.
954
955 StreamLocalBindUnlink
956 Specifies whether to remove an existing Unix-domain socket file
957 for local or remote port forwarding before creating a new one.
958 If the socket file already exists and StreamLocalBindUnlink is
959 not enabled, sshd will be unable to forward the port to the Unix-
960 domain socket file. This option is only used for port forwarding
961 to a Unix-domain socket file.
962
963 The argument must be yes or no. The default is no.
964
965 StrictModes
966 Specifies whether sshd(8) should check file modes and ownership
967 of the user's files and home directory before accepting login.
968 This is normally desirable because novices sometimes accidentally
969 leave their directory or files world-writable. The default is
970 yes. Note that this does not apply to ChrootDirectory, whose
971 permissions and ownership are checked unconditionally.
972
973 Subsystem
974 Configures an external subsystem (e.g. file transfer daemon).
975 Arguments should be a subsystem name and a command (with optional
976 arguments) to execute upon subsystem request.
977
978 The command sftp-server implements the SFTP file transfer subsys‐
979 tem.
980
981 Alternately the name internal-sftp implements an in-process SFTP
982 server. This may simplify configurations using ChrootDirectory
983 to force a different filesystem root on clients.
984
985 By default no subsystems are defined.
986
987 SyslogFacility
988 Gives the facility code that is used when logging messages from
989 sshd(8). The possible values are: DAEMON, USER, AUTH, AUTHPRIV,
990 LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
991 The default is AUTH.
992
993 TCPKeepAlive
994 Specifies whether the system should send TCP keepalive messages
995 to the other side. If they are sent, death of the connection or
996 crash of one of the machines will be properly noticed. However,
997 this means that connections will die if the route is down tempo‐
998 rarily, and some people find it annoying. On the other hand, if
999 TCP keepalives are not sent, sessions may hang indefinitely on
1000 the server, leaving "ghost" users and consuming server resources.
1001
1002 The default is yes (to send TCP keepalive messages), and the
1003 server will notice if the network goes down or the client host
1004 crashes. This avoids infinitely hanging sessions.
1005
1006 To disable TCP keepalive messages, the value should be set to no.
1007
1008 TrustedUserCAKeys
1009 Specifies a file containing public keys of certificate authori‐
1010 ties that are trusted to sign user certificates for authentica‐
1011 tion, or none to not use one. Keys are listed one per line;
1012 empty lines and comments starting with ‘#’ are allowed. If a
1013 certificate is presented for authentication and has its signing
1014 CA key listed in this file, then it may be used for authentica‐
1015 tion for any user listed in the certificate's principals list.
1016 Note that certificates that lack a list of principals will not be
1017 permitted for authentication using TrustedUserCAKeys. For more
1018 details on certificates, see the CERTIFICATES section in
1019 ssh-keygen(1).
1020
1021 UseDNS Specifies whether sshd(8) should look up the remote host name,
1022 and to check that the resolved host name for the remote IP
1023 address maps back to the very same IP address.
1024
1025 If this option is set to no (the default) then only addresses and
1026 not host names may be used in ~/.ssh/authorized_keys from and
1027 sshd_config Match Host directives.
1028
1029 UsePAM Enables the Pluggable Authentication Module interface. If set to
1030 yes this will enable PAM authentication using
1031 ChallengeResponseAuthentication and PasswordAuthentication in
1032 addition to PAM account and session module processing for all
1033 authentication types.
1034
1035 Because PAM challenge-response authentication usually serves an
1036 equivalent role to password authentication, you should disable
1037 either PasswordAuthentication or ChallengeResponseAuthentication.
1038
1039 If UsePAM is enabled, you will not be able to run sshd(8) as a
1040 non-root user. The default is no.
1041
1042 VersionAddendum
1043 Optionally specifies additional text to append to the SSH proto‐
1044 col banner sent by the server upon connection. The default is
1045 none.
1046
1047 X11DisplayOffset
1048 Specifies the first display number available for sshd(8)'s X11
1049 forwarding. This prevents sshd from interfering with real X11
1050 servers. The default is 10.
1051
1052 X11MaxDisplays
1053 Specifies the maximum number of displays available for sshd(8)'s
1054 X11 forwarding. This prevents sshd from exhausting local ports.
1055 The default is 1000.
1056
1057 X11Forwarding
1058 Specifies whether X11 forwarding is permitted. The argument must
1059 be yes or no. The default is no.
1060
1061 When X11 forwarding is enabled, there may be additional exposure
1062 to the server and to client displays if the sshd(8) proxy display
1063 is configured to listen on the wildcard address (see
1064 X11UseLocalhost), though this is not the default. Additionally,
1065 the authentication spoofing and authentication data verification
1066 and substitution occur on the client side. The security risk of
1067 using X11 forwarding is that the client's X11 display server may
1068 be exposed to attack when the SSH client requests forwarding (see
1069 the warnings for ForwardX11 in ssh_config(5)). A system adminis‐
1070 trator may have a stance in which they want to protect clients
1071 that may expose themselves to attack by unwittingly requesting
1072 X11 forwarding, which can warrant a no setting.
1073
1074 Note that disabling X11 forwarding does not prevent users from
1075 forwarding X11 traffic, as users can always install their own
1076 forwarders.
1077
1078 X11UseLocalhost
1079 Specifies whether sshd(8) should bind the X11 forwarding server
1080 to the loopback address or to the wildcard address. By default,
1081 sshd binds the forwarding server to the loopback address and sets
1082 the hostname part of the DISPLAY environment variable to
1083 localhost. This prevents remote hosts from connecting to the
1084 proxy display. However, some older X11 clients may not function
1085 with this configuration. X11UseLocalhost may be set to no to
1086 specify that the forwarding server should be bound to the wild‐
1087 card address. The argument must be yes or no. The default is
1088 yes.
1089
1090 XAuthLocation
1091 Specifies the full pathname of the xauth(1) program, or none to
1092 not use one. The default is /usr/bin/xauth.
1093
1095 sshd(8) command-line arguments and configuration file options that spec‐
1096 ify time may be expressed using a sequence of the form: time[qualifier],
1097 where time is a positive integer value and qualifier is one of the fol‐
1098 lowing:
1099
1100 ⟨none⟩ seconds
1101 s | S seconds
1102 m | M minutes
1103 h | H hours
1104 d | D days
1105 w | W weeks
1106
1107 Each member of the sequence is added together to calculate the total time
1108 value.
1109
1110 Time format examples:
1111
1112 600 600 seconds (10 minutes)
1113 10m 10 minutes
1114 1h30m 1 hour 30 minutes (90 minutes)
1115
1117 Arguments to some keywords can make use of tokens, which are expanded at
1118 runtime:
1119
1120 %% A literal ‘%’.
1121 %D The routing domain in which the incoming connection was
1122 received.
1123 %F The fingerprint of the CA key.
1124 %f The fingerprint of the key or certificate.
1125 %h The home directory of the user.
1126 %i The key ID in the certificate.
1127 %K The base64-encoded CA key.
1128 %k The base64-encoded key or certificate for authentication.
1129 %s The serial number of the certificate.
1130 %T The type of the CA key.
1131 %t The key or certificate type.
1132 %U The numeric user ID of the target user.
1133 %u The username.
1134
1135 AuthorizedKeysCommand accepts the tokens %%, %f, %h, %k, %t, %U, and %u.
1136
1137 AuthorizedKeysFile accepts the tokens %%, %h, %U, and %u.
1138
1139 AuthorizedPrincipalsCommand accepts the tokens %%, %F, %f, %h, %i, %K,
1140 %k, %s, %T, %t, %U, and %u.
1141
1142 AuthorizedPrincipalsFile accepts the tokens %%, %h, %U, and %u.
1143
1144 ChrootDirectory accepts the tokens %%, %h, %U, and %u.
1145
1146 RoutingDomain accepts the token %D.
1147
1149 /etc/ssh/sshd_config
1150 Contains configuration data for sshd(8). This file should be
1151 writable by root only, but it is recommended (though not neces‐
1152 sary) that it be world-readable.
1153
1155 sftp-server(8), sshd(8)
1156
1158 OpenSSH is a derivative of the original and free ssh 1.2.12 release by
1159 Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo
1160 de Raadt and Dug Song removed many bugs, re-added newer features and cre‐
1161 ated OpenSSH. Markus Friedl contributed the support for SSH protocol
1162 versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support
1163 for privilege separation.
1164
1165BSD May 10, 2020 BSD