Why can I still log in with a password after disabling SSH password authentication?
Asked by
MellowPine47
I configured Ubuntu 24.04's sshd_config with PasswordAuthentication no, PermitRootLogin no, and PubkeyAuthentication yes. I restarted the SSH service with sudo systemctl restart ssh, but I can still connect to the VirtualBox VM using a password. The same behavior occurs with a Hyper-V VM, so it doesn't appear to be specific to VirtualBox. Has something changed in newer Ubuntu releases, or is another SSH setting overriding my configuration?
Answers
The setting you changed only disables the password authentication method itself; it doesnโt necessarily disable every authentication method that can prompt for a password. Check the complete effective sshd configuration rather than relying only on sshd_config, especially the files under /etc/ssh/sshd_config.d/. Also make sure youโre testing a normal user account and not accidentally connecting through another service or configuration.
Reply to this answer
VirtualBox and Hyper-V arenโt involved in SSH authentication here. On newer Ubuntu systems, keyboard-interactive authentication can still accept a password even when PasswordAuthentication is set to no. Try explicitly setting KbdInteractiveAuthentication no as well. Also inspect /etc/ssh/sshd_config.d/ for drop-in files that may override or supplement the main configuration. You can verify the effective settings with sudo sshd -T, then restart the service after making changes.
MellowPine47: Iโll check KbdInteractiveAuthentication and the drop-in configuration files. I hadnโt needed to account for that on older Ubuntu installations, so this explains why the behavior seems different.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowPine47: The SSH service was already restarted, so Iโll focus on checking the effective configuration and the additional files included by the newer Ubuntu setup.