SSHD_CONFIG(5)

πŸ“¦
version 10.2p1 Β· 6 versions
, in fedora 44

πŸ’– NAME πŸ’–

sshd_config β€” OpenSSH daemon configuration file. And yes bestie, this is page SSHD_CONFIG(5) from the File Formats Manual, we're literally in our terminal glow-up era. πŸ’…


✨ DESCRIPTION ✨

Okay so sshd(8) reads its config data from /etc/gsissh/sshd_config (or whatever file you pass with -f on the command line). The file is just keyword-argument pairs, one per line. Unless it says otherwise, for each keyword, the first obtained value wins β€” first come, first served, no take-backs. Lines starting with # and empty lines? Comments, obviously. And arguments can optionally be wrapped in double quotes (") if they contain spaces, because spaces are messy.

Also hpnsshd(8) is fully compatible with OpenSSH's sshd and uses the same configuration format, directives, and options. hpnsshd(8) can use the same config file as sshd(8), though the inverse is not necessarily true β€” because hpnssh(8) has some extra options that we'll talk about below. So admins, please keep separate config files for each, no cap. πŸ”₯

The possible keywords and their meanings are as follows (note that keywords are case-insensitive and arguments are case-sensitive):

  • AcceptEnv β€” Tells you which environment variables the client sends that get copied into the session's environ(7). Wanna configure the client? Check out SendEnv and SetEnv in ssh_config(5). The TERM variable is always accepted whenever the client asks for a pseudo-terminal, because the protocol literally requires it. Variables are specified by name, and they can have wildcard characters * and ?. You can separate multiple env vars with whitespace or just spread them across multiple AcceptEnv directives. But bestie, be warned: some env vars could be used to bypass restricted user environments, so be careful with this directive, fr. Default? It does not accept any environment variables. πŸ’–
  • AddressFamily β€” Picks which address family sshd(8) should use. Valid arguments: any (the default), inet (IPv4 only), or inet6 (IPv6 only). Slay.
  • AllowAgentForwarding β€” Says whether ssh-agent(1) forwarding is permitted. Default is yes. Note: disabling agent forwarding does not improve security unless users are also denied shell access, because they can always install their own forwarders. So it's giving false sense of security, lowkey.
  • AllowGroups β€” This keyword can be followed by a list of group name patterns, separated by spaces. If you specify it, login is allowed only for users whose primary group or supplementary group list matches one of the patterns. Only group names are valid; a numerical group ID is not recognized. By default, login is allowed for all groups. The allow/deny groups directives are processed in this order: DenyGroups, AllowGroups.

See PATTERNS in ssh_config(5) for more info on patterns. This keyword may appear multiple times in sshd_config, and each instance appends to the list. Obsessed.

  • AllowStreamLocalForwarding β€” Says whether StreamLocal (Unix-domain socket) forwarding is permitted. Options: yes (the default) or all to allow StreamLocal forwarding, no to prevent all StreamLocal forwarding, local to allow local (from the perspective of ssh(1)) forwarding only, or remote to allow remote forwarding only. Note: disabling StreamLocal forwarding does not improve security unless users are also denied shell access, as they can always install their own forwarders. Same vibe as above, bestie.
  • AllowTcpForwarding β€” Says whether TCP forwarding is permitted. Options: yes (the default) or all to allow TCP forwarding, no to prevent all TCP forwarding, local to allow local (from the perspective of ssh(1)) forwarding only, or remote to allow remote forwarding only. Note: disabling TCP forwarding does not improve security unless users are also denied shell access, as they can always install their own forwarders. Periodt.
  • AllowUsers β€” This keyword can be followed by a list of user name patterns, separated by spaces. If specified, login is allowed only for user names that match one of the patterns. Only user names are valid; a numerical user ID is not recognized. By default, login is allowed for all users. If the pattern is USER@HOST, then USER and HOST are separately checked, restricting logins to particular users from particular hosts. HOST criteria may additionally contain addresses to match in CIDR address/masklen format. The allow/deny users directives are processed in this order: DenyUsers, AllowUsers.

See PATTERNS in ssh_config(5) for more info on patterns. This keyword may appear multiple times in sshd_config, and each instance appends to the list. We love a stacking queen. πŸ‘‘

  • AuthenticationMethods β€” Specifies the authentication methods that must be successfully completed for a user to be granted access. This option must be followed by one or more lists of comma-separated authentication method names, or by the single string any to indicate the default behaviour of accepting any single authentication method. If you override the default, then successful authentication requires completion of every method in at least one of these lists.

For example, "publickey,password publickey,keyboard-interactive" would require the user to complete public key authentication, followed by either password or keyboard interactive authentication. Only methods that are next in one or more lists are offered at each stage, so for this example it would not be possible to attempt password or keyboard-interactive authentication before public key. So order matters, bestie.

For keyboard interactive authentication, you can also restrict authentication to a specific device by appending a colon followed by the device identifier bsdauth or pam, depending on the server configuration. For example, "keyboard-interactive:bsdauth" would restrict keyboard interactive authentication to the bsdauth device.

If the publickey method is listed more than once, sshd(8) verifies that keys that have been used successfully are not reused for subsequent authentications. For example, "publickey,publickey" requires successful authentication using two different public keys. No reusing keys, that's not very demure.

Note that each authentication method listed should also be explicitly enabled in the configuration.

The available authentication methods are: "gssapi-with-mic", "hostbased", "keyboard-interactive", "none" (used for access to password-less accounts when PermitEmptyPasswords is enabled), "password" and "publickey". Iconic list, honestly.

  • AuthorizedKeysCommand β€” Specifies a program to look up the user's public keys. The program must be owned by root, not writable by group or others, and specified by an absolute path. Arguments to AuthorizedKeysCommand accept the tokens described in the β€œTOKENS” section. If no arguments are specified, then the username of the target user is used.

The program should produce on standard output zero or more lines of authorized_keys output (see AUTHORIZED_KEYS in sshd(8)). AuthorizedKeysCommand is tried after the usual AuthorizedKeysFile files and will not be executed if a matching key is found there. By default, no AuthorizedKeysCommand is run. So it's a backup plan, lowkey.

  • AuthorizedKeysCommandUser β€” Specifies the user under whose account the AuthorizedKeysCommand is run. It is recommended to use a dedicated user that has no other role on the host than running authorized keys commands. If AuthorizedKeysCommand is specified but AuthorizedKeysCommandUser is not, then sshd(8) will refuse to start. So don't forget this, bestie, or it's a no-go.
  • AuthorizedKeysFile β€” Specifies the file that contains the public keys used for user authentication. The format is described in the AUTHORIZED_KEYS FILE FORMAT section of sshd(8). Arguments to AuthorizedKeysFile may include wildcards and accept the tokens described in the β€œTOKENS” section. After expansion, AuthorizedKeysFile is taken to be an absolute path or one relative to the user's home directory. Multiple files may be listed, separated by whitespace. Alternately, this option may be set to none to skip checking for user keys in files. The default is ".ssh/authorized_keys .ssh/authorized_keys2". Cute default, ngl.
  • AuthorizedPrincipalsCommand β€” Specifies a program to generate the list of allowed certificate principals as per AuthorizedPrincipalsFile. The program must be owned by root, not writable by group or others, and specified by an absolute path. Arguments to AuthorizedPrincipalsCommand accept the tokens described in the β€œTOKENS” section. If no arguments are specified, then the username of the target user is used.

