Posts tagged ubuntu-server

Subscribe to this tag


How to disable SSH password auth on Ubuntu Server (22.10)

Posted ·

Ubuntu Server has some garbage defaults, at least for certain installation options, that prevents you from disabling password auth the standard way.

Normally, which you still have to do, disabling password auth is done in /etc/ssh/sshd_config by changing PasswordAuthentication from yes to no:

PasswordAuthentication no

Make sure it isn't also set to yes in that same file.

But on Ubuntu Server, at least if you enable sshd as part of the installation process and without importing a key for any reason, they add a file that prevents this. Specifically, they add /etc/ssh/sshd_config.d/50-cloud-init.conf, which sets PasswordAuthentication yes.