I cant find the line "PasswordAuthentication no " with sudo nano /etc/shh/shhd_config command

To disable Password Authentication after sshkey been added to home directory for user.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello all,

  1. Log in to the console on the DigitalOcean website.
  2. Type sudo nano /etc/ssh/sshd_config
  3. Change PasswordAuthentication from “yes” to “no” and save the file

Hope that this helps! Regards, Alex

Hi ebbergh,

It happens to me as well. So, I search sshd_config first, and then I go to the directory like this.

find / -name sshd_config

The directory is /etc/ssh/sshd_config. Use the command below to go to the directory.

cd /etc/ssh/

Once you go to the directory, you will see PasswordAuthentication No when you type the command below.

Pico sshd_config

Hope my comment can help you:)

Instead using nano when you can’t find that line try to grep that string to find out if it’s really there (Maybe you can’t see it ;) )

grep -n PasswordAuthentication  /etc/ssh/sshd_config

It will give you also the line number in file where it is exactly. If there will be nothing, so just try to put that parameter to that file and restart sshd