By kirandev
It was working before but now somehow its not working.
ssh root@111.11.11.111 gives below error message Permission denied (publickey).
While for other user its working ( i.e ssh myUser@111.11.11.111 )
I had tried many tutorials on digital oceans and from stackoverflow, but none working and I can’t login with root.
Anybody has resolution? Thanks.
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!
You get that error message when : PasswordAuthentication no in /etc/sshd_config.
I changed it to “yes”, ran ‘service ssh restart’ and all was well. Changed it back to “no” and again ran ‘service ssh restart’. ssh to DO machine now works as intended.
NB:I don’t allow password logins.
This happens if you have multiple SSH keys loaded into your agent.
Lets say your key file is id_rsa and id_rsa.pub respectivly
ssh -i ~/.ssh/id_rsa root@111.11.11.111
If you don’t want to type the -i aspect each time create a file in your .ssh folder named config and add an entry like below
Host whatever_name
HostName 111.11.11.111 or domain.com
User root
PreferredAuthentications publickey
IdentityFile /path/to/.ssh/key_file
UseKeychain yes
AddKeysToAgent yes
update the entry to match your setup.
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.