Question

SSH is asking for password

  • Posted August 19, 2014

Good evening! I saw there are a lot of quesitons regarding this, but I did not found a solution. I have added “deploy” user and added key to authorized_keys - and was able to actually login with SSH using this key, but all of a sudden server is now prompting for a password again!

The only thing I did, I think, was creating another key (generating) on a server side (I need to to access other server), this process has created known_hosts file. I’m not sure if I was locked out of logging in with SSH key at this point or something else is causing this issue.

Please, adivce ASAP

Thank you!

Subscribe
Share

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.

I would like to know the answer to this as well. I spin up a lot of machines to test things and I get the key to work maybe 40% of the time on first spin up. This is not a client side issue. I just delete my droplet and start again. I dont waste my time resetting the root password. Anytime I spin up a droplet I rm -rf /home/username/known* so as to clear out my known_hosts andknown_hosts.old Please figure this issue out Its really annoying.

Try, on your computer (client) to delete contents of ~/.ssh/known_hosts and then ssh into your server.

I’m too facing same difficulty. I’m able to connect to/login to my remote host (DO droplet) from my windows pc’s WinScp. But I’m not able to connect thru Bash. It asks for password.

And during trying diff things, I tried to restart my ssh service on remote host, but that didn’t work and now my ssh service also has stopped on remote host (won’t start even with a reboot of the remote host). Pls help. I don’t want to reimage my droplet.

I too am facing same difficulty. My client PC is Win10 with Bash/WSL.

If I connect to my DO thru bash, it connects ok with ssh keys without any password demand. But if using the same keys, I try to login thru WindowsPowerShell, it demands the root password before letting me login.

Thank you, both these are correct in configs.

Server is asking me password when I try to connect to it wuth Putty + my key. Same with GIT pushes. Don’t get me wrong - I’ve been doing pretty much same setup for about 4-5 years now, but can’t figure out why server in this case is keep asking me to enter password.

What is asking you for the password? Is it the server asking you for the deploy user’s login password or Windows asking you for the SSH key’s password?

If it’s the server, make sure that you’ve enabled PubkeyAuthentication and disabled PasswordAuthentication in /etc/ssh/sshd_config like:

PubkeyAuthentication yes
#PasswordAuthentication yes

If it’s Windows, you need to run ssh-agent so that it caches the password. Or you could create a new ssh key without a password entirely.

I see. Someone else will have to help you, as I no longer use Windows.

You might try adding -v next time you use ssh to login, as that will give you some output of what the problem might be.

here are some other de-bugging tips: http://blog.codefront.net/2007/02/28/debugging-ssh-public-key-authentication-problems/

Adam, Thanks for reply - unfortunately, this does not really apply as I’m on windows 7. I’m sorry i did not mention this right away. All my other keys and connections work fine.

Please, advice - I had to enter that deploy password 50 times today already, haha, hopefully I’ll get it working!