Verify your OpenSSH daemon configuration quickly before restarting, to avoid lockouts and downtime. 04.01.2026 | reading time: 3 min A single typo in "/etc/ssh/sshd_config" can cut off remote access; test the file first with "sshd -t" to avoid surprises, because this command parses the config and returns an error code without starting the daemon. A concrete test you can run now Create a temporary config containing an obvious error and invoke the checker to see the result; for example run: ``` cat > /tmp/sshd_test_config <<'EOF' Port 2222 FooBar yes EOF sudo /usr/sbin/sshd -t -f /tmp/sshd_test_config echo "exit code:" $? ``` and you should see an error message about the bad option and a nonzero exit code, then fix the file (remove "FooBar yes") and run: ``` sudo /usr/sbin/sshd -t -f /tmp/sshd_test_config echo "exit code:" $? ``` which produces no output and exit code 0, proving the syntax is valid. Everyday practical tips Use "sshd -t" before restarting the service and chain it into your workflow like "sudo sshd -t && sudo systemctl restart sshd" to ensure you only restart with a valid config; remember you can test alternate files with "-f", the check does not start sockets, and a nonzero exit code means the parser found an error you must fix. Deeper inspection and alternatives When you need to know the runtime configuration or debug subtle defaults, run "sshd -T" to print the effective settings; when a restart fails, consult "journalctl -u sshd" and "systemctl status sshd" for logs, and keep a known-good backup of "/etc/ssh/sshd_config" before editing so rollback is quick. Safe automation and CI In configuration management pipelines validate templates with "sshd -t -f <tempfile>" as a gating step; automate the test, check the exit code, and only deploy the file to production hosts when the parser returns success to prevent accidental lockouts. Close and next steps Testing configuration syntax is a small habit that prevents big outages; practice this check, add it to your scripts, and consider expanding your skills toward certification to strengthen your Linux administration career with focused courses and exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. security network troubleshooting utilities