brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: run sshd -t before every restart, the cheapest security habit for SSH

Security
~/tips/tip-security-sshd-test-before-reload

sudo sshd -t && sudo systemctl reload ssh

Validates the sshd configuration first and reloads only when the check succeeds.

A typo in sshd_config can lock you out of a remote machine. A syntax check costs one second.

sudo sshd -t && sudo systemctl reload ssh

sshd -t checks the configuration and keys and exits non-zero when something is wrong. With && the reload only runs if the test passed, so a broken file never reaches the running daemon.

The service is called ssh on Debian and Ubuntu and sshd on most other distributions. Keep your current session open while you test a new login in a second terminal, because a reload does not end existing connections.

Further reading: sshd manual page

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link