SSH Won't login permission denied (publickey,password)

February 18, 2017 366 views
Nginx Ubuntu 16.04

I've tried all the tutorials on DO how to set up SSH but nothing will let me get past the access denied. I set it up originally and wanted to add another user, so I followed a tutorial on that, now I cant login with either...
Is there a way to reset ssh and start over without damaging the server (being online) as there is a website connected that needs not be interrupted.

Thank you any help is appreciated...

6 Answers

@lassee94933ef12b990f92bb30

Which guide(s) did you follow? Let's start there so we're on the same page and we can work from there :-).

@lassee94933ef12b990f92bb30

Thanks!

Ok, so let's start with not able to login with either user. If you can't login to SSH, the only other way to login to your Droplet is using console, which you'd access by clicking on the name of the droplet and then clicking on 'Access' and then 'Launch Console'.

To login to console, you'll need your root user password. If you never received a password and your Droplet is setup with SSH Keys only, there's very little that can be done at this point, unfortunately, as you can't use SSH Keys to login to the console.

If you can login to console, you can re-enable PasswordAuthentication by modifying:

/etc/ssh/sshd_config

and changing:

PasswordAuthentication no

to

PasswordAuthentication yes

and then restarting SSHD:

service sshd restart

You could then reset passwords using passwd, such as:

passwd username

Getting you back in is what's important right now. We can then work on setting up SSH Keys after though the best way to setup SSH Keys is actually to deploy them when you deploy your Droplet (as this makes it easier). You could then create a new user and we can walk through the setup,

If you can't login to console, short of submitting a support ticket and seeing if they can help get you back in, you would effectively be locked out and would need to deploy a new Droplet.

When you start tinkering with SSH and a Firewall, you have to be very careful.

@jtittle
Thank you so far so good,
I have access to COnsole and root as well. I followed the steps you have outlined. Tried for kicks to ssh from local machine.. Still permission denied :/

cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Key copied"'

That worked for me.

  • do i type that in the terminal on my local computer or on the console? I can't get through with ssh user@host from local i keep getting permission denied...

    • I replied below, don't know if it messaged you, "Local. You need to replace user with root and host with your server's IP."

Local. You need to replace user with root and host with your server's IP.

Have another answer? Share your knowledge.