79698262

Date: 2025-07-11 11:38:02
Score: 2
Natty:
Report link

Whatever @hongdeshuai mentioned is correct. However, in Ubuntu 22 or later, this setting gets overridden when attempting SSH login with a user configured for password-only authentication.

You can try below steps.

1. After making necessary changes in /etc/ssh/sshd_config (make sure you have below parameters in-place)

PasswordAuthentication yes
PubkeyAuthentication yes
UsePam yes
ChallengeResponseAuthentication no

2. Run, sshd -T | grep passwordauthentication you will get something like below.
"passwordauthentication no"
This means, there is some file in "/etc/ssh/sshd_config.d/*.conf" which is overriding the "passwordauthentication" value.

3. Run, grep -ir passwordauthentication /etc/ssh/sshd_config.d/
You'll get to know which file it is and then you can change the "passwordauthentication" value to "yes".

4. sudo systemctl restart ssh and you're done.

P.S: Feel free to comment if you’ve seen this solution elsewhere or if it needs any corrections. This solution worked in my case.

Reasons:
  • Blacklisted phrase (1): to comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @mentioned
  • Low reputation (1):
Posted by: Akshat V