The program should produce on standard output zero or more lines of AuthorizedPrincipalsFile output. If either AuthorizedPrincipalsCommand or AuthorizedPrincipalsFile is specified, then certificates offered by the client for authentication must contain a principal that is listed. By default, no AuthorizedPrincipalsCommand is run. So it's a whole vibe.

  • AuthorizedPrincipalsCommandUser β€” Specifies the user under whose account the AuthorizedPrincipalsCommand is run. It is recommended to use a dedicated user that has no other role on the host than running authorized principals commands. If AuthorizedPrincipalsCommand is specified but AuthorizedPrincipalsCommandUser is not, then sshd(8) will refuse to start. Same energy as before: don't skip this.
  • AuthorizedPrincipalsFile β€” Specifies a file that lists principal names that are accepted for certificate authentication. When using certificates signed by a key listed in TrustedUserCAKeys, this file lists names, one of which must appear in the certificate for it to be accepted for authentication. Names are listed one per line preceded by key options (as described in AUTHORIZED_KEYS FILE FORMAT in sshd(8)). Empty lines and comments starting with # are ignored. So clean.

Okay so back to the wildcards-and-tokens situation for AuthorizedPrincipalsFile ✨ it can take wildcards, and it can take all the tokens from the β€œTOKENS” section (iykyk, we'll get there). Once everything's been expanded, AuthorizedPrincipalsFile gets read as either an absolute path or a path relative to the user's home directory. The default is none, aka no principals file at all β€” and in that case the user's username must show up in the certificate's principals list or the whole thing gets rejected, no exceptions πŸ’…

Heads up bestie: AuthorizedPrincipalsFile only does anything when auth happens through a CA listed in TrustedUserCAKeys. It is not consulted for CAs you trust via ~/.ssh/authorized_keys β€” although the principals= key option does a similar job (peep sshd(8) for the deets).

Whatever's inside the file you name here gets sent to the remote user before authentication is even allowed. If the argument is none, no banner gets displayed. And by default? No banner. Nothing. Silence. πŸ™ˆ


🌈 CASignatureAlgorithms 🌈

The default here is handled system-wide by crypto-policies(7). All the info about what the defaults are, how to change them, and how to customize existing policies with sub-policies lives in update-crypto-policies(8).

This one specifies which algorithms are allowed for signing certificates by certificate authorities (CAs). Here's the vibe:

  • If your list starts with a + character, the algorithms you list get appended to the default set instead of replacing it.
  • If your list starts with a - character, the algorithms you list (wildcards included!) get removed from the default set instead of replacing it.

Certificates signed with any other algorithm? Not accepted for public key or host-based authentication. Periodt. 🚫


πŸ¦‹ ChannelTimeout πŸ¦‹

This one decides whether and how fast sshd(8) should close channels that go inactive. You write timeouts as one or more type=interval pairs, separated by whitespace, where type is either the special keyword global or one of the channel type names from the list below β€” and yeah, it can contain wildcard characters πŸ‘‘

The interval is in seconds, or you can use any of the units documented in the β€œTIME FORMATS” section. Like, session=5m would make interactive sessions dip out after five minutes of nothing happening. And setting a zero value disables the inactivity timeout entirely.

The special timeout global applies to all active channels taken together. Traffic on any active channel resets the timer, but once it expires, all open channels get closed. Lowkey important: this global timeout is not matched by wildcards β€” you have to specify it explicitly.

The channel type names you can use are:

πŸ’œ agent-connection

Open connections to ssh-agent(1).

πŸ’œ direct-tcpip, direct-streamlocal@openssh.com

Open TCP or Unix socket (respectively) connections that were established from an ssh(1) local forwarding β€” so like, LocalForward or DynamicForward.

πŸ’œ forwarded-tcpip, forwarded-streamlocal@openssh.com

Open TCP or Unix socket (respectively) connections established to an sshd(8) listening on behalf of an ssh(1) remote forwarding, i.e. RemoteForward.

πŸ’œ session

The interactive main session β€” shell session, command execution, scp(1), sftp(1), all of it.

πŸ’œ tun-connection

Open TunnelForward connections.

πŸ’œ x11-connection

Open X11 forwarding sessions.

Now the fine print, and it matters:

Terminating an inactive session does not guarantee that all resources tied to that session get cleaned up. Shell processes or X11 clients relating to the session may keep right on executing. 😭

Also β€” killing an inactive channel or session doesn't necessarily close the SSH connection, and it doesn't stop a client from asking for another channel of the same type. Specifically, expiring an inactive forwarding session does not prevent another identical forwarding from being created right after. Sneaky.

The default is not to expire channels of any type for inactivity. Very chill of it.


🧚 ChrootDirectory 🧚

This is the pathname of a directory to chroot(2) to after authentication. At session startup, sshd(8) checks that every single component of that pathname is a root-owned directory that isn't writable by group or others. After the chroot, sshd(8) changes the working directory to the user's home directory. Arguments to ChrootDirectory accept the tokens described in the β€œTOKENS” section.

Your ChrootDirectory has to actually contain the files and directories needed to support the user's session. For an interactive session that means at minimum a shell β€” typically sh(1) β€” plus the basic /dev nodes like null(4), zero(4), stdin(4), stdout(4), stderr(4), and tty(4) devices. For file transfer sessions using SFTP, no extra environment config is needed if the in-process sftp-server is used β€” though sessions that use logging may need /dev/log inside the chroot directory on some operating systems (check sftp-server(8) for that).

🚨 For safety, it is very important that the directory hierarchy can't be modified by other processes on the system β€” especially ones outside the jail. Misconfiguration can lead to unsafe environments that sshd(8) literally cannot detect. Be careful, bestie.

The default is none, which means don't chroot(2) at all.


⭐ Ciphers ⭐

The default here is handled system-wide by crypto-policies(7). Info about the defaults, how to modify them, and how to customize existing policies with sub-policies is all in update-crypto-policies(8).

This specifies which ciphers are allowed. Multiple ciphers go comma-separated. And here's the prefix lore:

  • Starts with + β†’ the ciphers you list get appended to the built-in openssh default set instead of replacing it.
  • Starts with - β†’ the ciphers you list (wildcards included!) get removed from the built-in openssh default set instead of replacing it.
  • Starts with ^ β†’ the ciphers you list get placed at the head of the built-in openssh default set. Main character energy πŸ‘‘

The supported ciphers are:

  • 3des-cbc
  • aes128-cbc
  • aes192-cbc
  • aes256-cbc
  • aes128-ctr
  • aes192-ctr
  • aes256-ctr
  • aes128-gcm@openssh.com
  • aes256-gcm@openssh.com
  • chacha20-poly1305@openssh.com

You can also just ask for the list of available ciphers with "ssh -Q cipher". Handy!


πŸ“ ClientAliveCountMax πŸ“

Sets how many client alive messages can be sent without sshd(8) getting any messages back from the client. If that threshold gets hit while client alive messages are still being sent, sshd disconnects the client and terminates the session. Bye πŸ‘‹

Okay and this is genuinely important: client alive messages are very different from TCPKeepAlive. The client alive messages go through the encrypted channel, so they cannot be spoofed. The TCP keepalive option that TCPKeepAlive turns on can be spoofed. The client alive mechanism is valuable when the client or server depends on knowing when a connection has gone unresponsive.

The default value is 3. So if ClientAliveInterval is set to 15 and ClientAliveCountMax is left at the default, unresponsive SSH clients get disconnected after approximately 45 seconds. And setting a zero ClientAliveCountMax disables connection termination.


🌸 ClientAliveInterval 🌸

Sets a timeout interval in seconds β€” after that much time with no data received from the client, sshd(8) sends a message through the encrypted channel asking the client to respond. The default is 0, which means these messages just... don't get sent. 🀷


πŸ’– Compression πŸ’–

Specifies whether compression is enabled after the user has authenticated successfully. The argument has to be yes, delayed (a legacy synonym for yes), or no. The default is yes.


🫢 DenyGroups 🫢

This keyword can be followed by a list of group name patterns, separated by spaces. Login is disallowed for users whose primary group or supplementary group list matches one of the patterns. Only group names are valid β€” a numerical group ID is not recognized, don't try it. By default, login is allowed for all groups.

The allow/deny groups directives get processed in this order: DenyGroups, AllowGroups.

See PATTERNS in ssh_config(5) for more on patterns. And this keyword can appear multiple times in sshd_config β€” each instance appends to the list. ✨


πŸ‘‘ DenyUsers πŸ‘‘

Same energy, but for users. This keyword can be followed by a list of user name patterns, separated by spaces. Login is disallowed for user names that match one of the patterns. Only user names are valid β€” a numerical user ID is not recognized. By default, login is allowed for all users.

If the pattern takes the form USER@HOST, then USER and HOST are checked separately, which restricts logins to particular users from particular hosts. And HOST criteria can additionally contain addresses to match in CIDR address/masklen format. The allow/deny users directives get processed in this order: DenyUsers, AllowUsers.

See PATTERNS in ssh_config(5) for more on patterns. This keyword can also appear multiple times in sshd_config, each instance appending to the list. πŸ’…


πŸ”₯ DisableForwarding πŸ”₯

Disables all the forwarding features β€” X11, ssh-agent(1), TCP and StreamLocal. This option overrides every other forwarding-related option, and it may simplify restricted configurations. One flag to shut them all down, iconic honestly.

🌸 DisableMTAES

okay so this one switches your encryption cipher from the multithreaded MT-AES-CTR cipher back to the stock single-threaded AES-CTR cipher. Default is no. and yeah, tiny detail: this is HPNSSH only β€” if you're not running HPNSSH this option is literally just vibing there doing nothing πŸ’…


πŸ¦‹ ExposeAuthInfo

writes a temporary file that contains a list of authentication methods and public credentials (like keys, bestie, keys) that were used to authenticate the user. the location of that file gets exposed to the user session through the SSH_USER_AUTH environment variable. The default is no.


⭐ FingerprintHash

says which hash algorithm gets used when logging key fingerprints. Valid options are: md5 and sha256. The default is sha256. no cap, sha256 is the moment ✨


πŸ‘‘ ForceCommand

forces the execution of the command you specify with ForceCommand, and it ignores any command supplied by the client plus ~/.ssh/rc if that's present. The command is invoked by using the user's login shell with the -c option. This applies to shell, command, or subsystem execution. It is most useful inside a Match block. The command that the client originally supplied is available in the SSH_ORIGINAL_COMMAND environment variable. If you specify a command of internal-sftp, that will force the use of an in-process SFTP server that requires no support files when used with ChrootDirectory. The default is none.


🌈 GatewayPorts

specifies whether remote hosts are allowed to connect to ports forwarded for the client. By default, sshd(8) binds remote port forwardings to the loopback address β€” which stops other remote hosts from connecting to forwarded ports. GatewayPorts can be used to specify that sshd should allow remote port forwardings to bind to non-loopback addresses, which then lets other hosts connect. The argument may be:

  • no β€” force remote port forwardings to be available to the local host only
  • yes β€” force remote port forwardings to bind to the wildcard address
  • clientspecified β€” allow the client to select the address to which the forwarding is bound

The default is no.


πŸ’œ GSIAllowLimitedProxy

specifies whether to accept limited proxy credentials for authentication. The default is no.


πŸŽ€ GSSAPIAuthentication

specifies whether user authentication based on GSSAPI is allowed. The default is yes.


✨ GSSAPICleanupCredentials

specifies whether to automatically destroy the user's credentials cache on logout. The default is yes.


πŸ“ GSSAPICredentialsPath

if specified, the delegated GSSAPI credential is stored in the given path, overwriting any existing credentials. Paths can be specified with syntax similar to the AuthorizedKeysFile option (i.e., accepting %h and %u tokens). When you're using this option, setting 'GssapiCleanupCredentials no' is recommended, so that logging out of one session doesn't remove the credentials in use by another session of the same user. Currently only implemented for the GSI mechanism.


🧚 GSSAPIDelegateCredentials

Accept delegated credentials on the server side. The default is


πŸ”₯ GSSAPIEnablek5users

specifies whether to look at the .k5users file for GSSAPI authentication access control. Further details are described in ksu(1). The default is no.


🌸 GSSAPIKeyExchange

specifies whether key exchange based on GSSAPI is allowed. GSSAPI key exchange doesn't rely on ssh keys to verify host identity. The default is yes.


🫢 GSSAPIStrictAcceptorCheck

determines whether to be strict about the identity of the GSSAPI acceptor that a client authenticates against. If set to yes then the client must authenticate against the host service on the current hostname. If set to no then the client may authenticate against any service key stored in the machine's default store. This facility is provided to assist with operation on multi homed machines. The default is yes.


πŸ’– GSSAPIStoreCredentialsOnRekey

controls whether the user's GSSAPI credentials should be updated following a successful connection rekeying. This option can be used to accept renewed or updated credentials from a compatible client. The default is β€œno”.

For this to work GSSAPIKeyExchange needs to be enabled in the server and also used by the client. iykyk πŸ’…


🌟 GSSAPIKexAlgorithms

The default is handled system-wide by crypto-policies(7). Information about defaults, how to modify the defaults and how to customize existing policies with sub-policies are present in manual page update-crypto-policies(8).

The list of key exchange algorithms that are accepted by GSSAPI key exchange. Possible values are

gss-gex-sha1-
gss-group1-sha1-
gss-group14-sha1-
gss-group14-sha256-
gss-group16-sha512-
gss-nistp256-sha256-
gss-curve25519-sha256-

This option only applies to connections using GSSAPI.

The list of supported key exchange algorithms may also be obtained using "ssh -Q GSSAPIKexAlgorithms".


πŸŽ€ GSSAPIIndicators

specifies whether to accept or deny GSSAPI authenticated access if the Kerberos mechanism is used and the Kerberos ticket contains a particular set of authentication indicators. The values can be specified as a comma-separated list [!]name1,[!]name2,.... When an indicator's name is prefixed with !, the authentication indicator name will deny access to the system. Otherwise, one of the non-negated authentication indicators must be present in the Kerberos ticket to allow access. If GSSAPIIndicators is defined, a Kerberos ticket that has indicators but does not match the policy will get denial. If at least one indicator is configured, whether for access or denial, tickets without authentication indicators will be explicitly rejected.

By default systems using MIT Kerberos 1.17 or later will not assign any indicators. SPAKE and PKINIT methods add authentication indicators to all successful authentications. The SPAKE pre-authentication method is preferred over an encrypted timestamp pre-authentication when passwords used to authenticate user principals. Kerberos KDCs built with Heimdal Kerberos (including Samba AD DC built with Heimdal) do not add authentication indicators. However, OpenSSH built against Heimdal Kerberos library is able to inquire authentication indicators and thus can be used to check for their presence.

Indicator name is case-sensitive and depends on the configuration of a particular Kerberos deployment. Indicators available in MIT Kerberos and FreeIPA environments:

  • hardened β€” SPAKE or encrypted timestamp pre-authentication mechanisms in MIT Kerberos and FreeIPA
  • pkinit β€” smartcard or PKCS11 token-based pre-authentication in MIT Kerberos and FreeIPA
  • radius β€” pre-authentication based on a RADIUS server in MIT Kerberos and FreeIPA
  • otp β€” TOTP/HOTP-based two-factor pre-authentication in FreeIPA
  • idp β€” OAuth2-based pre-authentication in FreeIPA using an external identity provider and device authorization grant flow
  • passkey β€” FIDO2-based pre-authentication in FreeIPA, using FIDO2 USB and NFC tokens

The default β€œnone” is to not use GSSAPI authentication indicators for access decisions.


πŸ’… HostbasedAcceptedAlgorithms

The default is handled system-wide by crypto-policies(7). Information about defaults, how to modify the defaults and how to customize existing policies with sub-policies are present in manual page update-crypto-policies(8).

specifies the signature algorithms that will be accepted for hostbased authentication as a list of comma-separated patterns. And bestie, the prefix characters actually do stuff:

  • if the specified list begins with a β€˜+’ character, then the specified signature algorithms will be appended to the built-in openssh default set instead of replacing them.
  • if the specified list begins with a β€˜-’ character, then the specified signature algorithms (including wildcards) will be removed from the built-in openssh default set instead of replacing them.
  • if the specified list begins with a β€˜^’ character, then the specified signature algorithms will be placed at the head of the built-in openssh default set.

The list of available signature algorithms may also be obtained using "ssh -Q HostbasedAcceptedAlgorithms". This was formerly named HostbasedAcceptedKeyTypes. glow-up moment ✨


🌈 HostbasedAuthentication

specifies whether rhosts or /etc/hosts.equiv authentication together with successful public key client host authentication is allowed (host-based authentication). The default is no.


πŸ¦‹ HostbasedUsesNameFromPacketOnly

specifies whether or not the server will attempt to perform a reverse name lookup when matching the name in the ~/.shosts, ~/.rhosts, and /etc/hosts.equiv files during HostbasedAuthentication. A setting of yes means that sshd(8) uses the name supplied by the client rather than attempting to resolve the name from the TCP connection itself. The default is no.


⭐ HostCertificate

specifies a file containing a public host certificate. The certificate's public key must match a private host key already specified by HostKey. The default behaviour of sshd(8) is not to load any certificates.


πŸ‘‘ HostKey

specifies a file containing a private host key used by SSH. The defaults are /etc/gsissh/ssh_host_ecdsa_key, /etc/gsissh/ssh_host_ed25519_key and /etc/gsissh/ssh_host_rsa_key.

note that sshd(8) will refuse to use a file if it is group/world-accessible, and that the HostKeyAlgorithms option restricts which of the keys are actually used by sshd(8). so like, keep your perms tight, bestie, fr fr 😭

It is possible to have multiple host key files. It is also possible to specify public host key files instead. In this case operations on the private key will be delegated to ssh-agent(1). πŸ’–

  • HostKeyAgent β€” this one points at the UNIX-domain socket you use to talk to an agent that has access to the private host keys. And if you set the string "SSH_AUTH_SOCK", then the location of the socket gets read from the SSH_AUTH_SOCK environment variable instead. ✨
  • HostKeyAlgorithms β€” okay so the default here is handled system-wide by crypto-policies(7). All the info about the defaults, how to modify them, and how to customize existing policies with sub-policies lives in the manual page update-crypto-policies(8). 🫢

It specifies the host key signature algorithms that the server offers. The default for this option is: …and then it just stops, bestie πŸ’€ no cap, the value isn't printed here. The list of available signature algorithms may also be obtained using "ssh -Q HostKeyAlgorithms".

  • HPNDisabled β€” so in some situations, like transfers on a local area network, the impact of the HPN code produces a net decrease in performance 😭. In those cases it's helpful to disable the HPN functionality. By default HPNDisabled is set to β€” yep, again, the page just ends there πŸ™ˆ.
  • IgnoreRhosts β€” says whether to ignore per-user .rhosts and .shosts files during HostbasedAuthentication. The system-wide /etc/hosts.equiv and /etc/gsissh/shosts.equiv are still used regardless of this setting, so don't think you're escaping them. πŸ’…

Accepted values are yes (the default) to ignore all per-user files, shosts-only to allow the use of .shosts but to ignore .rhosts, or no to allow both .shosts and rhosts.

  • IgnoreUserKnownHosts β€” says whether sshd(8) should ignore the user's ~/.ssh/known_hosts during HostbasedAuthentication and use only the system-wide known hosts file /etc/gsissh/ssh_known_hosts. The default is β€œno”.
  • Include β€” include the specified configuration file(s)! ✨ Multiple pathnames may be specified, and each pathname may contain glob(7) wildcards that will be expanded and processed in lexical order. Files without absolute paths are assumed to be in /etc/ssh. And yes, an Include directive may appear inside a Match block to perform conditional inclusion. slay.
  • IPQoS β€” specifies the Differentiated Services Field Codepoint (DSCP) value for the connection. Accepted values are af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, ef, le, a numeric value, or none to use the operating system default.

This option may take one or two arguments, separated by whitespace. If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is ef (Expedited Forwarding) for interactive sessions and none (the operating system default) for non-interactive sessions. πŸ¦‹

  • KbdInteractiveAuthentication β€” says whether to allow keyboard-interactive authentication. All authentication styles from login.conf(5) are supported. The default is yes. The argument to this keyword must be yes or no. Oh and heads up: ChallengeResponseAuthentication is a deprecated alias for this. ⭐
  • KerberosAuthentication β€” says whether the password provided by the user for PasswordAuthentication will be validated through the Kerberos KDC. To use this option, the server needs a Kerberos servtab which allows the verification of the KDC's identity. The default is no.
  • KerberosGetAFSToken β€” if AFS is active and the user has a Kerberos 5 TGT, attempt to acquire an AFS token before accessing the user's home directory. The default is no.
  • KerberosOrLocalPasswd β€” if password authentication through Kerberos fails, then the password will be validated via any additional local mechanism such as /etc/passwd. The default is yes. πŸŽ€
  • KerberosTicketCleanup β€” says whether to automatically destroy the user's ticket cache file on logout. The default is yes.
  • KerberosUniqueCCache β€” says whether to store the acquired tickets in the per-session credential cache under /tmp/, or whether to use the per-user credential cache as configured in /etc/krb5.conf. Heads up bestie, the default value no can lead to overwriting previous tickets by subsequent connections to the same user account. 😭
  • KerberosUseKuserok β€” says whether to look at the .k5login file for user's aliases. The default is yes.
  • KexAlgorithms β€” the default is handled system-wide by crypto-policies(7). Information about defaults, how to modify the defaults and how to customize existing policies with sub-policies are present in the manual page update-crypto-policies(8). πŸ’œ

Specifies the permitted KEX (Key Exchange) algorithms that the server will offer to clients. The ordering of this list is not important, because the client specifies the preference order. Multiple algorithms must be comma-separated.

If the specified list begins with a β€˜+’ character, then the specified methods will be appended to the built-in openssh default set instead of replacing them. If the specified list begins with a β€˜-’ character, then the specified algorithms (including wildcards) will be removed from the built-in openssh default set instead of replacing them. If the specified list begins with a β€˜^’ character, then the specified algorithms will be placed at the head of the built-in openssh default set.

The supported algorithms are:

curve25519-sha256
curve25519-sha256@libssh.org
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
mlkem768x25519-sha256
sntrup761x25519-sha512
sntrup761x25519-sha512@openssh.com

The list of supported key exchange algorithms may also be obtained using "ssh -Q KexAlgorithms".

  • ListenAddress β€” specifies the local addresses sshd(8) should listen on. The following forms may be used:
ListenAddress hostname|address [rdomain domain]
ListenAddress hostname:port [rdomain domain]
ListenAddress IPv4_address:port [rdomain domain]
ListenAddress [hostname|address]:port [rdomain domain]

The optional rdomain qualifier requests sshd(8) listen in an explicit routing domain. If port is not specified, sshd will listen on the address and all Port options specified. The default is to listen on all local addresses on the current default routing domain. Multiple ListenAddress options are permitted. For more information on routing domains, see rdomain(4). 🌈

  • LoginGraceTime β€” the server disconnects after this time if the user has not successfully logged in. If the value is 0, there is no time limit. The default is 120 seconds. ⏳
  • LogLevel β€” gives the verbosity level that is used when logging messages from sshd(8). The possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify higher levels of debugging output.
okay so real talk: logging with a DEBUG level violates the privacy of users and is not recommended. 😬 keep that in mind.
  • LogVerbose β€” specify one or more overrides to LogLevel. An override consists of one or more pattern lists that matches the source file, function and line number to force detailed logging for. For example, an override pattern of:
kex.c:*:1000,*:kex_exchange_identification():*,packet.c:*

would enable detailed logging for line 1000 of kex.c, everything in the kex_exchange_identification() function, and all code in the packet.c file. This option is intended for debugging and no overrides are enabled by default. 🧚

  • MACs β€” the default is handled system-wide by crypto-policies(7). Information about defaults, how to modify the defaults and how to customize existing policies with sub-policies are present in the manual page update-crypto-policies(8). ✨

Specifies the available MAC (message authentication code) algorithms. The MAC algorithm is used for data integrity protection. Multiple algorithms must be comma-separated. If the specified list begins with a β€˜+’ character, then the specified algorithms will be appended to the built-in openssh default set instead of replacing them. If the specified list begins with a β€˜-’ character, then the specified algorithms (including wildcards) will be removed from the built-in openssh default set instead of replacing them. If the specified list begins with a β€˜^’ character, then the specified algorithms will be placed at the head of the built-in openssh default set.

The algorithms that contain "-etm" calculate the MAC after encryption (encrypt-then-mac). These are considered safer and their use recommended. πŸ’… The supported MACs are:

hmac-md5
hmac-md5-96
hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
umac-64@openssh.com
umac-128@openssh.com
hmac-md5-etm@openssh.com
hmac-md5-96-etm@openssh.com
hmac-sha1-etm@openssh.com
hmac-sha1-96-etm@openssh.com
hmac-sha2-256-etm@openssh.com
hmac-sha2-512-etm@openssh.com
umac-64-etm@openssh.com
umac-128-etm@openssh.com

The list of available MAC algorithms may also be obtained using "ssh -Q mac". πŸŽ€

  • Match β€” okay bestie, this one opens a conditional block πŸ’…. If literally all the criteria on the Match line are satisfied, then the keywords on the lines after it override whatever was set in the global section of the config file β€” and that stays true until either another Match line shows up or you hit the end of the file. And listen: if the same keyword appears in multiple Match blocks that are all satisfied, only the first instance of that keyword is applied. First come, first served, periodt. πŸ‘‘

The arguments to Match are one or more criteria-pattern pairs, or one of the single token criteria: All, which matches all criteria (slay), or Invalid-User, which matches when the requested user-name does not match any known account. The available criteria are User, Group, Host, LocalAddress, LocalPort, Version, RDomain, and Address (with RDomain representing the rdomain(4) on which the connection was received).

The match patterns may consist of single entries or comma-separated lists, and they may use the wildcard and negation operators described in the β€œPATTERNS” section of ssh_config(5). Go read that section if you need it, iykyk. πŸ¦‹

The patterns in an Address criteria may additionally contain addresses to match in CIDR address/masklen format, such as 192.0.2.0/24 or 2001:db8::/32. Heads up though β€” the mask length you give has to be consistent with the address. It is an error to specify a mask length that is too long for the address, or one with bits set in the host portion of the address. Like, 192.0.2.0/33 and 192.0.2.0/8, respectively. Not those. πŸ™ˆ

The Version keyword matches against the version string of sshd(8), for example β€œOpenSSH_10.0”.

And no, you can't just slap any keyword after Match β€” only a subset is allowed. The available keywords are AcceptEnv, AllowAgentForwarding, AllowGroups, AllowStreamLocalForwarding, AllowTcpForwarding, AllowUsers, AuthenticationMethods, AuthorizedKeysCommand, AuthorizedKeysCommandUser, AuthorizedKeysFile, AuthorizedPrincipalsCommand, AuthorizedPrincipalsCommandUser, AuthorizedPrincipalsFile, Banner, CASignatureAlgorithms, ChannelTimeout, ChrootDirectory, ClientAliveCountMax, ClientAliveInterval, DenyGroups, DenyUsers, DisableForwarding, ExposeAuthInfo, ForceCommand, GatewayPorts, GSSAPIAuthentication, HostbasedAcceptedAlgorithms, HostbasedAuthentication, HostbasedUsesNameFromPacketOnly, IgnoreRhosts, Include, IPQoS, KbdInteractiveAuthentication, KerberosAuthentication, KerberosUseKuserok, LogLevel, MaxAuthTries, MaxSessions, PAMServiceName, PasswordAuthentication, PermitEmptyPasswords, PermitListen, PermitOpen, PermitRootLogin, PermitTTY, PermitTunnel, PermitUserRC, PubkeyAcceptedAlgorithms, PubkeyAuthentication, PubkeyAuthOptions, RefuseConnection, RekeyLimit, RevokedKeys, RDomain, SetEnv, StreamLocalBindMask, StreamLocalBindUnlink, TrustedUserCAKeys, UnusedConnectionTimeout, X11DisplayOffset, X11MaxDisplays, X11Forwarding and X11UseLocalhost. That's the whole guest list, no plus-ones. πŸŽ€

  • MaxAuthTries β€” the max number of authentication attempts allowed per connection. Once the number of failures reaches half this value, any additional failures get logged. Default is 6.
  • MaxSessions β€” the max number of open shell, login or subsystem (e.g. sftp) sessions permitted per network connection. Clients that support connection multiplexing can open multiple sessions. Setting MaxSessions to 1 effectively disables session multiplexing, while setting it to 0 prevents all shell, login and subsystem sessions β€” but still lets forwarding happen. Default is 10.
  • MaxStartups β€” the max number of concurrent unauthenticated connections to the SSH daemon. Any additional connections get dropped until authentication succeeds or the LoginGraceTime expires for a connection. Default is 10:30:100.

Alternatively, random early drop can be enabled by specifying the three colon separated values start:rate:full (e.g. "10:30:60"). sshd(8) will refuse connection attempts with a probability of rate/100 (30%) if there are currently start (10) unauthenticated connections. The probability increases linearly, and all connection attempts are refused once the number of unauthenticated connections reaches full (60).

  • ModuliFile β€” the moduli(5) file holding the Diffie-Hellman groups used for the β€œdiffie-hellman-group-exchange-sha1” and β€œdiffie-hellman-group-exchange-sha256” key exchange methods. Default is /etc/gsissh/moduli.
  • NoneEnabled β€” enable or disable the use of the None cipher. Care must always be used when enabling this, because it will allow users to send data in the clear. 😭 However, it's important to note that authentication information remains encrypted even if this option is enabled. Default is no.
  • NoneMacEnabled β€” enable or disable the use of the None MAC. When this is enabled, ssh will *not* provide data integrity of any data being transmitted between hosts. Use with caution, because it β€” unlike just using NoneEnabled β€” doesn't provide data integrity and protection against man-in-the-middle attacks. As with NoneEnabled, all authentication remains encrypted and integrity is ensured. Default is no.
  • PAMServiceName β€” the service name used for Pluggable Authentication Modules (PAM) authentication, authorisation and session controls when UsePAM is enabled. Default is sshd.
  • PasswordAuthentication β€” whether password authentication is allowed. Default is yes.
  • PermitEmptyPasswords β€” when password authentication is allowed, this says whether the server lets you log in to accounts with empty password strings. Default is no. (Please, bestie. Empty passwords are not the vibe. 🫢)
  • PermitListen β€” the addresses/ports on which a remote TCP port forwarding may listen. The listen specification must be one of these forms:
PermitListen port
PermitListen host:port

Multiple permissions may be specified by separating them with whitespace. An argument of any removes all restrictions and permits any listen requests. An argument of none prohibits all listen requests. The host name may contain wildcards as described in the PATTERNS section in ssh_config(5). The wildcard β€˜*’ can also be used in place of a port number to allow all ports. By default, all port forwarding listen requests are permitted. Note that the GatewayPorts option may further restrict which addresses may be listened on. Note also that ssh(1) will request a listen host of β€œlocalhost” if no listen host was specifically requested, and this name is treated differently to explicit localhost addresses of β€œ127.0.0.1” and β€œ::1”. Little detail, big consequences. ✨

  • PermitOpen β€” the destinations to which TCP port forwarding is permitted. The forwarding specification must be one of these forms:
PermitOpen host:port
PermitOpen IPv4_addr:port
PermitOpen [IPv6_addr]:port

Multiple forwards may be specified by separating them with whitespace. An argument of any removes all restrictions and permits any forwarding requests. An argument of none prohibits all forwarding requests. The wildcard β€˜*’ can be used for host or port to allow all hosts or ports respectively. Otherwise, no pattern matching or address lookups are performed on supplied names. By default, all port forwarding requests are permitted.

  • PermitRootLogin β€” whether root can log in using ssh(1). The argument must be yes, prohibit-password, forced-commands-only, or no. Default is prohibit-password.

If this option is set to prohibit-password (or its deprecated alias, without-password), password and keyboard-interactive authentication are disabled for root.

If this option is set to forced-commands-only, root login with public key authentication will be allowed β€” but only if the command option has been specified (which may be useful for taking remote backups even if root login is normally not allowed). All other authentication methods are disabled for root.

If this option is set to no, root is not allowed to log in. 🚫

  • PermitTTY β€” whether pty(4) allocation is permitted. Default is yes.
  • PermitTunnel β€” whether tun(4) device forwarding is allowed. The argument must be yes, point-to-point (layer 3), ethernet (layer 2), or no. Specifying yes permits both point-to-point and ethernet. Default is no.

Independent of this setting, the permissions of the selected tun(4) device must allow access to the user. That part's on you. 🧚

  • PermitUserEnvironment β€” whether ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd(8). Valid options are yes, no or a pattern-list specifying which environment variable names to accept (for example "LANG,LC_*"). Default is no. Enabling environment processing may enable users to bypass access restrictions in some configurations using mechanisms such as LD_PRELOAD. So like, be careful. πŸ’€
  • PermitUserRC β€” whether any ~/.ssh/rc file is executed. Default is yes.
  • PerSourceMaxStartups β€” the number of unauthenticated connections allowed from a given source address, or β€œnone” if there is no limit. This limit is applied in addition to MaxStartups, whichever is lower. Default is none.
  • PerSourceNetBlockSize β€” the number of bits of source address that get grouped together for the purposes of applying PerSourceMaxStartups limits. Values for IPv4 and optionally IPv6 may be specified, separated by a colon. Default is 32:128, which means each address is considered individually. 🌈
  • PerSourcePenalties β€” bestie, this one is the ✨vibe police✨ for people being sus to sshd(8). It controls the penalties for all those conditions that might be attacks. If a penalty gets enforced against a client, then its source address β€” plus all the other addresses in the same network, as defined by PerSourceNetBlockSize β€” gets refused connection for a whole period. Blocked, blocked, blocked. 🚫

Quick facts so you're not confused:

  • A penalty does not affect concurrent connections already in progress. The way that it does stack though? Multiple penalties from the same source from concurrent connections will accumulate up to a maximum. And conversely, penalties aren't applied until a minimum threshold time has been accumulated. ⏳
  • Penalties are enabled by default with the default settings listed below, but you can disable them with the no keyword. The defaults can be overridden by specifying one or more of the keywords below, separated by whitespace. All keywords accept arguments, e.g. "crash:2m". πŸ’…

Here are all the keywords, no cap:

  • crash:duration β€” how long to refuse clients that cause a crash of sshd(8) (default: 90s). πŸ’€
  • authfail:duration β€” how long to refuse clients that disconnect after making one or more unsuccessful authentication attempts (default: 5s).
  • refuseconnection:duration β€” how long to refuse clients that were administratively prohibited connection via the RefuseConnection option (default: 10s).
  • noauth:duration β€” how long to refuse clients that disconnect without attempting authentication (default: 1s). ⚠️ Heads up: this timeout should be used cautiously, otherwise it may penalise legitimate scanning tools such as ssh-keyscan(1). Not me accidentally banning the good guys 😭
  • grace-exceeded:duration β€” how long to refuse clients that fail to authenticate after LoginGraceTime (default: 10s).
  • max:duration β€” the maximum time a particular source address range will be refused access for (default: 10m). Repeated penalties will accumulate up to this maximum. πŸ“ˆ
  • min:duration β€” the minimum penalty that must accrue before enforcement begins (default: 15s).
  • max-sources4:number, max-sources6:number β€” the maximum number of client IPv4 and IPv6 address ranges to track for penalties (default: 65536 for both). 🀯
  • overflow:mode β€” controls how the server behaves when max-sources4 or max-sources6 is exceeded. There are two operating modes: deny-all, which denies all incoming connections other than those exempted via PerSourcePenaltyExemptList until a penalty expires, and permissive, which allows new connections by removing existing penalties early (default: permissive). Note that client penalties below the min threshold count against the total number of tracked penalties. IPv4 and IPv6 addresses are tracked separately, so an overflow in one will not affect the other. πŸ™Œ
  • overflow6:mode β€” lets you specify a different overflow mode for IPv6 addresses. The default is to use the same overflow mode as was specified for IPv4.
  • PerSourcePenaltyExemptList β€” the VIP list πŸŽ€, a comma-separated list of addresses to exempt from penalties. This list may contain wildcards and CIDR address/masklen ranges. Note that the mask length provided must be consistent with the address β€” it is an error to specify a mask length that is too long for the address or one with bits set in this host portion of the address. For example, 192.0.2.0/33 and 192.0.2.0/8, respectively. The default is not to exempt any addresses.
  • PidFile β€” specifies the file that contains the process ID of the SSH daemon, or none to not write one. The default is /var/run/gsisshd.pid. πŸ“
  • Port β€” specifies the port number that sshd(8) listens on. The default is 22. Multiple options of this type are permitted. See also ListenAddress. πŸ”Œ
  • PrintLastLog β€” specifies whether sshd(8) should print the date and time of the last user login when a user logs in interactively. The default is yes. πŸ•°οΈ
  • PrintMotd β€” specifies whether sshd(8) should print /etc/motd when a user logs in interactively. (On some systems it is also printed by the shell, /etc/profile, or equivalent.) The default is yes. πŸ“’
  • PubkeyAcceptedAlgorithms β€” okay so the default here is handled system-wide by crypto-policies(7). Info about defaults, how to modify the defaults and how to customize existing policies with sub-policies lives in manual page update-crypto-policies(8). 🧠

It specifies the signature algorithms that will be accepted for public key authentication as a list of comma-separated patterns. And here's the cute prefix magic ✨:

  • If the specified list begins with a β€˜+’ character, then the specified algorithms will be appended to the built-in openssh default set instead of replacing them.
  • If the specified list begins with a β€˜-’ character, then the specified algorithms (including wildcards) will be removed from the built-in openssh default set instead of replacing them.
  • If the specified list begins with a β€˜^’ character, then the specified algorithms will be placed at the head of the built-in openssh default set.

The list of available signature algorithms may also be obtained using "ssh -Q PubkeyAcceptedAlgorithms". πŸ”

  • PubkeyAuthOptions β€” sets one or more public key authentication options. The supported keywords are: none (the default; indicating no additional options are enabled), touch-required and verify-required. πŸ”‘
    • The touch-required option causes public key authentication using a FIDO authenticator algorithm (i.e. ecdsa-sk or ed25519-sk) to always require the signature to attest that a physically present user explicitly confirmed the authentication (usually by touching the authenticator). By default, sshd(8) requires user presence unless overridden with an authorized_keys option. The touch-required flag disables this override. πŸ‘†
    • The verify-required option requires a FIDO key signature attest that the user was verified, e.g. via a PIN. πŸ”’
    • Neither the touch-required or verify-required options have any effect for other, non-FIDO, public key types. Periodt.
  • PubkeyAuthentication β€” specifies whether public key authentication is allowed. The default is yes. πŸ—οΈ
  • RefuseConnection β€” indicates that sshd(8) should unconditionally terminate the connection. Additionally, a refuseconnection penalty may be recorded against the source of the connection if PerSourcePenalties are enabled. This option is only really useful in a Match block. πŸ›‘
  • RekeyLimit β€” specifies the maximum amount of data that may be transmitted or received before the session key is renegotiated, optionally followed by a maximum amount of time that may pass before the session key is renegotiated. The first argument is specified in bytes and may have a suffix of β€˜K’, β€˜M’, or β€˜G’ to indicate Kilobytes, Megabytes, or Gigabytes, respectively. The default is between β€˜1G’ and β€˜4G’, depending on the cipher. The optional second value is specified in seconds and may use any of the units documented in the β€œTIME FORMATS” section. The default value for RekeyLimit is default none, which means that rekeying is performed after the cipher's default amount of data has been sent or received and no time based rekeying is done. πŸ”„
  • RequiredRSASize β€” specifies the minimum RSA key size (in bits) that sshd(8) will accept. User and host-based authentication keys smaller than this limit will be refused. The default is 1024 bits. Note that this limit may only be raised from the default. πŸ“
  • RevokedKeys β€” specifies revoked public keys file, or none to not use one. Keys listed in this file will be refused for public key authentication. ⚠️ Note that if this file is not readable, then public key authentication will be refused for all users. Keys may be specified as a text file, listing one public key per line, or as an OpenSSH Key Revocation List (KRL) as generated by ssh-keygen(1). For more information on KRLs, see the KEY REVOCATION LISTS section in ssh-keygen(1).
  • RDomain β€” specifies an explicit routing domain that is applied after authentication has completed. The user session, as well as any forwarded or listening IP sockets, will be bound to this rdomain(4). If the routing domain is set to %D, then the domain in which the incoming connection was received will be applied. 🌐
  • SecurityKeyProvider β€” specifies a path to a library that will be used when loading FIDO authenticator-hosted keys, overriding the default of using the built-in USB HID support. πŸ¦‹
  • SetEnv β€” specifies one or more environment variables to set in child sessions started by sshd(8) as β€œNAME=VALUE”. The environment value may be quoted (e.g. if it contains whitespace characters). Environment variables set by SetEnv override the default environment and any variables specified by the user via AcceptEnv or PermitUserEnvironment. 🌈
  • SshdAuthPath β€” overrides the default path to the sshd-auth binary that is invoked to complete user authentication. The default is /usr/libexec/gsissh/sshd-auth. This option is intended for use by tests. πŸ§ͺ
  • SshdSessionPath β€” overrides the default path to the sshd-session binary that is invoked to handle each connection. The default is /usr/libexec/gsissh/sshd-session. This option is intended for use by tests. πŸ§ͺ
  • StreamLocalBindMask β€” sets the octal file creation mode mask (umask) used when creating a Unix-domain socket file for local or remote port forwarding. This option is only used for port forwarding to a Unix-domain socket file. 🧦

The default value is 0177, which creates a Unix-domain socket file that's readable and writable only by the owner. πŸ’… Note that not all operating systems honor the file mode on Unix-domain socket files, so like, don't @ me if your OS is quirky. 🫢

  • StreamLocalBindUnlink β€” Okay so this one specifies whether to remove an existing Unix-domain socket file for local or remote port forwarding before creating a new one. If the socket file already exists and StreamLocalBindUnlink is not enabled, sshd will be unable to forward the port to the Unix-domain socket file. This option is only used for port forwarding to a Unix-domain socket file. The argument must be yes or no. The default is no. No cap.
  • StrictModes β€” Specifies whether sshd(8) should check file modes and ownership of the user's files and home directory before accepting login. This is normally desirable because novices sometimes accidentally leave their directory or files world-writable. The default is yes. Note that this does not apply to ChrootDirectory, whose permissions and ownership are checked unconditionally. It's giving security bestie. πŸ‘‘
  • Subsystem β€” Configures an external subsystem (e.g. file transfer daemon). Arguments should be a subsystem name and a command (with optional arguments) to execute upon subsystem request. The command sftp-server implements the SFTP file transfer subsystem. Alternately the name internal-sftp implements an in-process SFTP server. This may simplify configurations using ChrootDirectory to force a different filesystem root on clients. It accepts the same command line arguments as sftp-server and even though it is in-process, settings such as LogLevel or SyslogFacility do not apply to it and must be set explicitly via command line arguments. By default no subsystems are defined. Periodt.
  • SyslogFacility β€” Gives the facility code that is used when logging messages from sshd(8). The possible values are: DAEMON, USER, AUTH, AUTHPRIV, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The default is AUTH. Iconic logging vibes.
  • TCPKeepAlive β€” Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying. On the other hand, if TCP keepalives are not sent, sessions may hang indefinitely on the server, leaving "ghost" users and consuming server resources. The default is yes (to send TCP keepalive messages), and the server will notice if the network goes down or the client host crashes. This avoids infinitely hanging sessions. To disable TCP keepalive messages, the value should be set to no. Enable or disable the polling of the tcp receive buffer throughout the life of the connection. Make sure that this option is enabled for systems making use of autotuning kernels (linux 2.4.24+, 2.6, MS Vista) in order to maximize throughput on high performance networks. Default is yes. Lowkey important, highkey useful. πŸ”₯
  • TrustedUserCAKeys β€” Specifies a file containing public keys of certificate authorities that are trusted to sign user certificates for authentication, or none to not use one. Keys are listed one per line; empty lines and comments starting with # are allowed. If a certificate is presented for authentication and has its signing CA key listed in this file, then it may be used for authentication for any user listed in the certificate's principals list. Note that certificates that lack a list of principals will not be permitted for authentication using TrustedUserCAKeys. For more details on certificates, see the CERTIFICATES section in ssh-keygen(1). The way this works is giving main character energy. πŸ’…
  • UnusedConnectionTimeout β€” Specifies whether and how quickly sshd(8) should close client connections with no open channels. Open channels include active shell, command execution or subsystem sessions, connected network, socket, agent or X11 forwardings. Forwarding listeners, such as those from the ssh(1) -R flag, are not considered as open channels and do not prevent the timeout. The timeout value is specified in seconds or may use any of the units documented in the β€œTIME FORMATS” section. Note that this timeout starts when the client connection completes user authentication but before the client has an opportunity to open any channels. Caution should be used when using short timeout values, as they may not provide sufficient time for the client to request and open its channels before terminating the connection. The default none is to never expire connections for having no open channels. This option may be useful in conjunction with ChannelTimeout. Don't be caught slacking. 🫢
  • UseDNS β€” Specifies whether sshd(8) should look up the remote host name, and to check that the resolved host name for the remote IP address maps back to the very same IP address. If this option is set to no (the default) then only addresses and not host names may be used in ~/.ssh/authorized_keys from and sshd_config Match Host directives. Fr fr.
  • UseMPTCP β€” If set to yes, this will enable Multipath TCP (MPTCP) instead of TCP (this only works on Linux). The default is no. Linux girlies only. 🐧
  • UsePAM β€” Enables the Pluggable Authentication Module interface. If set to yes this will enable PAM authentication using KbdInteractiveAuthentication and PasswordAuthentication in addition to PAM account and session module processing for all authentication types. Because PAM keyboard-interactive authentication usually serves an equivalent role to password authentication, you should disable either PasswordAuthentication or KbdInteractiveAuthentication. If UsePAM is enabled, you will not be able to run sshd(8) as a non-root user. The default is no. The way that PAM works is wild. 😭
  • PermitPAMUserChange β€” If set to yes this will enable PAM authentication to change the name of the user being authenticated. The default is no. Not me changing users mid-auth. πŸ™ˆ
  • VersionAddendum β€” Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default is none. Cute little banner extra. πŸŽ€
  • X11DisplayOffset β€” Specifies the first display number available for sshd(8)'s X11 forwarding. This prevents sshd from interfering with real X11 servers. The default is 10. Slay.
  • X11MaxDisplays β€” Specifies the maximum number of displays available for sshd(8)'s X11 forwarding. This prevents sshd from exhausting local ports. The default is 1000. Iconic.
  • X11Forwarding β€” Specifies whether X11 forwarding is permitted. The argument must be yes or no. The default is no. When X11 forwarding is enabled, there may be additional exposure to the server and to client displays if the sshd(8) proxy display is configured to listen on the wildcard address (see X11UseLocalhost), though this is not the default. Additionally, the authentication spoofing and authentication data verification and substitution occur on the client side. The security risk of using X11 forwarding is that the client's X11 display server may be exposed to attack when the SSH client requests forwarding (see the warnings for ForwardX11 in ssh_config(5)). A system administrator may have a stance in which they want to protect clients that may expose themselves to attack by unwittingly requesting X11 forwarding, which can warrant a no setting. Note that disabling X11 forwarding does not prevent users from forwarding X11 traffic, as users can always install their own forwarders. Security risk? It's giving yikes. πŸ’€
  • X11UseLocalhost β€” Specifies whether sshd(8) should bind the X11 forwarding server to the loopback address or to the wildcard address. By default, sshd binds the forwarding server to the loopback address and sets the hostname part of the DISPLAY environment variable to localhost. This prevents remote hosts from connecting to the proxy display. However, some older X11 clients may not function with this configuration. X11UseLocalhost may be set to no to specify that the forwarding server should be bound to the wildcard address. The argument must be yes or no. The default is yes. Bestie, keep it loopback. ✨
  • XAuthLocation β€” Specifies the full pathname of the xauth(1) program, or none to not use one. The default is /usr/bin/xauth. The way that path is giving. 🌈

⏰ TIME FORMATS ⏰

sshd(8) command-line arguments and configuration file options that specify time may be expressed using a sequence of the form: time[qualifier], where time is a positive integer value and qualifier is one of the following:

  • ⟨none⟩ β€” seconds
  • s | S β€” seconds
  • m | M β€” minutes
  • h | H β€” hours
  • d | D β€” days
  • w | W β€” weeks

Each member of the sequence is added together to calculate the total time value.

Time format examples:

600     600 seconds (10 minutes)
10m     10 minutes
1h30m   1 hour 30 minutes (90 minutes)

✨ TOKENS ✨

okay bestie so some keywords? they don't just take boring static values β€” they take tokens, which get expanded at runtime. it's giving ✨magic variables✨. here's the whole squad:

  • %% β€” a literal %. yes that's it. that's the whole token. she's simple, she's iconic πŸ’…
  • %C β€” identifies the connection endpoints. four space-separated values, in this exact order: client address, client port number, server address, server port number 🫢
  • %D β€” the routing domain in which the incoming connection was received
  • %F β€” the fingerprint of the CA key πŸ”‘
  • %f β€” the fingerprint of the key or certificate
  • %h β€” the home directory of the user 🏠
  • %i β€” the key ID in the certificate
  • %K β€” the base64-encoded CA key
  • %k β€” the base64-encoded key or certificate for authentication
  • %s β€” the serial number of the certificate
  • %T β€” the type of the CA key
  • %t β€” the key or certificate type
  • %U β€” the numeric user ID of the target user
  • %u β€” the username

now here's the important part bestie β€” not every keyword accepts every token. each one has its own lil guest list and if a token isn't invited it is NOT coming in. no cap. here's who gets who:

AuthorizedKeysCommand accepts the tokens %%, %C, %D, %f, %h, %k, %t, %U, and %u.

AuthorizedKeysFile accepts the tokens %%, %h, %U, and %u.

AuthorizedPrincipalsCommand accepts the tokens %%, %C, %D, %F, %f, %h, %i, %K, %k, %s, %T, %t, %U, and %u. (yeah she's the popular one, she got the whole roster 😭)

AuthorizedPrincipalsFile accepts the tokens %%, %h, %U, and %u.

ChrootDirectory accepts the tokens %%, %h, %U, and %u.

RoutingDomain accepts the token %D.


πŸ“ FILES πŸ“

  • /etc/gsissh/sshd_config β€” contains configuration data for sshd(8). this file should be writable by root only πŸ”’ (like, do not let anyone else touch it, fr fr), but it's recommended β€” though not necessary β€” that it be world-readable. so: root writes, everyone else can peek. cute, right? πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

go read those next, bestie, i'm literally begging 🫢


πŸ‘‘ AUTHORS πŸ‘‘

okay history lesson time, and honestly? this part is kind of a slay.

OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. then Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. ✨

Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support for privilege separation. and Chris Rapier, Michael Stevens, Ben Bennet, and Mike Tasota developed the HPN extensions at the Pittsburgh Supercomuting Center with grants from Cisco, the National Library of Medicine, and the National Science Foundation. 🌈

absolute legends, every single one of them. we stan a maintainer πŸ’œ

and that's the whole page, babe!! you made it to the end, i'm so proud of you fr fr πŸ˜­πŸ’–

this lil beauty comes to you from Debian, dated October 4, 2025, and she lives under the name SSHD_CONFIG(5) πŸŽ€

now go forth and configure your sshd responsibly. mwah πŸ’…βœ¨

πŸ“¦ where this page comes from
  • fedora 44: gsi-openssh-server 10.2p1-4.fc44 Β· BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms