Skip to content

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

Try an example

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
  1. Paste the configThe file, the file with its drop-ins from the command above, or the output of sudo sshd -T.
  2. Read the worst firstEach finding names the line, the value sshd will use, and the line that fixes it.
  3. 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.

Explore Security AuditDownload for MacDownload for Windows

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.

sshd_config directives, their defaults and the hardened value
DirectiveDefault if unsetWhat you wantWhy
PermitRootLoginprohibit-passwordnoThe default still lets root in with a key. Use a normal account and sudo so actions are attributable.
PasswordAuthenticationyesnoThe default is the insecure value. Leaving it alone means your server accepts passwords.
KbdInteractiveAuthenticationyesnoPAM can still prompt for a password through this even after PasswordAuthentication no.
PermitEmptyPasswordsnonoSet to yes, any account with a blank password can log in over the network.
MaxAuthTries63Each connection gets this many guesses before it is dropped.
AllowGroupsunsetssh-usersWithout an allow list, every account on the host may attempt SSH.
ClientAliveInterval0300Zero means an abandoned session stays open indefinitely.
LogLevelINFOVERBOSEVERBOSE records the key fingerprint used for each login, which is what makes an audit possible.
X11Forwardingno (yes on Ubuntu)noDebian 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

  1. 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.
  2. Paste all of it above. The review runs as you type, in your browser, and nothing is uploaded.
  3. Read the findings worst first. Each one names the file and line, the value sshd will use, and the fix.
  4. 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 checklist

sshd_config FAQ

SSH hardening,
explained.

Keep working

Related tools for your next task.

Your privacy preferences. We use product analytics to improve CtrlOps. Google Analytics cookies and live chat stay off until you allow them. Cookie policy