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