3

So.. I can login to my ubuntu machine using private-public key method.

But now I need to have a user with regular username - password login method.

If I try to simply login with username (without specifying RSA key) in putty, I get Disconnected: no supported authentication methods available (server sent: publickey) error.

How to fix this?

0

2 Answers 2

4

In the file /etc/ssh/sshd_config, change the line

#PasswordAuthentication yes

to

PasswordAuthentication yes

and resart sshd:

service sshd restart
0
1

You also may just run the given command into the terminal.

sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config

N.B. Here "PasswordAuthentication no" replace with "PasswordAuthentication yes"

So before run the command you may check using "sudo vim /etc/ssh/sshd_config" what has the value PasswordAuthentication.

Sometime it is written as "#PasswordAuthentication yes"

Then command will be sed -i "s/#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config

And for after Ubuntu 14.04

sudo systemctl restart ssh

Or for before Ubuntu 14.04

sudo service ssh restart

Hope this will work for you.

6
  • Won't work if the line doesn't exist or is prefixed (commented) with #.
    – PerlDuck
    Jun 4, 2018 at 17:12
  • then run sed -i "s/#PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config Jun 4, 2018 at 17:15
  • 1
    ...or "s/#?PasswordAuthentication.*/PasswordAuthentication yes/"
    – PerlDuck
    Jun 4, 2018 at 17:18
  • That's cool command. Jun 4, 2018 at 17:22
  • 1
    @Mimyo Yes, there are so many ways. Both your and my suggestion won't work for # Password…, i.e. if there's a blank or tab between the # and the Password. As long as I don't need to update dozens of config files, I wouldn't put too much effort into a bullet proof regex.
    – PerlDuck
    Jul 18, 2023 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .