1. Paste your sshd_config files
Name each block like its path under /etc/ssh. The block named sshd_config is read first, and its Include lines pull in the blocks they match (sshd_config.d/50-cloud-init.conf), in name order, the way sshd does. On the server, sudo head -n 200 /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* shows them.
Optional: check one connection against the Match blocks
Fill in what you know about a login. Blocks whose criteria you leave blank count as not matching.
Paste at least sshd_config above and click Check.
Findings
| File : Line | Type | What happens | Fix |
|---|
How people can log in
The value that wins for each setting
What sshd -T would print for the lines given (plus the defaults that matter most), and where each value came from.
| Setting | Value | From |
|---|
What it checks
- Stops sshd starting: an unknown or misspelt keyword, a value
sshddoes not accept (PermitRootLogin maybe), a keyword with no value, a global-only keyword (Port,Ciphers,UsePAM) inside aMatchblock, a badMatchline. - High:
PermitRootLogin yeswith passwords on;PermitEmptyPasswords yes;PermitUserEnvironment yes(or a list admittingLD_PRELOAD); RC4 ciphers. - Medium: password logins on, including by default; keyboard-interactive through PAM (
UsePAM yes) even afterPasswordAuthentication no; a security setting that is ignored because an earlier file set it first; a drop-in that is never read; a setting written like a global one that sits inside aMatch; CBC ciphers, MD5 MACs, the 1024-bit group1 key exchange,ssh-dss;StrictModes no;IgnoreRhosts no. AMatchblock that turns any of these back on is reported in its scope. - Low:
X11Forwarding yes;GatewayPorts;PermitTunnel; host-based login;MaxAuthTriesover 10;LoginGraceTime 0; SHA-1 MACs, key exchange andssh-rsa; deprecated options that do nothing; other ignored repeats.
The reading follows OpenSSH 9.6p1's own parser (servconf.c, match.c) and the sshd_config(5) manual of that release: first value wins, case-insensitive keywords, an optional =, quotes and trailing comments, Include globs relative to /etc/ssh in byte order, a Match block running to the next Match or the end of its file, Match all, and Match values replacing global ones. This tool is not affiliated with the OpenSSH project. Every type, with the sshd behaviour behind it: sshd_config mistakes explained.
Prefer a CLI, or want this in your own CI?
Same engine, zero dependencies, Node 18 or later:
sudo node check.mjs /etc/ssh # sshd_config and everything it Includes
node check.mjs ./ssh # a copy in your repo, read as /etc/ssh
node check.mjs /etc/ssh --user deploy --addr 10.20.1.5 # what one login gets
node check.mjs /etc/ssh --format json # machine-readable
node check.mjs ./ssh --fail-on-risk # exit 2 on an error, high or medium finding
Get check.mjs and scan.mjs from the repo: nothing to install, no network calls, and it never runs sshd. On the server, sudo sshd -t checks syntax and sudo sshd -T prints the values it will use.
Common questions
Why is my PasswordAuthentication no ignored?
sshd keeps the first value it reads for a setting and ignores later ones, the opposite of most config files. On Ubuntu and Debian, the first line of /etc/ssh/sshd_config is Include /etc/ssh/sshd_config.d/*.conf, so any drop-in that says PasswordAuthentication yes (cloud-init writes one, 50-cloud-init.conf, when an image asks for password logins) wins over your line further down. Put your setting in a drop-in that sorts first, such as 00-hardening.conf, or remove the other one, then check with sudo sshd -T | grep -i passwordauthentication.
Why is my file in sshd_config.d not read?
The stock Include line matches only names ending in .conf, so /etc/ssh/sshd_config.d/hardening or hardening.cfg is never read. Rename it, for example to 10-hardening.conf.
Does indentation end a Match block?
No. sshd ignores indentation: every line after a Match line belongs to that block until the next Match line or the end of the file. A setting written flush left after an indented Match body applies only to the connections that Match selects. Put global settings above the first Match, or write Match all before them.
Is PasswordAuthentication no enough to stop password logins?
Not always. With UsePAM yes (the Ubuntu and Debian default), keyboard-interactive login asks PAM, which asks for the Unix password. KbdInteractiveAuthentication defaults to yes; Ubuntu's stock file sets it to no, but older files and other distributions may not. Set both to no unless PAM drives a second factor.
Does a clean result mean my SSH server is secure?
No. It reads only the patterns listed on this page, from the files you paste. It does not know your OpenSSH version's compiled-in defaults if they differ from 9.6, the keys in authorized_keys, your PAM stack, firewall or fail2ban, or which users have passwords. Confirm with sshd -T on the server, and have a qualified person review anything that protects valuable data.