Score:0

Disabling password authentication not working

dk flag
Sig

On a Ubuntu 22.04 machine, I'm trying to disable password authentication. To achieve that, I have updated /etc/ssh/sshd_config from

...
# PasswordAuthentication yes
...

to

...
PasswordAuthentication no
...

And then restarted sshd with sudo systemctl restart ssh.

However, password authentication is still working.

Am I missing anything here?

On the machine, it's installed OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022.

Score:0
je flag

Not sure if I missed it earlier or if it is new. Now /etc/ssh has a directory sshd_config.d! The way I fixed it was settingPasswordAuthentication no in a conf file in that directory!

I thought sshd was used by RH and ubuntu used ssh (as in sudo systemctl restart ssh)!

Score:0
pe flag

I would first check to see if you have an Include directory (or file) defined, such as:

/etc/sshd_config.d/

There's a chance there is an include file that is overriding /etc/ssh/sshd_config

Next, see what systemctl is doing. Look at /etc/sysconfig/sshd and /etc/sysconfig/sshd-permitrootlogin and maybe adjust those, as needed. Those are the path/filenames on RHEL 8, I think it's the same for Ubuntu 22.04.

I would also check the ssh client. An ssh command-line option -o PreferredAuthentications=password might override the server preference. Check to see if something similar exists in your client's ~/.ssh/config file, or if using he server's client (to localhost), it may use /etc/ssh/ssh_config.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.