By jtansley
Hello,
I followed the SSH Keys tutorial here at DO but the server still prompts for my user password (not passphrase) when I login. I checked ~/.ssh/authorized_keys and there is only 1 line so it looks like the key copied over OK. I am asked for my user password when I use either the HTML 5 console access program or PuTTY. I am not logging in as root, but the user account has root privileges.
I’m new to SSH so I apologize for not being able to explain the issue too well. I’m using Ubuntu 12.04 (server edition, no desktop).
Tutorial: https://www.digitalocean.com/community/articles/how-to-set-up-ssh-keys--2
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Can I login with only key pairs with my sudo user (not root user)? And if yes, how?
When I created the droplet I connected my previously added keys by checking the checkbox under “Add your SSH keys”. When I logged in as root it worked fine with the added keys. I added a new sudo user, switched to that account and added the public key to the sudo user (password free private key).
adduser newuser usermod -aG sudo su - newuser mkdir ~/.ssh chmod 700 ~/.ssh nano ~/.ssh/authorized_keys Inserted public key chmod 600 ~/.ssh/authorized_keys chown newuser -R ~/.ssh
But when I do the below command: sudo nano /etc/ssh/sshd_config The console now asks for password (the keys are password free).
What’s wrong??
The DigitalOcean control panel SSH Keys are only for the root user. They enable you to log into your account as root, without the root password email. You can then create a new sudoer. <br> <br>Logging in as the new user, even one that can use sudo, however, will still require a password.
Anyone here using DSA keys and a Ubuntu 16.04 droplet (with OpenSSH 7.x by default) should note that DSA keys (pubkey starting with “ssh-dss”) are not accepted by default anymore. This issue caused problems very similar to ones described in the original question. This is understandable because if the keys are not accepted, the ssh reverts back to asking the password.
See:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.