Disable SSH password authentication on Ubuntu (cloud-init)
On this page
Context
While installing an Ubuntu VM on Proxmox, I had trouble disabling SSH password authentication. Even though I had set PasswordAuthentication to no in /etc/ssh/sshd_config and restarted the sshd service, password authentication was still possible.
Cause
All the files in the /etc/ssh/sshd_config.d/ directory are included in the /etc/ssh/sshd_config configuration through the following line:
Include /etc/ssh/sshd_config.d/*.confThis directory contains 50-cloud-init.conf, related to the Ubuntu cloud-init tool, with the line:
PasswordAuthentication yesYou therefore need to comment out that line and restart SSH.
#PasswordAuthentication yesSource
https://askubuntu.com/questions/1440290/unable-to-disable-password-authentication-over-ssh