2

I upgraded my remote server to Ubuntu 16.04 (from 14.10).

Then I reconfigured it to only use keys and not passwords. Did that by editing the /etc/ssh/sshd_config file where I changed to the following:

PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no

Then reloaded the shh service with: systemctl reload sshd

The issue at hand is that all public ssh-keys in the ~/.ssh/authorized_keys file seems to be invalid for some reason.

So now, I can not log in anymore. I only get Permission denied (publickey). I tried numerous -o options to force a password prompt with no success. All I need is to be able to log in using a password.

All help is highly appreciated.

2 Answers 2

3

If you can't boot into a root shell you're kinda boned. I've seen this happen before when people forget to change the access on the key file. The recommended method is to attempt to use the key before turning off password based authentication.

If it's an instance in a cloud, call your provider and have them reset the password (which may not be free or even offered.)

If it's an actual box and you have someone that's nearby, call them and bribe them with pizza.

Otherwise, need to get in your car.

When you get to the computer, hit whatever magic F-key gets you into a boot menu on boot, and then select "root shell". Mount the file system as writable. Then edit the configuration file back to where it started and try again.

Also, I normally do this while I'm sitting in front of the box for this exact reason. In a VPS case, I practice the method on a local box first to make sure I have it right.

1
  • Just what I feared. Thanks for the knowledgeable insight :)
    – Andreas
    May 27, 2016 at 9:56
1

Ubuntu 16.04 has disabled dsa keys and now only accepts rsa keys. This got me too, but fortunately I had password access still enabled.

You can add

Host *
PubkeyAcceptedKeyTypes=+ssh-dss

to ~/.ssh/config, or switch to rsa keys. Once you get in...

You must log in to answer this question.

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