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: a sshd_config.d drop-in turns off password logins, a simple security step

Security
~/tips/tip-security-sshd-config-d-dropin

sudo sshd -t && sudo systemctl reload ssh

Disables SSH password logins in a separate file that package updates leave alone.

Editing the main sshd_config gets messy at the next package update. A small drop-in file is easier to keep.

echo 'PasswordAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-hardening.conf
sudo sshd -t && sudo systemctl reload ssh
sudo sshd -T | grep passwordauthentication

Current Debian and Ubuntu releases start sshd_config with Include /etc/ssh/sshd_config.d/*.conf. In sshd the first value for a keyword wins, and files are read in alphabetical order, so a name starting with 10- beats cloud images that ship 50-cloud-init.conf with PasswordAuthentication yes.

Always confirm with sshd -T, and make sure your public key works before you reload. Keeping the change in one small file also makes it easy to remove again.

Further reading: sshd_config 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