sshd_config Analyzer: Grade and Harden Your SSH Server Config
Grade your SSH server config, see the line behind every finding, and get a patch that will not lock you out.
Free · No signupChecked in your browser
Getting the analyzer ready…
Get it from the server
- The config and its drop-ins, with file names
sudo tail -vn +1 /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf - What sshd actually runs, every default filled in
sudo sshd -T
- Paste the configThe file, the file with its drop-ins from the command above, or the output of sudo sshd -T.
- Read the worst firstEach finding names the line, the value sshd will use, and the line that fixes it.
- Patch without a lockoutSafe lines and lines that can end your session come apart, with where to put them.
One config is easy. Twenty is the problem.
Check one file here, audit every server there.
CtrlOps runs the SSH and access audit over SSH on every server you manage, scores each one, and reruns it so a setting relaxed for a test does not stay relaxed. Your keys never leave your machine.
Keep it handy
The directives that matter,
and what they should be.
An absent line is not off: it runs the OpenSSH default, and for passwords and root login the default is the unsafe value.
| Directive | Default if unset | What you want | Why |
|---|---|---|---|
PermitRootLogin | prohibit-password | no | The default still lets root in with a key. Use a normal account and sudo so actions are attributable. |
PasswordAuthentication | yes | no | The default is the insecure value. Leaving it alone means your server accepts passwords. |
KbdInteractiveAuthentication | yes | no | PAM can still prompt for a password through this even after PasswordAuthentication no. |
PermitEmptyPasswords | no | no | Set to yes, any account with a blank password can log in over the network. |
MaxAuthTries | 6 | 3 | Each connection gets this many guesses before it is dropped. |
AllowGroups | unset | ssh-users | Without an allow list, every account on the host may attempt SSH. |
ClientAliveInterval | 0 | 300 | Zero means an abandoned session stays open indefinitely. |
LogLevel | INFO | VERBOSE | VERBOSE records the key fingerprint used for each login, which is what makes an audit possible. |
X11Forwarding | no (yes on Ubuntu) | no | Debian and Ubuntu ship yes. On a headless server it is unused attack surface. |
How sshd reads the file
First value wins.
Everything follows from that.
How to check your sshd_config
- On the server, run
sudo tail -vn +1 /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf. It prints the main file and every drop-in, each under its name. - Paste all of it above. The review runs as you type, in your browser, and nothing is uploaded.
- Read the findings worst first. Each one names the file and line, the value sshd will use, and the fix.
- Open the Hardening patch tab, apply the safe lines, check with
sudo sshd -t, then reload.
The first-value-wins rule that breaks most SSH config checkers
Almost every config format on Linux uses the last value it reads. sshd_config does the opposite: for each keyword, the first value sshd reads is the one it keeps. A file with PasswordAuthentication yes on line 20 and PasswordAuthentication no on line 60 accepts passwords, and sshd prints no warning. A few directives add up instead, such as Port, ListenAddress, HostKey, AllowUsers, AllowGroups and AcceptEnv, so repeating those is not a mistake.
Why your Ubuntu server still accepts passwords
Ubuntu 22.04 and later ship an sshd_config whose first real line is Include /etc/ssh/sshd_config.d/*.conf. With first value wins, anything in that folder beats the whole main file, and cloud images put PasswordAuthentication yes in 50-cloud-init.conf. Paste the drop-ins with the main file and this page reads them where the Include sits; without them, it marks every result a drop-in could change.
Disabling passwords without locking yourself out
PasswordAuthentication no is the most valuable line in the file and the quickest way to lose a server. Open a second terminal, log in with your key, keep the first session open, then apply and run sudo sshd -t before sudo systemctl reload ssh. Turn off KbdInteractiveAuthentication too, or PAM can still ask for a password, unless PAM runs a second factor for you.
Match blocks, and the exception you forgot about
A Match block applies to connections that meet its condition and runs until the next Match or the end of the file, so a line added at the bottom can land inside one. The first matching block wins over the global section, and Match All overrides it for everyone. A list of only negations, such as Match User !backup, matches no one at all. The Per login tab shows exactly what one user from one address gets.
What a config file cannot tell you
This page reads text. It cannot see which keys sit in authorized_keys, who has sudo, or whether an account has a blank password. The SSH and Access checklist runs those checks as shell commands, and CtrlOps runs the whole set across your servers.
Open the SSH and Access checklistsshd_config FAQ
SSH hardening,
explained.
Yes. The analysis runs entirely in your browser using JavaScript on this page. Your config is never uploaded, logged, or transmitted anywhere, and there is no server to store it. You can confirm this by opening your browser devtools network tab while the tool runs. That said, never paste a private key into any website. This tool refuses input that looks like one.
It is a deliberate design choice documented in sshd_config(5): "unless noted otherwise, for each keyword, the first obtained value will be used." It exists so an Include at the top of the file can override defaults set further down. It surprises almost everyone, because nearly every other config format on Linux uses the last value. A duplicated directive means the later line does nothing, and sshd prints no warning about it.
Two common causes. First, on Ubuntu 22.04 and later the main config starts with Include /etc/ssh/sshd_config.d/*.conf, and because sshd uses the first value it finds, a file in that directory overrides yours. Cloud images ship 50-cloud-init.conf with PasswordAuthentication yes. Second, PasswordAuthentication no does not close the PAM keyboard-interactive path, so you also need KbdInteractiveAuthentication no. Run sudo sshd -T to see which value is actually in effect.
sshd_config is the file you edit. sshd -T prints the fully resolved configuration sshd is actually running, with every Include followed, every default filled in, and Match blocks evaluated for the given connection. Pasting the file gives you line numbers and catches duplicates and dead lines. Pasting sshd -T output gives you a definitive answer with no caveats. Use both: the file to find mistakes, the -T output to confirm the result.
It can, which is why the patch is split. Lines that cannot end your session are in one block. PasswordAuthentication, PermitRootLogin, KbdInteractiveAuthentication and the allow-list directives are in a separate block behind a warning, because applying them without working key authentication locks you out permanently. Always open a second terminal, confirm key login works there, keep your original session open, then run sudo sshd -t before reloading.
Because moving off port 22 is obscurity, not security. It reduces log noise from automated scanners and nothing else, a real attacker finds the new port in seconds, and changing the port without opening it in the firewall first is a common way to lose access. The tool notes that you are on port 22 so you know why your logs are full, but it deliberately keeps that line out of the patch. Key-only authentication and Fail2ban are what actually help.
No, and this is where most manual reviews go wrong. An absent directive runs OpenSSH's compiled-in default, and several of those defaults are the insecure value. PasswordAuthentication defaults to yes. PermitRootLogin defaults to prohibit-password, which still allows root in with a key. Some defaults also vary by distribution: X11Forwarding is no upstream but yes on Debian and Ubuntu. This tool marks findings that come from a default so you can tell the two cases apart.
No. It reviews one file. It cannot see who can actually log in, which keys are in authorized_keys, whether an account has a blank password, or who has sudo, because none of that lives in sshd_config. The SSH and Access checklist covers all eleven server-side checks as shell commands you can run yourself, and CtrlOps automates them across a fleet.
Current OpenSSH. For algorithms, the fix removes the weak names from your own lists, or from the default set with a list that starts with "-", using the same patterns as the CtrlOps audit. That keeps newer post-quantum key exchange and never names an algorithm an older OpenSSH would refuse to start with. The tool also flags directives that no longer exist: Protocol and UsePrivilegeSeparation were removed in OpenSSH 7.4 and 7.5, ChallengeResponseAuthentication was renamed to KbdInteractiveAuthentication in 8.7, and DSA host keys were disabled by default in 9.8. A config still carrying those has not been reviewed in a long time.
A Match block applies only to connections meeting its condition, and it scopes every directive after it until the next Match or the end of the file. A weak setting inside Match User deploy is not your global policy, so reporting it as one would be a false positive. This tool evaluates global scope and Match scope separately, and raises a distinct finding when a Match block re-enables something the global config disabled.
Keep working
Related tools for your next task.