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