NOTE : I have referenced lot of websites and referenced stack overflow answers but its not working for me

I have set up ssh login for my Raspberry Pi 3 Model B V1.2 and its working like a breeze.

Now I want to make it more secure by removing password login for my pi user. So, I did the following changes in the file /etc/ssh/sshd_config


#PasswordAuthentication Yes


PasswordAuthentication no

Save and exit the file


sudo service ssh restart

Even tried rebooting the Pi

But when I connect with other devices its prompting for Password, which it must not happen.

It must not allow any prompts for password and must show error. How can I achieve this?




  • If you refere to other websites, please add the url's!
    – MatsK
    Commented Feb 17, 2018 at 15:37
  • 1
    Try to connect using ssh -vv ... and edit in the output above.
    – goldilocks
    Commented Feb 17, 2018 at 16:48
  • Maybe ssh is asking for the password to unlock your private key and everything is working well?
    – Ingo
    Commented Feb 18, 2018 at 1:56
  • 1
    duplicate of unix.stackexchange.com/questions/373290/…
    – Fabian
    Commented Feb 18, 2018 at 17:08

2 Answers 2


If you want to fully disable password-based authentication, set BOTH PasswordAuthentication and ChallengeResponseAuthentication to no.

  • Thanks @Matsk it worked for me. Was actually ssh ing from juice ssh from android mobile. So it was showing password. Elsewhere its working awesome. Commented Feb 18, 2018 at 5:31

If you look here, you can set how users authenticate themselves (the order of the authentications used). Just set AuthenticationMethods to publickey, it should not be going to a password. Use this in combination with the other answer (disable password authentication).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.