Search code examples
amazon-web-servicesamazon-ec2ubuntu-23.10

Not able to change Ubuntu 23.10 to password authentication


I am using Ubuntu version 23.10 using this AMI:

ami-0025584dae46cb43e "Ubuntu 23.10 Mantic Minotaur"

I am not able to change the authentication from SSH Key to password.

I can change the authentication if I am using Ubuntu version 22.

Is there any setting built-in that AMI that is preventing the change?


I changed sshd config file using this command.

sed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config

And also checked manually if the command is "yes". Not able to login using password. Facing this problem only on 23.10 version of Ubuntu. Earlier versions are OK. Tried official AMI:

ami-0e0ce710d6346d076

and official ARM AMI:

ami-0025584dae46cb43e


Solution

  • To enable password-based authentication on Ubuntu 23.10, the following settings should be set:

    # To disable tunneled clear text passwords, change to no here!
    PasswordAuthentication yes
    
    # Change to yes to enable challenge-response passwords (beware issues with
    # some PAM modules and threads)
    KbdInteractiveAuthentication yes
    

    Note that the provided sed expression is incorrect for this version of Ubuntu. It should instead read something like

    sed -i 's|[#]q*PasswordAuthentication yes|PasswordAuthentication yes|g' /etc/ssh/sshd_config
    

    To set both settings, use the following (and PLEASE be careful with SSH access on public IPs!)

    sed -i 's|[#]q*PasswordAuthentication yes|PasswordAuthentication yes|g' /etc/ssh/sshd_config
    sed -i 's|KbdInteractiveAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config
    

    Finally, depending on your configuration, you may need to make sure the ssh service is restarted with

    systemctl restart ssh.service