SSHD_CONFIG(5)
๐ sshd_config ๐
โจ NAME โจ
sshd_config โ the OpenSSH daemon configuration file ๐ (yes bestie, this is sshd_config(5), File Formats Manual, we are literally in it)
๐ธ DESCRIPTION ๐ธ
So sshd(8) reads its configuration data from /etc/ssh/sshd_config โ or from whatever file you point it at with -f on the command line, your call ๐ซถ.
The file is made of keywordโargument pairs, one per line. And here's the vibe check: unless the page says otherwise, for each keyword the first obtained value is the one that gets used. First one wins, periodt ๐ .
Lines starting with # and empty lines are comments (so go ahead and leave yourself little love notes in there, they're free โจ). Arguments can optionally be wrapped in double quotes (") so you can represent arguments that contain spaces. Iconic.
๐ Note that the Debianopenssh-serverpackage ships several options as standard in/etc/ssh/sshd_configthat are not the default insshd(8):
Include /etc/ssh/sshd_config.d/*.confKbdInteractiveAuthentication noX11Forwarding yesPrintMotd noAcceptEnv LANG LC_* COLORTERM NO_COLORSubsystem sftp /usr/lib/openssh/sftp-serverUsePAM yes
The /etc/ssh/sshd_config.d/*.conf files get pulled in at the start of the configuration file, so anything you set in there will override the stuff in /etc/ssh/sshd_config. Sneaky but make it fashion ๐
.
The possible keywords and their meanings are as follows โ and quick heads-up: keywords are case-insensitive but arguments are case-sensitive ๐
๐ฆ AcceptEnv
Specifies which environment variables sent by the client get copied into the session's environ(7). Wanna know how to set it up on the client side? See SendEnv and SetEnv in ssh_config(5), bestie.
The TERM environment variable is always accepted whenever the client requests a pseudo-terminal, because the protocol literally requires it. Not negotiable.
Variables are specified by name, and names may contain the wildcard characters * and ?. Multiple environment variables can be separated by whitespace, or spread across multiple AcceptEnv directives โ do whatever's cute โจ.
โ ๏ธ Be warned: some environment variables could be used to bypass restricted user environments. For this reason, care should be taken in the use of this directive. That's a real warning, not a vibe.
The default is not to accept any environment variables. None. Zero. Nada.
๐ AddressFamily
Specifies which address family sshd(8) should use. Valid arguments are any (the default), inet (IPv4 only), or inet6 (IPv6 only). Pick your fighter ๐ฅ.
๐ AllowAgentForwarding
Specifies whether ssh-agent(1) forwarding is permitted. Default is yes.
๐ Note that disabling agent forwarding does not improve security unless users are also denied shell access โ because they can always install their own forwarders. So likeโฆ do both or don't bother, iykyk ๐ญ.
๐ AllowGroups
This keyword can be followed by a list of group name patterns, separated by spaces. If specified, 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.
AllowGroups is not consulted for groups matched by DenyGroups.
See PATTERNS in ssh_config(5) for more information on patterns. This keyword may appear multiple times in sshd_config, with each instance appending to the list โ collect them all โจ.
๐ง AllowStreamLocalForwarding
Specifies whether StreamLocal (Unix-domain socket) forwarding is permitted. The available options are:
yes(the default) orallโ allow StreamLocal forwardingnoโ prevent all StreamLocal forwardinglocalโ allow local (from the perspective ofssh(1)) forwarding onlyremoteโ allow remote forwarding only
๐ Note that disabling StreamLocal forwarding does not improve security unless users are also denied shell access, as they can always install their own forwarders. Same lore as above, we been knew ๐.
โญ AllowTcpForwarding
Specifies whether TCP forwarding is permitted. The available options are:
yes(the default) orallโ allow TCP forwardingnoโ prevent all TCP forwardinglocalโ allow local (from the perspective ofssh(1)) forwarding onlyremoteโ allow remote forwarding only
๐ Note that disabling TCP forwarding does not improve security unless users are also denied shell access, as they can always install their own forwarders. (Yes this is the third time, it's that important ๐ซ .)
๐ 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 takes the form USER@HOST then USER and HOST are checked separately, restricting logins to particular users from particular hosts. And HOST criteria may additionally contain addresses to match in CIDR address/masklen</> format. Fancy.
AllowUsers is not consulted for users matched by DenyUsers.
See PATTERNS in ssh_config(5) for more information on patterns. This keyword may appear multiple times in sshd_config with each instance appending to the list ๐.
๐ 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 the default is overridden, then successful authentication requires completion of every method in at least one of these lists. Multi-step queen behavior ๐ .
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. Order matters, bestie.
For keyboard interactive authentication it is also possible to 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. Two keys, no copy-paste energy ๐.
๐ 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".
๐ฆ AuthorizedKeysCommand
Specifies a program to be used 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. This command is only executed for valid users.
๐ AuthorizedKeysCommandUser
Specifies the user under whose account the AuthorizedKeysCommand is run. It's recommended to use a dedicated user that has no other role on the host than running authorized keys commands โ like, give them one job and let them slay it ๐
.
โ ๏ธ IfAuthorizedKeysCommandis specified butAuthorizedKeysCommandUseris not, thensshd(8)will refuse to start. Yes, actually refuse. No cap.
๐ 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". These files are only checked for valid users โจ.
๐ AuthorizedPrincipalsCommand
Specifies a program to be used 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. This command is only executed for valid users.
๐ง 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 โ one job, one slay ๐ซถ.
โ ๏ธ IfAuthorizedPrincipalsCommandis specified butAuthorizedPrincipalsCommandUseris not, thensshd(8)will refuse to start. Same energy as above, still very much real.
Okay bestie, that's the first chunk โ more keywords are coming, so stay tuned and don't touch anything yet ๐๐
๐ AuthorizedPrincipalsFile ๐
Okay so this one is basically the VIP list for certificate auth, bestie. It specifies a file that lists principal names accepted for certificate authentication. When you're using certificates signed by a key listed in TrustedUserCAKeys, this file lists names โ and one of them 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. ๐ซถ
Arguments to AuthorizedPrincipalsFile may include wildcards and accept the tokens described in the โTOKENSโ section. After expansion, AuthorizedPrincipalsFile is taken to be an absolute path or one relative to the user's home directory. The default is none, i.e. not to use a principals file โ in this case, the username of the user must appear in a certificate's principals list for it to be accepted. This file is only checked for valid users. โจ
Note thatAuthorizedPrincipalsFileis only used when authentication proceeds using a CA listed inTrustedUserCAKeysand is not consulted for certification authorities trusted via~/.ssh/authorized_keys, though theprincipals=key option offers a similar facility (seesshd(8)for details). ๐
๐ Banner ๐
The contents of the specified file are sent to the remote user before authentication is allowed. If the argument is none then no banner is displayed. By default, no banner is displayed. Simple as that, no cap. ๐ธ
๐ฆ CASignatureAlgorithms ๐ฆ
Specifies which algorithms are allowed for signing of certificates by certificate authorities (CAs). The default is:
ssh-ed25519,ecdsa-sha2-nistp256,
ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
sk-ssh-ed25519@openssh.com,
sk-ecdsa-sha2-nistp256@openssh.com,
rsa-sha2-512,rsa-sha2-256,
ssh-mldsa44-ed25519@openssh.com
If the specified list begins with a + character, then the specified algorithms will be appended to the 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 default set instead of replacing them. ๐
Certificates signed using other algorithms will not be accepted for public key or host-based authentication. Periodt.
๐ ChannelTimeout ๐
Specifies whether and how quickly sshd(8) should close inactive channels. Timeouts are specified as one or more type=interval pairs separated by whitespace, where the type must be the special keyword global or a channel type name from the list below, optionally containing wildcard characters. ๐ง
The timeout value interval is specified in seconds or may use any of the units documented in the โTIME FORMATSโ section. For example, session=5m would cause interactive sessions to terminate after five minutes of inactivity. Specifying a zero value disables the inactivity timeout. ๐
The special timeout global applies to all active channels, taken together. Traffic on any active channel will reset the timeout, but when the timeout expires then all open channels will be closed. Note that this global timeout is not matched by wildcards and must be specified explicitly. โญ
The available channel type names include:
agent-connectionโ Open connections tossh-agent(1).direct-tcpip,direct-streamlocal@openssh.comโ Open TCP or Unix socket (respectively) connections that have been established from anssh(1)local forwarding, i.e.LocalForwardorDynamicForward.forwarded-tcpip,forwarded-streamlocal@openssh.comโ Open TCP or Unix socket (respectively) connections that have been established to ansshd(8)listening on behalf of anssh(1)remote forwarding, i.e.RemoteForward.sessionโ The interactive main session, including shell session, command execution,scp(1),sftp(1), etc.tun-connectionโ OpenTunnelForwardconnections.x11-connectionโ Open X11 forwarding sessions.
Note that in all the above cases, terminating an inactive session does not guarantee to remove all resources associated with the session, e.g. shell processes or X11 clients relating to the session may continue to execute. ๐ญ
Moreover, terminating an inactive channel or session does not necessarily close the SSH connection, nor does it prevent a client from requesting another channel of the same type. In particular, expiring an inactive forwarding session does not prevent another identical forwarding from being subsequently created. ๐
The default is not to expire channels of any type for inactivity.
๐ ChrootDirectory ๐
Specifies the pathname of a directory to chroot(2) to after authentication. At session startup sshd(8) checks that all components of the pathname are root-owned directories which are not 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. ๐ซถ
The ChrootDirectory must contain the necessary files and directories to support the user's session. For an interactive session this requires at least a shell, typically sh(1), and basic /dev nodes such as null(4), zero(4), stdin(4), stdout(4), stderr(4), and tty(4) devices. For file transfer sessions using SFTP no additional configuration of the environment is necessary if the in-process sftp-server is used, though sessions which use logging may require /dev/log inside the chroot directory on some operating systems (see sftp-server(8) for details). ๐
For safety, it is very important that the directory hierarchy be prevented from modification by other processes on the system (especially those outside the jail). Misconfiguration can lead to unsafe environments which sshd(8) cannot detect. ๐
The default is none, indicating not to chroot(2).
๐ฅ Ciphers ๐ฅ
Specifies the ciphers allowed. Multiple ciphers must be comma-separated. If the specified list begins with a + character, then the specified ciphers will be appended to the default set instead of replacing them. If the specified list begins with a - character, then the specified ciphers (including wildcards) will be removed from the default set instead of replacing them. If the specified list begins with a ^ character, then the specified ciphers will be placed at the head of the default set. ๐
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
The default is:
chacha20-poly1305@openssh.com,
aes128-gcm@openssh.com,aes256-gcm@openssh.com,
aes128-ctr,aes192-ctr,aes256-ctr
The list of available ciphers may also be obtained using ssh -Q cipher. โจ
๐ ClientAliveCountMax ๐
Sets the number of client alive messages which may be sent without sshd(8) receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. It is important to note that the use of client alive messages is very different from TCPKeepAlive. The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The client alive mechanism is valuable when the client or server depend on knowing when a connection has become unresponsive. ๐ฆ
The default value is 3. If ClientAliveInterval is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. Setting a zero ClientAliveCountMax disables connection termination. ๐
๐ธ ClientAliveInterval ๐ธ
Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. ๐
๐ Compression ๐
Specifies whether compression is enabled after the user has authenticated successfully. The argument must be yes, delayed (a legacy synonym for yes) or no. The default is yes. โจ
Compression applies to all traffic that flows over the SSH connection. If untrusted traffic (such as an open port-forward) is permitted over the connection alongside trusted traffic, then compression may leak information about session contents. For this reason, it is not recommended to enable compression for connections that share trusted and untrusted traffic. ๐ญ
๐ DebianBanner ๐
Specifies whether the distribution-specified extra version suffix is included during initial protocol handshake. 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. By default, login is allowed for all groups. AllowGroups is not consulted for groups matched by DenyGroups. ๐
See PATTERNS in ssh_config(5) for more information on patterns. This keyword may appear multiple times in sshd_config with each instance appending to the list. ๐
DenyUsers
Okay so bestie, this one is the block list ๐ โ you put a bunch of user name patterns after the keyword, separated by spaces, and login is disallowed for any user name that matches one of them.
Heads up: only user names are valid here. A numerical user ID? Not recognized. Nope. ๐
By default, login is allowed for all users. But if a pattern takes the form USER@HOST, then USER and HOST get checked separately, which restricts logins to particular users coming from particular hosts. And HOST criteria may additionally contain addresses to match in CIDR address/masklen format โ fancy, I know โจ
Also lowkey important: AllowUsers is not consulted for users matched by DenyUsers. So don't be out here thinking AllowUsers will save you.
Peep PATTERNS in ssh_config(5) for more on patterns. And this keyword may appear multiple times in sshd_config, with each instance appending to the list โ it's giving collect-them-all ๐
DisableForwarding
This one just turns everything forwarding off, no cap: X11, ssh-agent(1), TCP and StreamLocal. All of it. ๐ซ
It overrides all other forwarding-related options, which honestly may simplify your restricted configurations โ one flag to rule them all, periodt ๐
ExposeAuthInfo
Writes a temporary file containing a list of authentication methods and public credentials (e.g. keys) used to authenticate the user ๐ The location of that file gets exposed to the user session through the SSH_USER_AUTH environment variable โ iykyk.
Default is no.
FingerprintHash
Specifies the hash algorithm used when logging key fingerprints. Valid options are: md5 and sha256. Default is sha256 โ we stay modern around here ๐
โจ
ForceCommand
Forces the execution of the command specified by ForceCommand, ignoring any command supplied by the client and ~/.ssh/rc if present. Rude? Maybe. Iconic? Absolutely ๐
The command is invoked by using the user's login shell with the -c option. This applies to shell, command, or subsystem execution. It's most useful inside a Match block. And the command the client originally supplied is still available in the SSH_ORIGINAL_COMMAND environment variable โ so you can peek at what they wanted ๐
Specifying a command of internal-sftp will force the use of an in-process SFTP server that requires no support files when used with ChrootDirectory. The default is none.
๐ Real talk warning: this directive does not limit other kinds of access that a client may request via their connection โ such as TCP, agent, socket or X11 forwarding. If you don't want those, you have to explicitly disable them, either individually via their respective options or all together using the DisableForwarding option. Don't get caught out, bestie.
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 prevents other remote hosts from connecting to forwarded ports. Makes sense, keeps things cozy.
GatewayPorts can be used to say "actually sshd, allow remote port forwardings to bind to non-loopback addresses", thus letting other hosts connect. The argument may be:
noโ force remote port forwardings to be available to the local host onlyyesโ force remote port forwardings to bind to the wildcard addressclientspecifiedโ let the client select the address to which the forwarding is bound ๐
The default is no.
GSSAPIAuthentication
Specifies whether user authentication based on GSSAPI is allowed. The default is no.
GSSAPICleanupCredentials
Specifies whether to automatically destroy the user's credentials cache on logout. The default is yes โ clean girl behaviour ๐งนโจ
GSSAPIDelegateCredentials
Accept delegated credentials on the server side. The default is yes.
GSSAPIStrictAcceptorCheck
Determines whether to be strict about the identity of the GSSAPI acceptor 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.
This option may not be effective in Windows Active Directory environments. Just so you know ๐
HostbasedAcceptedAlgorithms
Specifies the signature algorithms that will be accepted for hostbased authentication, as a list of comma-separated patterns. Now here's the little cheat code system:
- if the specified list begins with a
+character, then the specified signature algorithms will be appended to the default set instead of replacing them - if it begins with a
-character, then the specified signature algorithms (including wildcards!) will be removed from the default set instead of replacing them - if it begins with a
^character, then the specified signature algorithms will be placed at the head of the default set
The default for this option is:
ssh-ed25519-cert-v01@openssh.com,
ecdsa-sha2-nistp256-cert-v01@openssh.com,
ecdsa-sha2-nistp384-cert-v01@openssh.com,
ecdsa-sha2-nistp521-cert-v01@openssh.com,
sk-ssh-ed25519-cert-v01@openssh.com,
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
webauthn-sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
rsa-sha2-512-cert-v01@openssh.com,
rsa-sha2-256-cert-v01@openssh.com,
ssh-mldsa44-ed25519-cert-v01@openssh.com,
ssh-ed25519,
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
sk-ssh-ed25519@openssh.com,
sk-ecdsa-sha2-nistp256@openssh.com,
webauthn-sk-ecdsa-sha2-nistp256@openssh.com,
rsa-sha2-512,rsa-sha2-256,
ssh-mldsa44-ed25519@openssh.com
The list of available signature algorithms may also be obtained using ssh -Q HostbasedAcceptedAlgorithms โ go try it, it's satisfying ๐
This was formerly named HostbasedAcceptedKeyTypes.
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 โ trust the client, bestie ๐ซถ 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/ssh/ssh_host_ecdsa_key, /etc/ssh/ssh_host_ed25519_key, /etc/ssh/ssh_host_mldsa44_ed25519_key and /etc/ssh/ssh_host_rsa_key.
Note thatsshd(8)will refuse to use a file if it is group/world-accessible ๐ and that theHostKeyAlgorithmsoption restricts which of the keys are actually used bysshd(8).
It is possible to have multiple host key files โ more is more, okay? โจ It is also possible to specify public host key files instead. In this case operations on the private key will be delegated to an ssh-agent(1). Delegation! Main character energy ๐
HostKeyAgent
Identifies the UNIX-domain socket used to communicate with an agent that has access to the private host keys ๐ If the string "SSH_AUTH_SOCK" is specified, the location of the socket will be read from the SSH_AUTH_SOCK environment variable.
HostKeyAlgorithms
Specifies the host key signature algorithms that the server offers. The default for this option is:
ssh-ed25519-cert-v01@openssh.com,
ecdsa-sha2-nistp256-cert-v01@openssh.com,
ecdsa-sha2-nistp384-cert-v01@openssh.com,
ecdsa-sha2-nistp521-cert-v01@openssh.com,
sk-ssh-ed25519-cert-v01@openssh.com,
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
webauthn-sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
rsa-sha2-512-cert-v01@openssh.com,
rsa-sha2-256-cert-v01@openssh.com,
ssh-mldsa44-ed25519-cert-v01@openssh.com,
ssh-ed25519,
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
sk-ssh-ed25519@openssh.com,
sk-ecdsa-sha2-nistp256@openssh.com,
webauthn-sk-ecdsa-sha2-nistp256@openssh.com,
rsa-sha2-512,rsa-sha2-256,
ssh-mldsa44-ed25519@openssh.com
The list of available signature algorithms may also be obtained using ssh -Q HostKeyAlgorithms ๐
IgnoreRhosts
Specifies whether to ignore per-user .rhosts and .shosts files during HostbasedAuthentication. The system-wide /etc/hosts.equiv and /etc/ssh/shosts.equiv are still used regardless of this setting โ those ones stay no matter what, periodt.
Accepted values are:
yes(the default) โ ignore all per-user filesshosts-onlyโ allow the use of.shostsbut ignore.rhostsnoโ allow both.shostsandrhosts
IgnoreUserKnownHosts
Specifies whether sshd(8) should ignore the user's ~/.ssh/known_hosts during HostbasedAuthentication and use only the system-wide known hosts file /etc/ssh/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 โ alphabetical besties, stay in line ๐
Files without absolute paths are assumed to be in /etc/ssh. An Include directive may appear inside a Match block to perform conditional inclusion โ nesting! we love to see it ๐ฆ
IPQoSโ sets the Differentiated Services Field Codepoint (DSCP) value for the connection ๐ accepted values areaf11,af12,af13,af21,af22,af23,af31,af32,af33,af41,af42,af43,cs0,cs1,cs2,cs3,cs4,cs5,cs6,cs7,ef,le, a numeric value, ornoneto just use whatever the operating system defaults to. It's a flexible little icon and can take one or two arguments, separated by whitespace. One arg? That's your packet class, unconditional, no cap. Two args? Bestie, the first gets auto-picked for interactive sessions and the second for non-interactive ones. Default isef(Expedited Forwarding) for interactive sessions andnone(the OS default) for non-interactive sessions. slay โจKbdInteractiveAuthenticationโ do we allow keyboard-interactive authentication or not? Default isyes, and the argument has to be literallyyesorno. Also, FYI,ChallengeResponseAuthenticationis a deprecated alias for this one โ it's giving legacy, don't @ me ๐KerberosAuthenticationโ should the password the user hands over forPasswordAuthenticationget validated through the Kerberos KDC? If you want this, the server needs a Kerberos servtab that allows verification of the KDC's identity. Default isno๐KerberosGetAFSTokenโ if AFS is active and the user has a Kerberos 5 TGT, try to grab an AFS token before touching the user's home directory. Default isno๐KerberosOrLocalPasswdโ if password auth through Kerberos flops, the password gets validated via any additional local mechanism like/etc/passwd. Default isyesโ backup plan energy fr fr ๐ซถKerberosTicketCleanupโ do we automatically destroy the user's ticket cache file on logout? Default isyes. Cleanup queen ๐งนโจKexAlgorithmsโ the permitted KEX (Key Exchange) algorithms the server will offer to clients. Important vibe check: the ordering of this list does not matter, because the client specifies the preference order. Multiple algorithms must be comma-separated.
Prefix magic, and yes it's iconic:
- starts with a
+? then the specified algorithms get appended to the default set instead of replacing them ๐ - starts with a
-? then the specified algorithms (wildcards included) get removed from the default set instead of replacing them โ๏ธ - starts with a
^? then the specified algorithms get placed at the head of the 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
mlkem768nistp256-sha256
mlkem768x25519-sha256
sntrup761x25519-sha512
sntrup761x25519-sha512@openssh.com
The default is:
mlkem768x25519-sha256,
sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,
curve25519-sha256,curve25519-sha256@libssh.org,
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
You can also just pull the list of supported key exchange algorithms with "ssh -Q KexAlgorithms" ๐
ListenAddressโ the local addressessshd(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]
That optional rdomain qualifier asks sshd(8) to listen in an explicit routing domain. If port isn't specified, sshd listens on the address and all Port options you set. Default is to listen on all local addresses on the current default routing domain. Multiple ListenAddress options are permitted โ stack 'em, bestie ๐ธ
On Linux, routing domains are implemented using Virtual Routing and Forwarding domains (VRFs); for more information, see ip-vrf(8). iykyk
LoginGraceTimeโ the server disconnects after this much time if the user hasn't successfully logged in. If the value is0, there's no time limit at all (chaotic, but okay ๐). Default is120seconds โณLogLevelโ the verbosity level used when logging messages fromsshd(8). Possible values are:QUIET,FATAL,ERROR,INFO,VERBOSE,DEBUG,DEBUG1,DEBUG2, andDEBUG3. Default isINFO.DEBUGandDEBUG1are equivalent, andDEBUG2andDEBUG3each specify higher levels of debugging output.
Logging with a DEBUG level violates the privacy of users and is not recommended. Like, actually โ don't do it ๐
LogVerboseโ specify one or more overrides toLogLevel. An override is one or more pattern lists that match the source file, function and line number to force detailed logging for. Example override pattern:
kex.c:*:1000,*:kex_exchange_identification():*,packet.c:*
which 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 available MAC (message authentication code) algorithms. The MAC algorithm handles data integrity protection. Multiple algorithms must be comma-separated. Same prefix rules as ever, bestie:+โ the specified algorithms get appended to the default set instead of replacing them ๐-โ the specified algorithms (wildcards included) get removed from the default set instead of replacing them โ๏ธ^โ the specified algorithms get placed at the head of the default set ๐
Algorithms containing "-etm" calculate the MAC after encryption (encrypt-then-mac). These are considered safer and their use is recommended โ the safer girlies ๐ฅฐ 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 default is:
umac-64-etm@openssh.com,umac-128-etm@openssh.com,
hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
hmac-sha1-etm@openssh.com,
umac-64@openssh.com,umac-128@openssh.com,
hmac-sha2-256,hmac-sha2-512,hmac-sha1
The list of available MAC algorithms may also be obtained using "ssh -Q mac" ๐ฆ
๐ Match โ the conditional block ๐
Match introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. And if a keyword appears in multiple Match blocks that are satisfied, only the first instance of the 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โ matches all criteriaInvalid-Userโ matches when the requested user-name doesn't match any known account
The available criteria are User, Group, Host, LocalAddress, LocalPort, Version, RDomain, and Address (with RDomain representing the routing domain on which the connection was received; see ip-vrf(8)).
The match patterns may consist of single entries or comma-separated lists and may use the wildcard and negation operators described in the โPATTERNSโ section of ssh_config(5) ๐
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 bestie: the mask length you provide must be consistent with the address โ it's an error to specify a mask length that's too long for the address, or one with bits set in this host portion of the address. For example,192.0.2.0/33and192.0.2.0/8, respectively. Not me making that mistakeโฆ okay maybe me ๐ญ
The Version keyword matches against the version string of sshd(8), for example "OpenSSH_10.0" ๐
okay so bestie, on the lines following a Match keyword, only a subset of keywords may be used โ here's the whole VIP list: 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, LogLevel, MaxAuthTries, MaxSessions, PAMServiceName, PasswordAuthentication, PermitEmptyPasswords, PermitListen, PermitOpen, PermitRootLogin, PermitTTY, PermitTunnel, PermitUserRC, PubkeyAcceptedAlgorithms, PubkeyAuthentication, PubkeyAuthOptions, RefuseConnection, RekeyLimit, RevokedKeys, SetEnv, StreamLocalBindMask, StreamLocalBindUnlink, TrustedUserCAKeys, UnusedConnectionTimeout, X11DisplayOffset, X11Forwarding and X11UseLocalhost. that's the whole guest list ๐
MaxAuthTries ๐
this one sets the maximum number of authentication attempts allowed per connection. once the number of failures reaches half this value, additional failures are logged. the 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 establish multiple sessions. setting MaxSessions to 1 will effectively disable session multiplexing, whereas setting it to 0 will prevent all shell, login and subsystem sessions while still permitting forwarding. the default is 10.
MaxStartups ๐ซถ
this sets the maximum number of concurrent unauthenticated connections to the SSH daemon. additional connections will be dropped until authentication succeeds or the LoginGraceTime expires for a connection.
you can also enable random early drop by specifying three colon separated values start:rate:full (e.g. 10:30:60). the default is 10:30:100. 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 if the number of unauthenticated connections reaches full (60).
ModuliFile ๐
points at the moduli(5) file that contains the Diffie-Hellman groups used for the diffie-hellman-group-exchange-sha1 and diffie-hellman-group-exchange-sha256 key exchange methods. the default is /etc/ssh/moduli.
PAMServiceName โจ
the service name used for Pluggable Authentication Modules (PAM) authentication, authorisation and session controls when UsePAM is enabled. the default is sshd.
PasswordAuthentication ๐
specifies whether password authentication is allowed. the default is yes.
PermitEmptyPasswords ๐
when password authentication is allowed, this specifies whether the server allows login to accounts with empty password strings. the default is no.
PermitListen ๐ก
specifies the addresses/ports on which a remote TCP port forwarding may listen. the listen specification must be one of the following forms:
PermitListen port
PermitListen host:port
multiple permissions may be specified by separating them with whitespace. an argument of any can be used to remove all restrictions and permit any listen requests. an argument of none can be used to prohibit 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.
PermitOpen ๐ช
specifies the destinations to which TCP port forwarding is permitted. the forwarding specification must be one of the following 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 can be used to remove all restrictions and permit any forwarding requests. an argument of none can be used to prohibit 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 ๐
specifies whether root can log in using ssh(1). the argument must be yes, prohibit-password, forced-commands-only, or no. the 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 thecommandoption 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 ๐ฅ๏ธ
specifies whether pty(4) allocation is permitted. the default is yes.
PermitTunnel ๐
specifies 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. the default is no.
independent of this setting, the permissions of the selected tun(4) device must allow access to the user.
PermitUserEnvironment ๐ฑ
specifies 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_*"). the default is no.
enabling environment processing may enable users to bypass access restrictions in some configurations using mechanisms such as LD_PRELOAD. bestie, that is a real warning, not a vibe ๐
PermitUserRC ๐
specifies whether any ~/.ssh/rc file is executed. the default is yes.
PerSourceMaxStartups ๐ง
specifies 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. the default is none.
PerSourceNetBlockSize ๐ฆ
specifies the number of bits of source address that are grouped together for the purposes of applying PerSourceMaxStartups limits. values for IPv4 and optionally IPv6 may be specified, separated by a colon. the default is 32:128, which means each address is considered individually.
PerSourcePenalties ๐จ
controls penalties for various conditions that may represent attacks on sshd(8). if a penalty is enforced against a client then its source address and any others in the same network, as defined by PerSourceNetBlockSize, will be refused connection for a period.
a penalty doesn't affect concurrent connections in progress, but multiple penalties from the same source from concurrent connections will accumulate up to a maximum. conversely, penalties are not applied until a minimum threshold time has been accumulated.
penalties are enabled by default with the default settings listed below but may be disabled using the no keyword. the defaults may be overridden by specifying one or more of the keywords below, separated by whitespace. all keywords accept arguments, e.g. "crash:2m".
crash:durationโ specifies how long to refuse clients that cause a crash ofsshd(8)(default:90s).authfail:durationโ specifies how long to refuse clients that disconnect after making one or more unsuccessful authentication attempts (default:5s).invaliduser:durationโ specifies how long to refuse clients that attempt to log in with an invalid user (default:5s).refuseconnection:durationโ specifies how long to refuse clients that were administratively prohibited connection via theRefuseConnectionoption (default:10s).noauth:durationโ specifies how long to refuse clients that disconnect without attempting authentication (default:1s). this timeout should be used cautiously otherwise it may penalise legitimate scanning tools such asssh-keyscan(1).grace-exceeded:durationโ specifies how long to refuse clients that fail to authenticate afterLoginGraceTime(default:10s).max:durationโ specifies 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โ specifies the minimum penalty that must accrue before enforcement begins (default:15s).max-sources4:number,max-sources6:numberโ okay bestie, this one sets the max number of client IPv4 and IPv6 address ranges tracked for penalties. Default?65536for both. No cap on the cap energy ๐ .overflow:modeโ controls how the server acts whenmax-sources4ormax-sources6gets exceeded. Two modes, periodt:deny-allโ denies all incoming connections other than those exempted viaPerSourcePenaltyExemptListuntil a penalty expires.permissiveโ allows new connections by removing existing penalties early. This is the default. 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. Separate vibes, separate penalty pools โจ
overflow6:modeโ lets you specify a different overflow mode for IPv6 addresses. Default is to use the same overflow mode as you specified for IPv4.PerSourcePenaltyExemptListโ a comma-separated list of addresses to exempt from penalties. This list may contain wildcards and CIDR address/masklen ranges. Mask length 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/33and192.0.2.0/8, respectively. Default is not to exempt any addresses. ๐PidFileโ the file that contains the process ID of the SSH daemon, ornoneto not write one. Default is/run/sshd.pid.Portโ the port number thatsshd(8)listens on. Default is22. Multiple options of this type are permitted. See alsoListenAddress.PrintLastLogโ whethersshd(8)should print the date and time of the last user login when a user logs in interactively. Default isyes.PrintMotdโ whethersshd(8)should print/etc/motdwhen a user logs in interactively. (On some systems it is also printed by the shell,/etc/profile, or equivalent.) Default isyes.PubkeyAcceptedAlgorithmsโ the signature algorithms accepted for public key authentication, as a list of comma-separated patterns. If the specified list begins with a+character, then the specified algorithms are appended to the default set instead of replacing them. If it begins with a-character, then the specified algorithms (including wildcards) are removed from the default set instead of replacing them. If it begins with a^character, then the specified algorithms are placed at the head of the default set. The default for this option is:
ssh-ed25519-cert-v01@openssh.com,
ecdsa-sha2-nistp256-cert-v01@openssh.com,
ecdsa-sha2-nistp384-cert-v01@openssh.com,
ecdsa-sha2-nistp521-cert-v01@openssh.com,
sk-ssh-ed25519-cert-v01@openssh.com,
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
webauthn-sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,
rsa-sha2-512-cert-v01@openssh.com,
rsa-sha2-256-cert-v01@openssh.com,
ssh-mldsa44-ed25519-cert-v01@openssh.com,
ssh-ed25519,
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
sk-ssh-ed25519@openssh.com,
sk-ecdsa-sha2-nistp256@openssh.com,
webauthn-sk-ecdsa-sha2-nistp256@openssh.com,
rsa-sha2-512,rsa-sha2-256,
ssh-mldsa44-ed25519@openssh.com
The list of available signature algorithms may also be obtained using ssh -Q PubkeyAcceptedAlgorithms. iykyk ๐ฅ
PubkeyAuthOptionsโ sets one or more public key authentication options. Supported keywords are:noneโ default; indicating no additional options are enabled.touch-requiredโ causes public key authentication using a FIDO authenticator algorithm (i.e.ecdsa-skored25519-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 anauthorized_keysoption. Thetouch-requiredflag disables this override.verify-requiredโ 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. FIDO keys stay in their own lane ๐
PubkeyAuthenticationโ whether public key authentication is allowed. Default isyes.RefuseConnectionโ indicates thatsshd(8)should unconditionally terminate the connection. Additionally, arefuseconnectionpenalty may be recorded against the source of the connection ifPerSourcePenaltiesare enabled. This option is only really useful in aMatchblock. Instant block energy, no cap ๐RekeyLimitโ 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 ofK,M, orGto indicate Kilobytes, Megabytes, or Gigabytes, respectively. The default is between1Gand4G, 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 forRekeyLimitisdefault 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โ the minimum RSA key size (in bits) thatsshd(8)will accept. User and host-based authentication keys smaller than this limit will be refused. Default is1024bits. Note that this limit may only be raised from the default. Small keys? Not on her watch โจRevokedKeysโ specifies a revoked public keys file, ornoneto 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 byssh-keygen(1). This file may be consulted for each public key authentication attempt received bysshd(8)and its contents must be consistent at all times, therefore it should only be atomically replaced and never modified in place while the server is running. For more information on KRLs, see the KEY REVOCATION LISTS section inssh-keygen(1). Atomic replace only, bestie โ no live edits ๐ซถSecurityKeyProviderโ 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 bysshd(8)asNAME=VALUE. The environment value may be quoted (e.g. if it contains whitespace characters). Environment variables set bySetEnvoverride the default environment and any variables specified by the user viaAcceptEnvorPermitUserEnvironment.SshdAuthPathโ overrides the default path to thesshd-authbinary that is invoked to complete user authentication. Default is/usr/lib/openssh/sshd-auth. This option is intended for use by tests.SshdSessionPathโ overrides the default path to thesshd-sessionbinary that is invoked to handle each connection. Default is/usr/lib/openssh/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 is0177, which creates a Unix-domain socket file that is readable and writable only by the owner. Note that not all operating systems honor the file mode on Unix-domain socket files. Owner-only, iconic behavior ๐StreamLocalBindUnlinkโ 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 andStreamLocalBindUnlinkis not enabled,sshdwill 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 beyesorno. Default isno.StrictModesโ whethersshd(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. Default isyes. Note that this does not apply toChrootDirectory, whose permissions and ownership are checked unconditionally. ChrootDirectory does not skip the vibe check ๐ญ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 commandsftp-serverimplements the SFTP file transfer subsystem. file transfer main character energy ๐ฆSubsystem(still going, bestie) โ so like, the nameinternal-sftpis the other option, and it hooks you up with an in-process SFTP server. Why do you care? Because it can genuinely simplify your life if you're usingChrootDirectoryto force a different filesystem root on clients. It takes the same command line arguments assftp-server, and even though it's in-process, settings likeLogLevelorSyslogFacilitydo not apply to it and must be set explicitly via command line arguments. ๐
And yeah โ by default, no subsystems are defined. Go define some.
๐ OPTIONS (the rest of the alphabet, we're so close) ๐
SyslogFacilityโ tellssshd(8)which facility code to use when it's logging stuff. The possible values are:DAEMON,USER,AUTH,LOCAL0,LOCAL1,LOCAL2,LOCAL3,LOCAL4,LOCAL5,LOCAL6,LOCAL7. The default isAUTH. โจTCPKeepAliveโ should the system send TCP keepalive messages to the other side, yes or no? If they are sent, death of the connection or a crash of one of the machines gets properly noticed. But โ and here's the tradeoff โ it means connections will die if the route is down temporarily, and some people find that 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 (so yes, it sends TCP keepalive messages), and the server will notice if the network goes down or the client host crashes. This avoids infinitely hanging sessions. Lowkey the most useful default ever.
To disable TCP keepalive messages, set the value to no.
Fun fact: this option was formerly called KeepAlive. She rebranded. ๐
TrustedUserCAKeysโ points at a file containing public keys of certificate authorities that are trusted to sign user certificates for authentication, ornoneto not use one. Keys are listed one per line; empty lines and comments starting with#are allowed. So if a certificate shows up for authentication and its signing CA key is listed in this file, then it may be used for authentication for any user listed in the certificate's principals list. ๐
โ ๏ธ Careful though: certificates that lack a list of principals will not be permitted for authentication using TrustedUserCAKeys. No principals, no entry. Periodt.
For more details on certificates, see the CERTIFICATES section in ssh-keygen(1).
UnusedConnectionTimeoutโ specifies whether and how quicklysshd(8)should close client connections with no open channels. And what counts as an open channel? Active shell, command execution or subsystem sessions, connected network, socket, agent or X11 forwardings. What does not count? Forwarding listeners, like the ones from thessh(1)-Rflag โ those aren't considered open channels and do not prevent the timeout. ๐ฐ๏ธ
The timeout value is specified in seconds, or you can 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. So be careful with short timeout values โ they may not give the client enough time to request and open its channels before you terminate the connection. That's giving "snatched away the snack before they could eat it." ๐ญ
The default none is to never expire connections for having no open channels. This option may be useful in conjunction with ChannelTimeout. ๐ซถ
UseDNSโ specifies whethersshd(8)should look up the remote host name, and 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.
UsePAMโ enables the Pluggable Authentication Module interface. If set toyes, this enables PAM authentication usingKbdInteractiveAuthenticationandPasswordAuthenticationin 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.
๐จ And big one: ifUsePAMis enabled, you will not be able to runsshd(8)as a non-root user. The default isno.
VersionAddendumโ optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default isnone. Slap your own lil signature on it if you want. ๐X11DisplayOffsetโ specifies the first display number available forsshd(8)'s X11 forwarding. This prevents sshd from interfering with real X11 servers. The default is10.X11Forwardingโ specifies whether X11 forwarding is permitted. The argument must beyesorno. The default isno.
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. The audacity, honestly.
X11UseLocalhostโ specifies whethersshd(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 theDISPLAYenvironment variable tolocalhost. This prevents remote hosts from connecting to the proxy display. However, some older X11 clients may not function with this configuration.X11UseLocalhostmay be set tonoto specify that the forwarding server should be bound to the wildcard address. The argument must beyesorno. The default isyes.XAuthLocationโ specifies the full pathname of thexauth(1)program, ornoneto not use one. The default is/usr/bin/xauth.
โฐ TIME FORMATS โฐ
Okay so this is the part where you get to be cute with time. 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โฉโ secondss|Sโ secondsm|Mโ minutesh|Hโ hoursd|Dโ daysw|Wโ weeks
Each member of the sequence is added together to calculate the total time value. So yes, you can stack them like a little time parfait. ๐จ
Time format examples:
600 600 seconds (10 minutes)
10m 10 minutes
1h30m 1 hour 30 minutes (90 minutes)
๐ TOKENS ๐
Arguments to some keywords can make use of tokens, which are expanded at runtime. Here's the important bit though: tokens are expanded without quoting or escaping of shell characters. It is the administrator's responsibility to ensure they are safe in the context of their use. ๐ So like, that's on you bestie.
The supported tokens in sshd_config are:
%%โ a literal%.%Cโ identifies the connection endpoints, containing four space-separated values: client address, client port number, server address, and 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 which keyword accepts which token, because they are NOT all the same and you will get caught out:
AuthorizedKeysCommandaccepts the tokens%%,%C,%D,%f,%h,%k,%t,%U, and%u.AuthorizedKeysFileaccepts the tokens%%,%h,%U, and%u.AuthorizedPrincipalsCommandaccepts the tokens%%,%C,%D,%F,%f,%h,%i,%K,%k,%s,%T,%t,%U, and%u.AuthorizedPrincipalsFileaccepts the tokens%%,%h,%U, and%u.ChrootDirectoryaccepts the tokens%%,%h,%U, and%u.
๐ FILES ๐
/etc/ssh/sshd_configโ contains configuration data forsshd(8). This file should be writable by root only, but it is recommended (though not necessary) that it be world-readable. ๐
๐ SEE ALSO ๐
๐ AUTHORS ๐
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. 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. Legends, all of them. ๐
and that's the whole page, bestie!! you literally read all of SSHD_CONFIG(5) ๐ This lil beauty ships from Debian, dated August 8, 2026, and it's filed under SSHD_CONFIG(5). Go forth and configure responsibly, mwah ๐
โจ๐ฆ
๐ฆ where this page comes from
- ubuntu stonking: openssh-server 1:10.5p1-1ubuntu2
- ubuntu stonking: openssh-server 1:10.5p1-1ubuntu3.1
- Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
- Copyright (c) 1999,2000 Markus Friedl. All rights reserved
- Copyright (c) 1999 Aaron Campbell. All rights reserved
- Copyright (c) 1999 Theo de Raadt. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms