Mysterious SSH Password Disable Bug on Ubuntu 24.04

2025-04-06

Disabling SSH password access over the internet while allowing it on the local LAN on an Ubuntu 24.04 server seemed straightforward using sshd_config. However, a custom configuration file in /etc/ssh/sshd_config.d/ was ignored after restarting the SSH daemon. The culprit was sshd_config's 'first-come, first-served' configuration rule, and a system-generated '50-cloud-init.conf' file containing 'PasswordAuthentication yes', which loaded before the custom file. Renaming the custom configuration file to '10-no-passwords.conf' solved the problem by ensuring it loaded first.

Development Server Configuration