I use “PubkeyAuthentication” to authenticate on my raspberries with my id_rsa.pub copied to ~/.ssh/authorized_keys. This has always worked until the last update. Now to authenticate myself it asks for my password. How can I solve I have not changed anything in the raspberry configurations and on the pc.
I don’t get any error message, ssimply to log in it asks me for the password.
I also read similar posts, but it worked before.
Hello,
Firstly if you are using the DropBear server than I cannot help. If you are using OpenSSH here are the settings that I have changed in " /etc/ssh/sshd_config" to use a Key instead of a password:
ListenAddress 192.168.1.80
PermitRootLogin no
AllowUsers dietpi
PasswordAuthentication no
KbdInteractiveAuthentication no
UsePAM no
You will not have to change the ListenAddress and probably shouldn’t unless you are sure that you wish to restrict which IP address SSH responds to. I changed it as I also have Wireguard installed and wanted to restrict it’s use to just the local IP address range and not allow someone who is connected via Wireguard to SSH onto the PI. Also I restricted the user who is allowed to SSH on as I wanted to prevent the root user from ever using SSH to gain access, this is optional as well.
You will notice there is a line near the top of the “sshd_config” file that reads “Include /etc/ssh/sshd_config.d/*.conf”. There is a file within this folder which has some settings that ensure that PasswordAuthentication is enabled as a fail safe. If you are sure you can log on using Key Authentication only and that it is working you can either comment this line out using “#” or less advised remove the existing file from within this folder which is what I have done.
I hope this helps.
edit: Oh and don’t forget to either reboot the device or restart the SSH server after changes using “systemctl restart ssh”
Thank you for your response. Today, without me changing any configuration files rsa key authentication works again. I can’t explain what had created this problem, but it solved itself even though my ssh_config file configuration is slightly different from the one posted.
Did you reboot the device in the meantime?
Yes. Yesterday I restarted one of my raspberries, while the other one I started up today. Could the problem stem from the fact that I did not reboot the OS after an update?
I had similar problems when booting from external SSD without extra power supply. At some point I had undervoltage and parts of the filesystem were not available anymore.
I don’t think that not rebooting after an update is a problem.
Glad to hear that it is working again, that is what counts.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.